File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 11import pytest
22import numpy as np
33from pathlib import Path
4- from playtime import feats , onehot , bag_of_words
4+ from playtime import feats , onehot , bag_of_words , minhash
55import pandas as pd
66import polars as pl
77from sklearn .pipeline import make_pipeline
@@ -25,6 +25,14 @@ def test_onehot(df):
2525 assert onehot ("sex" , "pclass" ).fit_transform (df ).shape [1 ] == 5
2626
2727
28+ @pytest .mark .parametrize ("df" , [pd .read_csv (titanic_path ), pl .read_csv (titanic_path )])
29+ def test_minhash (df ):
30+ print (df )
31+ assert minhash ("sex" , n_components = 10 ).fit_transform (df ).shape [1 ] == 10
32+ assert minhash ("name" , n_components = 10 ).fit_transform (df ).shape [1 ] == 10
33+ assert minhash ("sex" , "name" , n_components = 10 ).fit_transform (df ).shape [1 ] == 20
34+
35+
2836@pytest .mark .parametrize ("df" , [pd .read_csv (titanic_path ), pl .read_csv (titanic_path )])
2937def test_bow (df ):
3038 assert bag_of_words ("name" ).fit_transform (df ).shape [1 ] > 10
@@ -58,3 +66,5 @@ def test_pipeline(df, feat_pipe):
5866 # Confirm that we can gridsearch too
5967 grid = GridSearchCV (full_pipe , {}, cv = 2 )
6068 assert grid .fit (df , y ).predict (df ).shape
69+
70+
You can’t perform that action at this time.
0 commit comments