{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"### MNIST with no neural network\nThe [MNIST database of handwritten digits](http://yann.lecun.com/exdb/mnist/) consists of images that are 28 pixels in height and 28 pixels in width, for a total of 784 pixels in total, each image representing a digit from zero through nine.\nThis is a multiclass classification task and, although ostensibly a computer vision exercise and often solved using neural networks, it can also be treated as simply a dataset consisting of 784 features.\n\nHere we shall train the scikit-learn [HistGradientBoostingClassifier](https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.HistGradientBoostingClassifier.html). Note that [all classifiers in scikit-learn do multiclass classification out-of-the-box](https://scikit-learn.org/stable/modules/multiclass.html#multiclass-classification).","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19"}},{"cell_type":"code","source":"import numpy  as np\nimport pandas as pd\nfrom sklearn.ensemble import HistGradientBoostingClassifier\n\ntrain_data = pd.read_csv('../input/digit-recognizer/train.csv')\ntest_data  = pd.read_csv('../input/digit-recognizer/test.csv')\nsample     = pd.read_csv('../input/digit-recognizer/sample_submission.csv')\n\nX_train = train_data.iloc[:,1:]\ny_train = train_data['label']\n\nclf = HistGradientBoostingClassifier().fit(X_train, y_train)\n\nsample[\"Label\"] = clf.predict(test_data)\nsample.to_csv('submission.csv',index=False)","metadata":{},"execution_count":null,"outputs":[]}]}