Vowpal Wabbit
|
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/wait.h>
#include <unistd.h>
#include <netinet/tcp.h>
#include <csignal>
#include <fstream>
#include <netdb.h>
#include <cerrno>
#include <cstdio>
#include <cassert>
#include "parse_example.h"
#include "cache.h"
#include "unique_sort.h"
#include "constant.h"
#include "vw.h"
#include "interactions.h"
#include "vw_exception.h"
#include "parse_example_json.h"
#include "parse_dispatch_loop.h"
#include "parse_args.h"
Go to the source code of this file.
Namespaces | |
VW | |
Macros | |
#define | MAP_ANONYMOUS MAP_ANON |
Functions | |
void | handle_sigterm (int) |
bool | is_test_only (uint32_t counter, uint32_t period, uint32_t after, bool holdout_off, uint32_t target_modulus) |
void | set_compressed (parser *par) |
uint32_t | cache_numbits (io_buf *buf, int filepointer) |
void | reset_source (vw &all, size_t numbits) |
void | finalize_source (parser *p) |
void | make_write_cache (vw &all, std::string &newname, bool quiet) |
void | parse_cache (vw &all, std::vector< std::string > cache_files, bool kill_cache, bool quiet) |
void | enable_sources (vw &all, bool quiet, size_t passes, input_options &input_options) |
void | lock_done (parser &p) |
void | set_done (vw &all) |
void | addgrams (vw &all, size_t ngram, size_t skip_gram, features &fs, size_t initial_length, v_array< size_t > &gram_mask, size_t skips) |
void | generateGrams (vw &all, example *&ex) |
void | end_pass_example (vw &all, example *ae) |
void | feature_limit (vw &all, example *ex) |
example & | VW::get_unused_example (vw *all) |
void | VW::setup_examples (vw &all, v_array< example *> &examples) |
void | VW::setup_example (vw &all, example *ae) |
example * | VW::new_unused_example (vw &all) |
example * | VW::read_example (vw &all, char *example_line) |
example * | VW::read_example (vw &all, std::string example_line) |
void | VW::add_constant_feature (vw &vw, example *ec) |
void | VW::add_label (example *ec, float label, float weight, float base) |
example * | VW::import_example (vw &all, const std::string &label, primitive_feature_space *features, size_t len) |
primitive_feature_space * | VW::export_example (vw &all, example *ec, size_t &len) |
void | VW::releaseFeatureSpace (primitive_feature_space *features, size_t len) |
void | VW::parse_example_label (vw &all, example &ec, std::string label) |
void | VW::empty_example (vw &, example &ec) |
void | VW::clean_example (vw &, example &, bool rewind) |
void | VW::finish_example (vw &, example &) |
void | thread_dispatch (vw &all, v_array< example *> examples) |
void | main_parse_loop (vw *all) |
example * | VW::get_example (parser *p) |
float | VW::get_topic_prediction (example *ec, size_t i) |
float | VW::get_label (example *ec) |
float | VW::get_importance (example *ec) |
float | VW::get_initial (example *ec) |
float | VW::get_prediction (example *ec) |
float | VW::get_cost_sensitive_prediction (example *ec) |
v_array< float > & | VW::get_cost_sensitive_prediction_confidence_scores (example *ec) |
uint32_t * | VW::get_multilabel_predictions (example *ec, size_t &len) |
float | VW::get_action_score (example *ec, size_t i) |
size_t | VW::get_action_score_length (example *ec) |
size_t | VW::get_tag_length (example *ec) |
const char * | VW::get_tag (example *ec) |
size_t | VW::get_feature_number (example *ec) |
float | VW::get_confidence (example *ec) |
void | adjust_used_index (vw &) |
void | VW::start_parser (vw &all) |
void | free_parser (vw &all) |
void | VW::end_parser (vw &all) |
bool | VW::is_ring_example (vw &all, example *ae) |
Variables | |
bool | got_sigterm |
#define MAP_ANONYMOUS MAP_ANON |
Definition at line 309 of file parser.cc.
Referenced by enable_sources(), and dense_parameters::share().
void addgrams | ( | vw & | all, |
size_t | ngram, | ||
size_t | skip_gram, | ||
features & | fs, | ||
size_t | initial_length, | ||
v_array< size_t > & | gram_mask, | ||
size_t | skips | ||
) |
Definition at line 584 of file parser.cc.
References features::indicies, v_array< T >::last(), v_array< T >::pop(), v_array< T >::push_back(), features::push_back(), quadratic_constant, v_array< T >::size(), and features::space_names.
Referenced by generateGrams().
void adjust_used_index | ( | vw & | ) |
Definition at line 968 of file parser.cc.
Referenced by VW_Finish_Passes().
uint32_t cache_numbits | ( | io_buf * | buf, |
int | filepointer | ||
) |
Definition at line 91 of file parser.cc.
References io_buf::read_file(), THROW, and VW::version().
Referenced by parse_cache(), and reset_source().
void enable_sources | ( | vw & | all, |
bool | quiet, | ||
size_t | passes, | ||
input_options & | input_options | ||
) |
Definition at line 312 of file parser.cc.
References vw::active, parser::audit, vw::audit, binary_print_result(), parser::bound_sock, input_options::cache_files, children(), io_buf::count, io_buf::current, vw::daemon, vw::data_filename, parser::decision_service_json, input_options::dsjson, v_array< T >::empty(), f, io_buf::files, vw::final_prediction_sink, VW::finish(), input_options::foreground, handle_sigterm(), vw::hash_inv, parser::input, isbinary(), input_options::json, input_options::kill_cache, parser::label_sock, vw::length(), MAP_ANONYMOUS, parser::max_fd, vw::num_children, io_buf::open_file(), vw::options, vw::p, parse_cache(), input_options::pid_file, input_options::port, input_options::port_file, vw::print, print_result(), v_array< T >::push_back(), vw::quiet, io_buf::READ, read_cached_features(), read_features_string(), VW::read_lines(), parser::reader, parser::resettable, v_array< T >::resize(), vw::sd, parameters::share(), v_array< T >::size(), parser::sorted_cache, vw::stdin_off, parser::text_reader, THROW, THROWERRNO, vw::trace_message, VW::config::options_i::was_supplied(), vw::weights, and parser::write_cache.
Referenced by parse_sources().
Definition at line 644 of file parser.cc.
References label_parser::default_label, example::end_pass, parser::in_pass_counter, example::l, parser::lp, and vw::p.
Definition at line 651 of file parser.cc.
References example_predict::feature_space, example_predict::indices, vw::limit, vw::parse_mask, features::sort(), and unique_features().
Referenced by VW::setup_example().
void finalize_source | ( | parser * | p | ) |
Definition at line 206 of file parser.cc.
References io_buf::close_files(), v_array< T >::empty(), f, io_buf::files, parser::input, v_array< T >::last(), parser::output, and v_array< T >::pop().
Referenced by VW::finish(), and set_compressed().
void free_parser | ( | vw & | all | ) |
Definition at line 976 of file parser.cc.
References parser::counts, io_buf::currentname, VW::dealloc_example(), label_parser::delete_label, vw::delete_prediction, v_array< T >::delete_v(), VW::object_pool< T, TInitializer, TCleanup >::empty(), parser::example_pool, io_buf::finalname, VW::object_pool< T, TInitializer, TCleanup >::get_object(), parser::gram_mask, parser::lp, parser::name, vw::ngram_strings, parser::output, vw::p, VW::ptr_queue< T >::pop(), parser::ready_parsed_examples, VW::ptr_queue< T >::size(), and parser::words.
Referenced by VW::finish().
This function adds k-skip-n-grams to the feature vector. Definition of k-skip-n-grams: Consider a feature vector - a, b, c, d, e, f 2-skip-2-grams would be - ab, ac, ad, bc, bd, be, cd, ce, cf, de, df, ef 1-skip-3-grams would be - abc, abd, acd, ace, bcd, bce, bde, bdf, cde, cdf, cef, def Note that for a n-gram, (n-1)-grams, (n-2)-grams... 2-grams are also appended The k-skip-n-grams are appended to the feature vector. Hash is evaluated using the principle h(a, b) = h(a)*X + h(b), where X is a random no. 32 random nos. are maintained in an array and are used in the hashing.
Definition at line 630 of file parser.cc.
References addgrams(), v_array< T >::clear(), example_predict::feature_space, parser::gram_mask, example_predict::indices, vw::ngram, vw::p, v_array< T >::push_back(), and vw::skips.
Referenced by VW::setup_example().
void handle_sigterm | ( | int | ) |
bool is_test_only | ( | uint32_t | counter, |
uint32_t | period, | ||
uint32_t | after, | ||
bool | holdout_off, | ||
uint32_t | target_modulus | ||
) |
Definition at line 70 of file parser.cc.
Referenced by VW::setup_example().
void lock_done | ( | parser & | p | ) |
Definition at line 571 of file parser.cc.
References parser::done, parser::ready_parsed_examples, and VW::ptr_queue< T >::set_done().
Referenced by parse_dispatch(), and set_done().
void main_parse_loop | ( | vw * | all | ) |
Definition at line 905 of file parser.cc.
References parse_dispatch(), and thread_dispatch().
Referenced by VW::start_parser().
void make_write_cache | ( | vw & | all, |
std::string & | newname, | ||
bool | quiet | ||
) |
Definition at line 223 of file parser.cc.
References io_buf::currentname, f, io_buf::files, io_buf::finalname, vw::num_bits, io_buf::open_file(), parser::output, vw::p, push_many(), v_array< T >::size(), vw::stdin_off, prediction_type::to_string(), vw::trace_message, VW::version(), io_buf::WRITE, parser::write_cache, and io_buf::write_file().
Referenced by parse_cache().
void parse_cache | ( | vw & | all, |
std::vector< std::string > | cache_files, | ||
bool | kill_cache, | ||
bool | quiet | ||
) |
Definition at line 255 of file parser.cc.
References c, cache_numbits(), io_buf::close_file(), v_array< T >::delete_v(), f, parser::input, make_write_cache(), vw::num_bits, io_buf::open_file(), parser::output, vw::p, vw::parse_mask, io_buf::READ, read_cached_features(), parser::reader, parser::resettable, parser::sorted_cache, io_buf::space, vw::stdin_off, vw::trace_message, and parser::write_cache.
Referenced by enable_sources().
void reset_source | ( | vw & | all, |
size_t | numbits | ||
) |
Definition at line 126 of file parser.cc.
References v_array< T >::begin(), binary_print_result(), parser::bound_sock, cache_numbits(), v_array< T >::clear(), io_buf::close_file(), io_buf::close_file_or_socket(), io_buf::compressed(), io_buf::current, io_buf::currentname, vw::daemon, f, io_buf::files, vw::final_prediction_sink, io_buf::finalname, recall_tree_ns::find(), io_buf::flush(), parser::input, isbinary(), io_buf::num_files(), io_buf::open_file(), parser::output, parser::output_done, parser::output_lock, vw::p, v_array< T >::pop(), vw::print, print_result(), v_array< T >::push_back(), io_buf::READ, read_cached_features(), read_features_string(), parser::reader, parser::ready_parsed_examples, io_buf::reset_file(), parser::resettable, v_array< T >::size(), VW::ptr_queue< T >::size(), vw::stdin_off, THROW, and parser::write_cache.
Referenced by parse_dispatch().
void set_compressed | ( | parser * | par | ) |
Definition at line 82 of file parser.cc.
References finalize_source(), parser::input, and parser::output.
Referenced by parse_source().
void set_done | ( | vw & | all | ) |
Definition at line 578 of file parser.cc.
References vw::early_terminate, lock_done(), and vw::p.
Referenced by GD::end_pass(), end_pass(), and finish_example().
Definition at line 896 of file parser.cc.
References parser::end_parsed_examples, vw::p, VW::ptr_queue< T >::push(), parser::ready_parsed_examples, and v_array< T >::size().
Referenced by main_parse_loop().