{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load in \n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the \"../input/\" directory.\n# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n\nimport os\nprint(os.listdir(\"../input\"))\n\n# Any results you write to the current directory are saved as output.","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","trusted":true},"cell_type":"code","source":"\nimport matplotlib.pyplot as plt\n\nfrom sklearn.model_selection import train_test_split\n\nimport os\nprint(os.listdir(\"../input\"))\n\n\nimport matplotlib.pyplot as plt\n\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"28400b07005f41c4110ee054710a688eb2c6d81a"},"cell_type":"code","source":"data=pd.read_csv('../input/train.csv')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"f2b1cf3957a68b4980c26b4bed5a1a3d2f36bab7"},"cell_type":"code","source":"data.head()\ndata.shape","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"db8446d15b56af5a635ee42e5ddae91bf1e610a6"},"cell_type":"code","source":"image1=data['Image'].loc[0]\nprint(image1)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"76d546e86b231e93d5188c3876a2c503accf2943"},"cell_type":"code","source":"import imageio\n\npath_join = os.path.join('../input/train', image1)\nimage = imageio.imread(path_join)\nimgplot = plt.imshow(image)\nplt.title(\"first image\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"d1d1f67a27758891acf95198f8236aa4fe412830"},"cell_type":"code","source":"Image_column=np.array(data.Image)\nprint(Image_column)\nImage_column.size\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"5514d0cdb2fbf94eb799137498a52a68772cec08"},"cell_type":"code","source":"          \n\n\n\n    ","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"cde2ec8515615dd5501629ef7b11f3eb533e0aaf"},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"562c7c89f3a0ede8c76f3ca0c03357174908257b"},"cell_type":"code","source":"\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"578af1e31c06a7aa9ad1c60b9fc00832aec0a32a"},"cell_type":"code","source":"\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"748895e8dc1d184c46f70f2929b8ff2ca13e25d1"},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"bbbc430640cece4eb345ce5c78daac1c40e7eea7"},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"41158ac6dc0a3b6d6c8edbf310e3badbbe51edfa"},"cell_type":"code","source":"X=data.iloc[:,:-1].values #all the image\ny = data.iloc[:, 1].values #whale classification\nprint(X.shape)\nprint(y.shape)\n","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"d0fa5f3624ae48918567aeba4681fd9d1b40e578"},"cell_type":"code","source":"X_train,y_train,X_test,y_test=train_test_split(X, y, test_size=0.30, random_state=42)\nprint(X_train.shape)\nprint(y_train.shape)\nX_train[77]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"80ef6d5becea9aab133c5c11121ac20894174b68"},"cell_type":"code","source":"import matplotlib.pyplot as plt\n%matplotlib inline \nimage_index = 77 # You may select anything up to 60,000\nprint(y_train[image_index]) # The label is 8\nimg=X_train[image_index]\npixels = X_train.reshape((28, 28))\nplt.imshow(pixels, cmap='gray')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"df678df558c2e1ef016f6dd426156c8d94b02274"},"cell_type":"code","source":"plt.figure()\n\nfrom sklearn.decomposition import PCA\npca = PCA(n_components=2)\nproj = pca.fit_transform(data)\nplt.scatter(proj[:, 0], proj[:, 1], c=digits.target, cmap=\"Paired\")\nplt.colorbar()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"1c4ebb7b88f235e868172c88573166f7902d2ede"},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"94e4dc64f828d26dc2c3df2dc478f65c05e4e048"},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.6.6","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":1}