我正在试验一本名为“动手学习与Scikit Learn and Tensorflow'我收到一个我不明白的错误:没有这样的文件或目录:' mnist \ train-labels-idx1-ubyte'
在我收到此错误之前,我运行了以下代码。
1> string:slice("123455678901234", 1, 4).
"1234"
在最后一行代码之后,我看到了这条消息。
from sklearn.datasets import fetch_mldata
mnist = fetch_mldata('MNIST original')
mnist
X, y = mnist["data"], mnist["target"]
X.shape
y.shape
import matplotlib
import matplotlib.pyplot as plt
some_digit = X[36000]
some_digit_image = some_digit.reshape(28, 28)
plt.imshow(some_digit_image, cmap = matplotlib.cm.binary,
interpolation="nearest")
plt.axis("off")
plt.show()
X_train, X_test, y_train, y_test = X[:60000], X[60000:], y[:60000], y[60000:]
from sklearn.linear_model import SGDClassifier
sgd_clf = SGDClassifier(random_state=42)
sgd_clf.fit(X_train, y_train_5)
sgd_clf.predict([some_digit])
y_train_5 = (y_train == 5)
y_test_5 = (y_test == 5)
from sklearn.linear_model import SGDClassifier
sgd_clf = SGDClassifier(random_state=42)
sgd_clf.fit(X_train, y_train_5)
sgd_clf.predict([some_digit])
点击Enter键后,我看到了:
==================================================
Broadening the output spectrum using a hyperbolic tangent
--------------------------------------------------
Please make sure that you've downloaded and unzipped the MNIST dataset as described in the previous chapter. The following code assumes that you have created a mnist directory within this script's directory. Please hit 'enter' to continue.
关于这里发生了什么的任何想法?感谢。