Skip to content

Commit

Permalink
Fix tests (#965)
Browse files Browse the repository at this point in the history
* text matrix

* spliting the string creates the expected input to FeatureHasher #964

* FeatureHasher issue #963

* addressing catagories_ type mismatch when auto by explicitly setting dtype on test data to object #964

* reverted to just ubuntu for time saving
  • Loading branch information
brian-methodical authored Feb 10, 2023
1 parent ba2024d commit 3ffd402
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@ jobs:

- name: Run tests
shell: bash -l {0}
run: pytest -v
run: pytest -v
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ ENV/
.spyderproject
.spyproject

# VS Code
*.code-workspace

# Rope project settings
.ropeproject

Expand Down
4 changes: 3 additions & 1 deletion tests/feature_extraction/test_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
)
def test_basic(vect, container):
b = db.from_sequence(JUNK_FOOD_DOCS, npartitions=2)
if container == "series":
if type(vect) == dask_ml.feature_extraction.text.FeatureHasher:
b = b.str.split()
elif container == "series":
b = b.to_dataframe(columns=["text"])["text"]
elif container == "array":
b = b.to_dataframe(columns=["text"])["text"].values
Expand Down
2 changes: 1 addition & 1 deletion tests/preprocessing/test_encoders.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from dask_ml._compat import DASK_2_20_0, PANDAS_VERSION
from dask_ml.utils import assert_estimator_equal

X = np.array([["a"], ["a"], ["b"], ["c"]])
X = np.array([["a"], ["a"], ["b"], ["c"]], dtype=object)
dX = da.from_array(X, 2)
df = pd.DataFrame(X, columns=["A"]).apply(lambda x: x.astype("category"))
ddf = dd.from_pandas(df, npartitions=2)
Expand Down

0 comments on commit 3ffd402

Please sign in to comment.