Skip to content

Commit

Permalink
Add comment to to tovw to clarify usage (#1999)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackgerrits committed Aug 8, 2019
1 parent 657e3fe commit d5ba078
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions python/vowpalwabbit/sklearn_vw.py
Expand Up @@ -569,6 +569,17 @@ def tovw(x, y=None, sample_weight=None):
-------
out : {array-like}, shape (n_samples, 1)
Training vectors in VW string format
Examples
--------
>>> import pandas as pd
>>> from sklearn.feature_extraction.text import HashingVectorizer
>>> from vowpalwabbit.sklearn_vw import tovw
>>> X = pd.Series(['cat', 'dog', 'cat', 'cat'], name='catdog')
>>> y = pd.Series([-1, 1, -1, -1], name='label')
>>> hv = HashingVectorizer()
>>> hashed = hv.fit_transform(X)
>>> tovw(x=hashed, y=y)
"""

use_truth = y is not None
Expand Down

0 comments on commit d5ba078

Please sign in to comment.