Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include <shogun/classifier/vw/vw_example.h>
00016
00017 using namespace shogun;
00018
00019 VwExample::VwExample(): tag(), indices(), atomics(),
00020 num_features(0), pass(0),
00021 final_prediction(0.), loss(0),
00022 eta_round(0.), global_weight(0),
00023 example_t(0), total_sum_feat_sq(1), sorted(false)
00024 {
00025 ld = new VwLabel();
00026 }
00027
00028 VwExample::~VwExample()
00029 {
00030 if (ld)
00031 delete ld;
00032 if (tag.end_array != tag.begin)
00033 {
00034 SG_FREE(tag.begin);
00035 tag.end_array = tag.begin;
00036 }
00037
00038 for (vw_size_t j = 0; j < 256; j++)
00039 {
00040 if (atomics[j].begin != atomics[j].end_array)
00041 SG_FREE(atomics[j].begin);
00042 }
00043 SG_FREE(indices.begin);
00044 }
00045
00046 void VwExample::reset_members()
00047 {
00048 num_features = 0;
00049 total_sum_feat_sq = 1;
00050 example_counter = 0;
00051 global_weight = 0;
00052 example_t = 0;
00053 eta_round = 0;
00054 final_prediction = 0;
00055 loss = 0;
00056
00057 for (vw_size_t* i = indices.begin; i != indices.end; i++)
00058 {
00059 atomics[*i].erase();
00060 sum_feat_sq[*i]=0;
00061 }
00062
00063 indices.erase();
00064 tag.erase();
00065 }