Skip to content

Commit

Permalink
optimize import logistics
Browse files Browse the repository at this point in the history
  • Loading branch information
yzhao062 committed Dec 30, 2019
1 parent 375b60d commit b69e197
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 44 deletions.
3 changes: 2 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ v<0.0.7>, <08/04/2019> -- Add DES_LA.
v<0.0.8>, <08/05/2019> -- Add fit_predict as core API.
v<0.0.8>, <08/06/2019> -- Add EAC model.
v<0.0.8>, <08/08/2019> -- Update clustering examples to show visualization.
v<0.0.9>, <09/01/2019> -- Add classifier_multiple_libs.py for multiple lib support.
v<0.0.9>, <09/01/2019> -- Add classifier_multiple_libs.py for multiple lib support.
v<0.1.0>, <12/30/2019> -- Import Optimization.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ Alternatively, you could clone and run setup.py file:
* numba>=0.35
* pyod
* scipy>=0.19.1
* scikit_learn>=0.19.1
* scikit_learn>=0.20


**Note on Python 2**\ :
Expand Down
4 changes: 2 additions & 2 deletions combo/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
from sklearn.utils.multiclass import check_classification_targets

from .sklearn_base import _pprint
from ..utils.utility import _sklearn_version_21
from pyod.utils.utility import _get_sklearn_version

if _sklearn_version_21():
if _get_sklearn_version() > 20:
from inspect import signature
else:
from sklearn.externals.funcsigs import signature
Expand Down
37 changes: 0 additions & 37 deletions combo/utils/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import numpy as np
from numpy import percentile

import sklearn
from sklearn.metrics import precision_score
from sklearn.preprocessing import StandardScaler

Expand Down Expand Up @@ -279,42 +278,6 @@ def invert_order(scores, method='multiplication'):
return (scores.max() - scores).ravel()


def _sklearn_version_20(): # pragma: no cover
""" Utility function to decide the version of sklearn
In sklearn 20.0, LOF is changed. Specifically, _decision_function
is replaced by _score_samples
Returns
-------
sklearn_20_flag : bool
True if sklearn.__version__ is newer than 0.20.0
"""
sklearn_version = str(sklearn.__version__)
if int(sklearn_version.split(".")[1]) > 19:
return True
else:
return False


def _sklearn_version_21(): # pragma: no cover
""" Utility function to decide the version of sklearn
In sklearn 21.0, LOF is changed. Specifically, _decision_function
is replaced by _score_samples
Returns
-------
sklearn_21_flag : bool
True if sklearn.__version__ is newer than 0.21.0
"""
sklearn_version = str(sklearn.__version__)
if int(sklearn_version.split(".")[1]) > 20:
return True
else:
return False


def generate_bagging_indices(random_state, bootstrap_features, n_features,
min_features, max_features):
""" Randomly draw feature indices. Internal use only.
Expand Down
2 changes: 1 addition & 1 deletion docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Alternatively, you could clone and run setup.py file:
* numba>=0.35
* pyod
* scipy>=0.19.1
* scikit_learn>=0.19.1
* scikit_learn>=0.20


**Note on Python 2**\ :
Expand Down
2 changes: 1 addition & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ numba>=0.35
pyod
pytest
scipy
scikit_learn>=0.19.1
scikit_learn>=0.20
sphinxcontrib-bibtex
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ numpy>=1.13
numba>=0.35
pyod
scipy
scikit_learn>=0.19.1
scikit_learn>=0.20

0 comments on commit b69e197

Please sign in to comment.