Skip to content

Commit

Permalink
Merge e276bca into d9df1c8
Browse files Browse the repository at this point in the history
  • Loading branch information
Oddant1 committed Jun 26, 2020
2 parents d9df1c8 + e276bca commit 831df61
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
12 changes: 6 additions & 6 deletions q2_sample_classifier/classify.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,12 +469,12 @@ def detect_outliers(table: biom.Table,
X_train = features

# fit isolation tree
estimator = Pipeline(
[('dv', DictVectorizer()),
('est', IsolationForest(n_jobs=n_jobs, n_estimators=n_estimators,
contamination=contamination,
random_state=random_state,
))])
estimator = Pipeline([('dv', DictVectorizer()),
('est', IsolationForest(n_jobs=n_jobs,
n_estimators=n_estimators,
contamination=contamination,
random_state=random_state,
))])
estimator.fit(X_train)

# predict outlier status
Expand Down
5 changes: 3 additions & 2 deletions q2_sample_classifier/tests/test_classifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ def setUp(self):
index=pd.Index(range(1, 21)), name='Accuracy')
self.exp2 = pd.Series([
0.5000000000000001, 0.52, 0.48, 0.5599999999999998, 0.5,
0.5799999999999998, 0.54, 0.4600000000000001, 0.6,
0.5799999999999998, 0.54, 0.4600000000000001, 0.6,
0.45999999999999996, 0.45999999999999996],
index=pd.Index([1] + [i for i in range(2, 21, 2)]),
name='Accuracy')
self.exp3 = pd.Series({1: 0.4600000000000001, 20: 0.45999999999999996}, name='Accuracy')
self.exp3 = pd.Series({1: 0.4600000000000001, 20: 0.45999999999999996},
name='Accuracy')

def extract_rfe_scores_template(self, steps, expected):
selector = RFECV(RandomForestClassifier(
Expand Down
4 changes: 2 additions & 2 deletions q2_sample_classifier/tests/test_estimators.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,8 @@ def test_classify_samples_ncv_accuracy(self):
[0.595111111111111, 0.23155555555555551, 0.17333333333333334],
index=pd.Index(['o3', 'o1', 'o2']), columns=['importance'])
exp_probabilities = pd.DataFrame(
[[0.5, 0.5], [0., 1.], [0., 1.], [0.5, 0.5], [0.5, 0.5], [0.5, 0.5],
[0.5, 0.5], [0., 1.], [1., 0.], [1., 0.]],
[[0.5, 0.5], [0., 1.], [0., 1.], [0.5, 0.5], [0.5, 0.5],
[0.5, 0.5], [0.5, 0.5], [0., 1.], [1., 0.], [1., 0.]],
index=pd.Index(['s4', 's6', 's1', 's10', 's5', 's8', 's2', 's9',
's3', 's7'], name='SampleID'),
columns=['blue', 'red'])
Expand Down

0 comments on commit 831df61

Please sign in to comment.