| @@ -0,0 +1,46 @@ | |||||
| dataset_moons: | |||||
| **dataset_moons**: | |||||
|  | |||||
| dataset_circles: | |||||
| **dataset_circles**: | |||||
|  | |||||
| **dataset_digits**: | |||||
|  | |||||
| 加载数据的方式是: | |||||
| ```python | |||||
| # moon dataset | |||||
| @@ -33,13 +41,32 @@ plt.show() | |||||
| dataset_circles的数据文件是`dataset_circles.csv` | |||||
| dataset_digits的加载方式: | |||||
| ```python | |||||
| import matplotlib.pyplot as plt | |||||
| from sklearn.datasets import load_digits | |||||
| # load data | |||||
| digits = load_digits() | |||||
| # copied from notebook 02_sklearn_data.ipynb | |||||
| fig = plt.figure(figsize=(6, 6)) # figure size in inches | |||||
| fig.subplots_adjust(left=0, right=1, bottom=0, top=1, hspace=0.05, wspace=0.05) | |||||
| # plot the digits: each image is 8x8 pixels | |||||
| for i in range(64): | |||||
| ax = fig.add_subplot(8, 8, i + 1, xticks=[], yticks=[]) | |||||
| ax.imshow(digits.images[i], cmap=plt.cm.binary) | |||||
| # label the image with the target value | |||||
| ax.text(0, 7, str(digits.target[i])) | |||||