diff options
Diffstat (limited to 'vowpalwabbit/example.h')
-rw-r--r-- | vowpalwabbit/example.h | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/vowpalwabbit/example.h b/vowpalwabbit/example.h index 1602da26..3d572214 100644 --- a/vowpalwabbit/example.h +++ b/vowpalwabbit/example.h @@ -9,6 +9,15 @@ license as described in the file LICENSE. #include <stdint.h> #include "v_array.h" +const size_t wap_ldf_namespace = 126; +const size_t history_namespace = 127; +const size_t constant_namespace = 128; +const size_t nn_output_namespace = 129; +const size_t autolink_namespace = 130; +const size_t neighbor_namespace = 131; +const size_t affix_namespace = 132; +const size_t spelling_namespace = 133; + struct feature { float x; uint32_t weight_index; @@ -59,10 +68,38 @@ struct example // core example datatype. bool done; //set to false by setup_example() }; + struct vw; + +namespace VW { +struct flat_example +{ + void* ld; + simple_prediction final_prediction; + + size_t tag_len; + char* tag;//An identifier for the example. + + size_t example_counter; + uint32_t ft_offset; + float global_weight; + + size_t num_features;//precomputed, cause it's fast&easy. + size_t feature_map_len; + feature* feature_map; //map to store sparse feature vectors +}; +flat_example* flatten_example(vw& all, example *ec); +void free_flatten_example(flat_example* fec); +} + example *alloc_example(size_t); void dealloc_example(void(*delete_label)(void*), example&); -void update_example_indicies(bool audit, example* ec, uint32_t amount); -bool command_example(void*a, example* ec); +inline int example_is_newline(example* ec) +{ + // if only index is constant namespace or no index + return ((ec->indices.size() == 0) || + ((ec->indices.size() == 1) && + (ec->indices.last() == constant_namespace))); +} #endif |