[scikit-learn] inconsistency across version

Nicolas Hug niourf at gmail.com
Fri Feb 15 20:31:50 EST 2019


There was a bug in 0.18 that was fixed here 
https://github.com/scikit-learn/scikit-learn/pull/9105

The results from 0.20 should be correct.

It looks like you're still using Python 2, please be aware that 
*scikit-learn will drop support for python 2 in the next release*!

Nicolas

On 2/15/19 7:52 PM, Huan Tran wrote:
> Dear community,
>
> I did a very small pca analysis on a 3D data to print out the 
> explained_variance. I found that with scikit-learn 0.18.1 AND 0.20.2, 
> the results are significantly different. In particular, for 0.18.1 I got
> +3.875925353581E+00 +3.270175297443E+00 +2.207814537475E+00
>
> and with 0.20.2, I got
> +4.651110424297E+00 +3.924210356932E+00 +2.649377444970E+00
>
> Could anyone has a hint on what is going on? FYI, my data and code are 
> enclosed. Many thanks.
>
> Huan
> My data is
>
>  -3.117642E+00,  1.453819E+00, -7.952874E-02
>   3.081224E+00,  1.453819E+00, -7.952874E-02
>   1.376932E-01, -2.491454E+00, -1.908521E-01
>   9.578602E-02,  3.632759E+00, -1.908521E-01
>  -1.238644E-01,  5.396424E-02, -3.147031E+00
>   6.335262E-01,  1.393937E+00,  2.500474E+00
>
> and my code is
>
> import pandas as pd
> import numpy as np
> from sklearn import decomposition
>
> df = pd.read_csv('data', delimiter=',', header=None)
> data = np.array(df)
>
> X = data[:,:]
> data_size   = X.shape[0]
> feature_dim = X.shape[1]
>
> print X
>
> pca = decomposition.PCA(n_components=feature_dim)
> X_transformed = pca.fit_transform(X)
> print "%+4.12E %+4.12E %+4.12E" %(pca.explained_variance_[0], 
> pca.explained_variance_[1], pca.explained_variance_[2])
>
>
>
> _______________________________________________
> scikit-learn mailing list
> scikit-learn at python.org
> https://mail.python.org/mailman/listinfo/scikit-learn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-learn/attachments/20190215/f8ab9cc7/attachment.html>


More information about the scikit-learn mailing list