Vowpal Wabbit
|
#include "gtest/gtest.h"
#include "gmock/gmock.h"
#include "ut_util.h"
#include <vector>
#include <set>
#include <stdlib.h>
#include <streambuf>
#include <array>
#include <fstream>
#include "example_predict_builder.h"
#include "array_parameters.h"
#include "data.h"
Go to the source code of this file.
Classes | |
struct | membuf |
struct | test_data |
struct | PredictParam |
class | PredictTest |
struct | InvalidModelParam |
class | InvalidModelTest |
struct | CBPredictParam |
class | CBPredictTest |
class | VwSlimTest< W > |
Macros | |
#define | TEST_DATA(input, filename) |
Typedefs | |
typedef ::testing::Types< sparse_parameters, dense_parameters > | WeightParameters |
Enumerations | |
enum | PredictParamWeightType { All, Sparse, Dense } |
Functions | |
std::vector< float > | read_floats (std::istream &data) |
std::vector< float > | read_floats (unsigned char *data, unsigned int len) |
std::vector< float > | read_floats (const char *filename) |
test_data | get_test_data (const char *model_filename) |
template<typename W > | |
void | run_predict_in_memory (const char *model_filename, const char *data_filename, const char *prediction_reference_filename) |
::std::ostream & | operator<< (::std::ostream &os, const PredictParam ¶m) |
TEST_P (PredictTest, Run) | |
std::vector< PredictParam > | GenerateTestParams () |
INSTANTIATE_TEST_SUITE_P (VowpalWabbitSlim, PredictTest, ::testing::ValuesIn(GenerateTestParams())) | |
::std::ostream & | operator<< (::std::ostream &os, const InvalidModelParam ¶m) |
TEST_P (InvalidModelTest, Run) | |
INSTANTIATE_TEST_SUITE_P (VowpalWabbitSlim, InvalidModelTest, ::testing::ValuesIn(invalid_model_param)) | |
TEST (VowpalWabbitSlim, multiclass_data_4) | |
void | cb_data_epsilon_0_skype_jb_test_runner (int call_type, int modality, int network_type, int platform, std::vector< int > ranking_expected, std::vector< float > pdf_expected) |
TEST (VowpalWabbitSlim, interaction_num_bits_bug) | |
TEST (VowpalWabbitSlim, cb_data_epsilon_0_skype_jb) | |
void | generate_cb_data_5 (safe_example_predict &shared, safe_example_predict *ex) |
std::string | generate_string_seed (size_t i) |
::std::ostream & | operator<< (::std::ostream &os, const CBPredictParam ¶m) |
TEST_P (CBPredictTest, CBRunPredict) | |
INSTANTIATE_TEST_SUITE_P (VowpalWabbitSlim, CBPredictTest, ::testing::ValuesIn(cb_predict_params)) | |
TYPED_TEST_SUITE_P (VwSlimTest) | |
TYPED_TEST_P (VwSlimTest, model_not_loaded) | |
TYPED_TEST_P (VwSlimTest, model_reduction_mismatch) | |
TYPED_TEST_P (VwSlimTest, model_corrupted) | |
REGISTER_TYPED_TEST_SUITE_P (VwSlimTest, model_not_loaded, model_reduction_mismatch, model_corrupted) | |
INSTANTIATE_TYPED_TEST_SUITE_P (VowpalWabbitSlim, VwSlimTest, WeightParameters) | |
TEST (ColdStartModel, action_set_not_reordered) | |
Variables | |
InvalidModelParam | invalid_model_param [] |
CBPredictParam | cb_predict_params [] |
#define TEST_DATA | ( | input, | |
filename | |||
) |
Definition at line 59 of file ut_vw.cc.
Referenced by get_test_data().
typedef ::testing::Types<sparse_parameters, dense_parameters> WeightParameters |
Enumerator | |
---|---|
All | |
Sparse | |
Dense |
void cb_data_epsilon_0_skype_jb_test_runner | ( | int | call_type, |
int | modality, | ||
int | network_type, | ||
int | platform, | ||
std::vector< int > | ranking_expected, | ||
std::vector< float > | pdf_expected | ||
) |
Definition at line 382 of file ut_vw.cc.
References f, get_test_data(), vw_slim::vw_predict< W >::load(), test_data::model, test_data::model_len, vw_slim::vw_predict< W >::predict(), and vw_slim::example_predict_builder::push_feature().
Referenced by TEST().
void generate_cb_data_5 | ( | safe_example_predict & | shared, |
safe_example_predict * | ex | ||
) |
Definition at line 512 of file ut_vw.cc.
References safe_example_predict::clear(), f, and vw_slim::example_predict_builder::push_feature().
Referenced by TEST_P().
std::string generate_string_seed | ( | size_t | i | ) |
std::vector<PredictParam> GenerateTestParams | ( | ) |
Definition at line 255 of file ut_vw.cc.
References All, Dense, INSTANTIATE_TEST_SUITE_P(), Sparse, and PredictParam::weight_type.
test_data get_test_data | ( | const char * | model_filename | ) |
Definition at line 70 of file ut_vw.cc.
References TEST_DATA.
Referenced by cb_data_epsilon_0_skype_jb_test_runner(), run_predict_in_memory(), TEST(), TEST_P(), and TYPED_TEST_P().
INSTANTIATE_TEST_SUITE_P | ( | VowpalWabbitSlim | , |
PredictTest | , | ||
::testing::ValuesIn(GenerateTestParams()) | |||
) |
Referenced by GenerateTestParams().
INSTANTIATE_TEST_SUITE_P | ( | VowpalWabbitSlim | , |
InvalidModelTest | , | ||
::testing::ValuesIn(invalid_model_param) | |||
) |
INSTANTIATE_TEST_SUITE_P | ( | VowpalWabbitSlim | , |
CBPredictTest | , | ||
::testing::ValuesIn(cb_predict_params) | |||
) |
INSTANTIATE_TYPED_TEST_SUITE_P | ( | VowpalWabbitSlim | , |
VwSlimTest | , | ||
WeightParameters | |||
) |
Referenced by TYPED_TEST_P().
::std::ostream& operator<< | ( | ::std::ostream & | os, |
const PredictParam & | param | ||
) |
Definition at line 235 of file ut_vw.cc.
References PredictParam::data_filename, PredictParam::model_filename, Sparse, and PredictParam::weight_type.
::std::ostream& operator<< | ( | ::std::ostream & | os, |
const InvalidModelParam & | param | ||
) |
::std::ostream& operator<< | ( | ::std::ostream & | os, |
const CBPredictParam & | param | ||
) |
Definition at line 555 of file ut_vw.cc.
References CBPredictParam::description, and CBPredictParam::model_filename.
std::vector<float> read_floats | ( | std::istream & | data | ) |
Definition at line 29 of file ut_vw.cc.
Referenced by read_floats(), and run_predict_in_memory().
std::vector<float> read_floats | ( | unsigned char * | data, |
unsigned int | len | ||
) |
std::vector<float> read_floats | ( | const char * | filename | ) |
REGISTER_TYPED_TEST_SUITE_P | ( | VwSlimTest | , |
model_not_loaded | , | ||
model_reduction_mismatch | , | ||
model_corrupted | |||
) |
Referenced by TYPED_TEST_P().
void run_predict_in_memory | ( | const char * | model_filename, |
const char * | data_filename, | ||
const char * | prediction_reference_filename | ||
) |
Definition at line 96 of file ut_vw.cc.
References f, get_test_data(), vw_slim::vw_predict< W >::is_cb_explore_adf(), vw_slim::vw_predict< W >::load(), test_data::model, test_data::model_len, test_data::pred, test_data::pred_len, vw_slim::vw_predict< W >::predict(), vw_slim::example_predict_builder::push_feature(), vw_slim::example_predict_builder::push_feature_string(), read_floats(), and S_VW_PREDICT_OK.
TEST | ( | VowpalWabbitSlim | , |
multiclass_data_4 | |||
) |
Definition at line 348 of file ut_vw.cc.
References f, get_test_data(), vw_slim::vw_predict< W >::load(), test_data::model, test_data::model_len, vw_slim::vw_predict< W >::predict(), vw_slim::example_predict_builder::push_feature(), S_VW_PREDICT_OK, and CCB::shared.
TEST | ( | VowpalWabbitSlim | , |
interaction_num_bits_bug | |||
) |
Definition at line 421 of file ut_vw.cc.
References f, vw_slim::vw_predict< W >::feature_index_num_bits(), vw_slim::vw_predict< W >::load(), vw_slim::vw_predict< W >::predict(), vw_slim::example_predict_builder::push_feature(), and vw_slim::example_predict_builder::push_feature_string().
TEST | ( | VowpalWabbitSlim | , |
cb_data_epsilon_0_skype_jb | |||
) |
Definition at line 466 of file ut_vw.cc.
References cb_data_epsilon_0_skype_jb_test_runner().
TEST | ( | ColdStartModel | , |
action_set_not_reordered | |||
) |
Definition at line 712 of file ut_vw.cc.
References f, vw_slim::vw_predict< W >::feature_index_num_bits(), vw_slim::vw_predict< W >::load(), vw_slim::vw_predict< W >::predict(), vw_slim::example_predict_builder::push_feature(), and vw_slim::example_predict_builder::push_feature_string().
TEST_P | ( | PredictTest | , |
Run | |||
) |
TEST_P | ( | InvalidModelTest | , |
Run | |||
) |
Definition at line 309 of file ut_vw.cc.
References vw_slim::vw_predict< W >::load(), S_VW_PREDICT_OK, and Sparse.
TEST_P | ( | CBPredictTest | , |
CBRunPredict | |||
) |
Definition at line 564 of file ut_vw.cc.
References f, generate_cb_data_5(), generate_string_seed(), get_test_data(), vw_slim::vw_predict< W >::is_cb_explore_adf(), vw_slim::vw_predict< W >::load(), test_data::model, test_data::model_len, vw_slim::vw_predict< W >::predict(), S_VW_PREDICT_OK, and CCB::shared.
TYPED_TEST_P | ( | VwSlimTest | , |
model_not_loaded | |||
) |
Definition at line 654 of file ut_vw.cc.
References E_VW_PREDICT_ERR_NO_MODEL_LOADED, and vw_slim::vw_predict< W >::predict().
TYPED_TEST_P | ( | VwSlimTest | , |
model_reduction_mismatch | |||
) |
Definition at line 669 of file ut_vw.cc.
References E_VW_PREDICT_ERR_NO_A_CSOAA_MODEL, E_VW_PREDICT_ERR_NOT_A_CB_MODEL, get_test_data(), vw_slim::vw_predict< W >::load(), test_data::model, test_data::model_len, and vw_slim::vw_predict< W >::predict().
TYPED_TEST_P | ( | VwSlimTest | , |
model_corrupted | |||
) |
Definition at line 684 of file ut_vw.cc.
References get_test_data(), INSTANTIATE_TYPED_TEST_SUITE_P(), vw_slim::vw_predict< W >::load(), test_data::model, test_data::model_len, REGISTER_TYPED_TEST_SUITE_P(), and exploration::uniform_random_merand48().
TYPED_TEST_SUITE_P | ( | VwSlimTest | ) |
CBPredictParam cb_predict_params[] |
InvalidModelParam invalid_model_param[] |