Skip to content
Permalink
Browse files

Add comment to to tovw to clarify usage (#1999)

  • Loading branch information...
jackgerrits committed Aug 8, 2019
1 parent 657e3fe commit d5ba0788c129d138bd7547df40481bfba33db378
Showing with 11 additions and 0 deletions.
  1. +11 −0 python/vowpalwabbit/sklearn_vw.py
@@ -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

0 comments on commit d5ba078

Please sign in to comment.
You can’t perform that action at this time.