Skip to content

Commit

Permalink
code quality improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
yzhao062 committed Jul 28, 2019
1 parent 651970e commit 8160af5
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
4 changes: 2 additions & 2 deletions combo/models/classifier_comb.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def __init__(self, base_clfs, method='average', threshold=0.5,
if method not in ['average', 'maximization', 'majority_vote',
'median']:
raise ValueError("{method} is not a valid parameter.".format(
shape=method))
method=method))

self.method = method
check_parameter(threshold, 0, 1, include_left=False,
Expand Down Expand Up @@ -346,7 +346,7 @@ def predict(self, X):

return (agg_score >= self.threshold).astype('int').ravel()

def predict_proba(self, X, method='average'):
def predict_proba(self, X):
"""Return probability estimates for the test data X.
Parameters
Expand Down
5 changes: 1 addition & 4 deletions combo/models/cluster_comb.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,13 @@ def __init__(self, estimators, pre_fitted=False):
self.pre_fitted = pre_fitted

@abstractmethod
def fit(self, X, y):
def fit(self, X):
"""Fit detector.
Parameters
----------
X : numpy array of shape (n_samples, n_features)
The input samples.
y : numpy array of shape (n_samples,), optional (default=None)
The ground truth of the input samples (labels).
"""
pass

Expand Down
4 changes: 1 addition & 3 deletions combo/models/sklearn_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
# Author: Yue Zhao <zhaoy@cmu.edu>
# License: BSD 2 clause

from __future__ import division
from __future__ import print_function

import numpy as np
import sklearn

from joblib.parallel import cpu_count


Expand Down
2 changes: 1 addition & 1 deletion combo/test/test_classifier_comb.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def test_parameters(self):
self.clf.base_clfs is not None)

# print clf details
self.clf
print(self.clf)

# set parameters
self.clf.set_params()
Expand Down

0 comments on commit 8160af5

Please sign in to comment.