Skip to content

Commit

Permalink
Add test case in test_pipeline.
Browse files Browse the repository at this point in the history
  • Loading branch information
Anael Beaugnon committed May 7, 2019
1 parent 18f245e commit 9b6d9e7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion sklearn/tests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from sklearn.base import clone, BaseEstimator
from sklearn.pipeline import Pipeline, FeatureUnion, make_pipeline, make_union
from sklearn.svm import SVC
from sklearn.svm import OneClassSVM, SVC
from sklearn.linear_model import LogisticRegression, Lasso
from sklearn.linear_model import LinearRegression
from sklearn.cluster import KMeans
Expand Down Expand Up @@ -332,6 +332,17 @@ def test_pipeline_methods_pca_svm():
pipe.score(X, y)


def test_pipeline_score_samples_pca_oneclass_svm():
iris = load_iris()
X= iris.data
# Test with PCA + OneClassSVM
clf = OneClassSVM()
pca = PCA(svd_solver='full', n_components='mle', whiten=True)
pipe = Pipeline([('pca', pca), ('oneclass_svm', clf)])
pipe.fit(X)
pipe.score_samples(X)


def test_pipeline_methods_preprocessing_svm():
# Test the various methods of the pipeline (preprocessing + svm).
iris = load_iris()
Expand Down

0 comments on commit 9b6d9e7

Please sign in to comment.