[scikit-learn] MLPClassifier on WIndows 10 is 4 times slower than that on macOS?
Gael Varoquaux
gael.varoquaux at normalesup.org
Sat Dec 15 10:47:33 EST 2018
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 at 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
More information about the scikit-learn
mailing list