"Hello world" of ML
#!/usr/bin/python import os import pandas as pd from sklearn.datasets import fetch_openml import matplotlib import matplotlib.pyplot as plt HOUSING_URL = "https://github.com/ageron/handson-ml/blob/master/datasets/housing/housing.tgz" HOUSING_PATH = "c:\\datasets\\housing\\" def load_housing_data(housing_path=HOUSING_PATH): csv_path = os.path.join(housing_path, "housing.csv") return pd.read_csv(csv_path) if __name__ == "__main__": mnist = fetch_openml('mnist_784') X, y = mnist["data"], mnist["target"] 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() print(y[36000])