could you provide the scikit-learn version in both case?
Sent from my phone - sorry to be brief and potential misspell.
Thank you for your quick reply. It's very helpful.
It's because of Anaconda: Its python stops the iteration soon as follows (w/ verbose=True).
I am not sure why 'n_iter_no_change=10' is changed in Anaconda.
Anaconda might modify the MLPClassifier implementation.
> python learn.py (in pure Python+Scikit-Learn)
...
Iteration 125, loss = 0.26152263
Iteration 126, loss = 0.25705940
Iteration 127, loss = 0.25957841
Training loss did not improve more than tol=0.000100 for 10 consecutive epochs. Stopping.
0.8496
...
Iteration 23, loss = 0.34410594
Iteration 24, loss = 0.34663903
Iteration 25, loss = 0.34376815
Training loss did not improve more than tol=0.000100 for two consecutive epochs. Stopping.
0.852
Thanks,
--- 松田晃一 MATSUDA, Kouichi, Ph.D.
I suspect that it is probably due to the linear-algebra libraries: your scientific Python install on macOS is probably using optimized linear-algebra (ie optimized numpy and scipy), but not your install on Windows.
I would recommend you to look at how you installed you Python distribution on macOS and on Windows, as you likely have installed an optimized one on one of the platforms and not on the other.
Cheers,
Gaël
On Sat, Dec 15, 2018 at 09:02:06AM -0500, Kouichi Matsuda wrote: > Hi Hi everyone,
> I am writing a scikit-learn program to use MLPClassifier to learn > Fashion-MNIST. > The following is the program. It's very simple. > When I ran it on Windows 10 (Core-i7-8565U, 1.8GHz, 16GB) note book, it took > about 4 minutes. > However, when I ran it on MacBook(macOS), it took about 1 minutes. > Does anyone help me to understand the reason why Windows 10 is so slow? > Am I missing something?
> Thanks,
> import os import gzip import numpy as np #from https://github.com/ > zalandoresearch/fashion-mnist/blob/master/utils/mnist_reader.py def load_mnist > (path, kind='train'): labels_path = os.path.join(path,'%s-labels-idx1-ubyte.gz' > % kind) images_path = os.path.join(path,'%s-images-idx3-ubyte.gz' % kind) with > gzip.open(labels_path, 'rb') as lbpath: labels = np.frombuffer(lbpath.read(), > dtype=np.uint8, offset=8) with gzip.open(images_path, 'rb') as imgpath: images > = np.frombuffer(imgpath.read(), dtype=np.uint8, offset=16) images = > images.reshape(len(labels), 784) return images, labels x_train, y_train = > load_mnist('data', kind='train') x_test, y_test = load_mnist('data', kind= > 't10k') from sklearn.neural_network import MLPClassifier import time import > datetime print(datetime.datetime.today()) start = time.time() mlp = > MLPClassifier() mlp.fit(x_train, y_train) print((time.time() - start)/ 60)
> --- > MATSUDA, Kouichi, Ph.D.
> _______________________________________________ > scikit-learn mailing list > scikit-learn@python.org > https://mail.python.org/mailman/listinfo/scikit-learn
-- Gael Varoquaux Senior Researcher, INRIA Parietal NeuroSpin/CEA Saclay , Bat 145, 91191 Gif-sur-Yvette France Phone: ++ 33-1-69-08-79-68 http://gael-varoquaux.info http://twitter.com/GaelVaroquaux _______________________________________________ scikit-learn mailing list scikit-learn@python.org https://mail.python.org/mailman/listinfo/scikit-learn
|