diff options
Diffstat (limited to 'library')
-rw-r--r-- | library/library_example.cc | 14 | ||||
-rw-r--r-- | library/train.w | bin | 347 -> 339 bytes |
2 files changed, 12 insertions, 2 deletions
diff --git a/library/library_example.cc b/library/library_example.cc index c8d6576a..0140083a 100644 --- a/library/library_example.cc +++ b/library/library_example.cc @@ -40,11 +40,21 @@ int main(int argc, char *argv[]) VW::finish(*model);
-
vw* model2 = VW::initialize("--hash all -q st --noconstant -i train2.vw");
- vec2 = VW::read_example(*model2, (char*)"|s p^the_man w^the w^man |t p^un_homme w^un w^homme");
+ vec2 = VW::read_example(*model2, (char*)" |s p^the_man w^the w^man |t p^un_homme w^un w^homme");
model2->learn(vec2);
cerr << "p4 = " << vec2->final_prediction << endl;
+
+ size_t len=0;
+ VW::primitive_feature_space* pfs = VW::export_example(*model2, vec2, len);
+ for (size_t i = 0; i < len; i++)
+ {
+ cout << "namespace = " << pfs[i].name;
+ for (size_t j = 0; j < pfs[i].len; j++)
+ cout << " " << pfs[i].fs[j].weight_index << ":" << pfs[i].fs[j].x << ":" << VW::get_weight(*model2, pfs[i].fs[j].weight_index);
+ cout << endl;
+ }
+
VW::finish_example(*model2, vec2);
VW::finish(*model2);
}
diff --git a/library/train.w b/library/train.w Binary files differindex 688d34e4..f6f1b100 100644 --- a/library/train.w +++ b/library/train.w |