(2順目)
レシピ8.3
3項
こういったデータはスキャンでとるのだろうか。
4項
print(X_train.shape)
print(y_train.shape)
(1347, 64)
(1347,)
(6項)
「1」の変わりに手製の「2」を入れてみた
two = np.array(
[[ 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 16, 0, 0, 0],
[ 0, 0, 0, 16, 16, 0, 0, 0],
[ 0, 0, 16, 0, 16, 0, 0, 0],
[ 0, 0, 0, 16, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 16, 0, 0, 0, 0, 0],
[ 0, 0, 16, 16, 16, 16, 0, 0]])
knc.predict(two.ravel())
array([2])
結構あたります。