diff --git a/img/clustering/example_knn_classifier.png b/img/clustering/example_knn_classifier.png index d59ba2f..20cf637 100644 Binary files a/img/clustering/example_knn_classifier.png and b/img/clustering/example_knn_classifier.png differ diff --git a/img/decision_tree/example_classification_decision_tree.png b/img/decision_tree/example_classification_decision_tree.png index fbc346d..d484734 100644 Binary files a/img/decision_tree/example_classification_decision_tree.png and b/img/decision_tree/example_classification_decision_tree.png differ diff --git a/img/decision_tree/example_regression_decision_tree.png b/img/decision_tree/example_regression_decision_tree.png index e9529b7..d9b0a9b 100644 Binary files a/img/decision_tree/example_regression_decision_tree.png and b/img/decision_tree/example_regression_decision_tree.png differ diff --git a/img/neural_net/example_mlp_classifier.png b/img/neural_net/example_mlp_classifier.png index 9e94ddc..9893d53 100644 Binary files a/img/neural_net/example_mlp_classifier.png and b/img/neural_net/example_mlp_classifier.png differ diff --git a/img/neural_net/example_transfer_learning.png b/img/neural_net/example_transfer_learning.png index f6db1bf..44e9bad 100644 Binary files a/img/neural_net/example_transfer_learning.png and b/img/neural_net/example_transfer_learning.png differ diff --git a/img/recommendation/example_als_recommender.png b/img/recommendation/example_als_recommender.png index 51056c8..a352e21 100644 Binary files a/img/recommendation/example_als_recommender.png and b/img/recommendation/example_als_recommender.png differ diff --git a/img/regression/example_linear_regression.png b/img/regression/example_linear_regression.png index f689585..97f7723 100644 Binary files a/img/regression/example_linear_regression.png and b/img/regression/example_linear_regression.png differ diff --git a/img/regression/example_logistic_regression.png b/img/regression/example_logistic_regression.png index 812d196..4c7698f 100644 Binary files a/img/regression/example_logistic_regression.png and b/img/regression/example_logistic_regression.png differ diff --git a/packtml/base.py b/packtml/base.py index 1c0b8c2..00e39b0 100644 --- a/packtml/base.py +++ b/packtml/base.py @@ -3,8 +3,7 @@ from __future__ import absolute_import from abc import ABCMeta, abstractmethod - -from sklearn.externals import six +import six __all__ = [ 'BaseSimpleEstimator' diff --git a/packtml/clustering/knn.py b/packtml/clustering/knn.py index 34e0719..6733f22 100644 --- a/packtml/clustering/knn.py +++ b/packtml/clustering/knn.py @@ -103,4 +103,4 @@ class KNNClassifier(BaseSimpleEstimator): # We want the most common along the rows as the predictions # I.e: # array([1, ..., 0]) - return mode(predicted_labels, axis=-1)[0].ravel() + return mode(predicted_labels, axis=1)[0].ravel() diff --git a/packtml/neural_net/base.py b/packtml/neural_net/base.py index 441cc08..441565f 100644 --- a/packtml/neural_net/base.py +++ b/packtml/neural_net/base.py @@ -2,7 +2,7 @@ from __future__ import absolute_import -from sklearn.externals import six +import six from abc import ABCMeta, abstractmethod import numpy as np diff --git a/packtml/recommendation/base.py b/packtml/recommendation/base.py index ce7f468..0b7fbab 100644 --- a/packtml/recommendation/base.py +++ b/packtml/recommendation/base.py @@ -2,7 +2,7 @@ from __future__ import absolute_import -from sklearn.externals import six +import six from abc import ABCMeta, abstractmethod __all__ = [ diff --git a/packtml/regression/simple_regression.py b/packtml/regression/simple_regression.py index fa6bf31..e518834 100644 --- a/packtml/regression/simple_regression.py +++ b/packtml/regression/simple_regression.py @@ -70,7 +70,7 @@ class SimpleLinearRegression(BaseSimpleEstimator): # Let's compute the least squares on X wrt y # Least squares solves the equation `a x = b` by computing a # vector `x` that minimizes the Euclidean 2-norm `|| b - a x ||^2`. - theta, _, rank, singular_values = lstsq(X, y) + theta, _, rank, singular_values = lstsq(X, y, rcond=None) # finally, we compute the intercept values as the mean of the target # variable MINUS the inner product of the X_means and the coefficients diff --git a/packtml/utils/tests/test_linalg.py b/packtml/utils/tests/test_linalg.py index 043ee6e..5f4bb59 100644 --- a/packtml/utils/tests/test_linalg.py +++ b/packtml/utils/tests/test_linalg.py @@ -5,7 +5,6 @@ from __future__ import absolute_import from sklearn.datasets import load_iris from packtml.utils import linalg -from numpy.testing import assert_array_almost_equal import numpy as np iris = load_iris() @@ -17,7 +16,7 @@ def test_row_norms(): X_centered = X - means norms = linalg.l2_norm(X_centered, axis=0) - assert_array_almost_equal( + assert np.allclose( norms, - np.array([ 10.10783524, 5.29269308, - 21.53749599, 9.31556404])) + np.array([10.10783524, 5.29269308, 21.53749599, 9.31556404]), + rtol=0.01) diff --git a/packtml/utils/validation.py b/packtml/utils/validation.py index dbb9514..4118753 100644 --- a/packtml/utils/validation.py +++ b/packtml/utils/validation.py @@ -3,7 +3,6 @@ from __future__ import absolute_import from sklearn.externals import six -from sklearn.utils.validation import check_random_state from sklearn.model_selection import ShuffleSplit import numpy as np diff --git a/requirements.txt b/requirements.txt index b1d9953..44390d7 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -numpy>=0.11 +numpy>=0.15 scipy>=0.19 -scikit-learn>=0.18 -pandas +scikit-learn>=0.19 +pandas>=0.23 matplotlib \ No newline at end of file