This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug in Pipeline.transform() (#294)
* Remove unnecessary code from Pipeline.transform that was causing a bug * Update release-next.md * Remove y argument from transform() method * Update release-next.md * Fix test
1 parent
30c2cff
commit ba3fe4f
Showing
6 changed files
with
41 additions
and
20 deletions.
There are no files selected for viewing
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
26 changes: 26 additions & 0 deletions
26
src/python/nimbusml/tests/pipeline/test_pipeline_transform_method.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 @@ | ||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
# -------------------------------------------------------------------------------------------- | ||
import unittest | ||
|
||
import pandas | ||
from nimbusml import Pipeline, FileDataStream | ||
from nimbusml.datasets import get_dataset | ||
from nimbusml.feature_extraction.text import NGramFeaturizer | ||
|
||
path = get_dataset("wiki_detox_train").as_filepath() | ||
data = FileDataStream.read_csv(path, sep='\t') | ||
df = data.to_df().head() | ||
X = df['SentimentText'] | ||
|
||
class TestPipelineTransformMethod(unittest.TestCase): | ||
|
||
def test_transform_only_pipeline_transform_method(self): | ||
p = Pipeline([NGramFeaturizer(char_feature_extractor=None) << 'SentimentText']) | ||
p.fit(X) | ||
xf = p.transform(X) | ||
assert 'SentimentText.==rude==' in xf.columns | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |