Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added VW python example, removed doc warning and added a missing sum_…
…feat_sq init.
- Loading branch information
Showing
6 changed files
with
60 additions
and
10 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
examples/undocumented/python_modular/streaming_vw_modular.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from modshogun import StreamingVwFile | ||
from modshogun import T_SVMLIGHT | ||
from modshogun import StreamingVwFeatures | ||
from modshogun import VowpalWabbit | ||
|
||
def run_vw(): | ||
"""Runs the VW algorithm on a toy dataset in SVMLight format.""" | ||
|
||
# Open the input file as a StreamingVwFile | ||
input_file = StreamingVwFile("../data/fm_train_sparsereal.dat") | ||
|
||
# Tell VW that the file is in SVMLight format | ||
# Supported types are T_DENSE, T_SVMLIGHT and T_VW | ||
input_file.set_parser_type(T_SVMLIGHT) | ||
|
||
# Create a StreamingVwFeatures object, `True' indicating the examples are labelled | ||
features = StreamingVwFeatures(input_file, True, 1024) | ||
|
||
# Create a VW object from the features | ||
vw = VowpalWabbit(features) | ||
|
||
# Train | ||
vw.train() | ||
|
||
if __name__ == "__main__": | ||
run_vw() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters