{"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":"import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n\nfrom sklearn.manifold import TSNE\nfrom sklearn.decomposition import PCA","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"49160efbff9735ba6cb1dcf9c817fd0e2ec5a3f9"},"cell_type":"code","source":"X_unlabeled = pd.read_csv('../input/dataset_X.csv', index_col='id')\nX_unlabeled.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"63531f9995604dfcadff063211d3deba8c73f39c"},"cell_type":"code","source":"X_unlabeled.describe()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"e8d792726a38ccedcebb3c495b68c07ea9c2ec1f"},"cell_type":"markdown","source":"Overview of variable pair dependencies."},{"metadata":{"trusted":true,"scrolled":false,"_uuid":"e4b53a73385cadfa2cfc6f524de8a72da857d1d0"},"cell_type":"code","source":"sns.pairplot(X_unlabeled.sample(10000), diag_kind='hist')\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"3a813adba2c1d3ebe111a6816ed25a3a3e740899"},"cell_type":"markdown","source":"**Conclusion**:\n- Don't see anything"},{"metadata":{"_uuid":"fb8624fb981f0f1b1c54fcec9e10f46d6e70586f"},"cell_type":"markdown","source":"Compress using TSNE to see if we find some pattern in the data... "},{"metadata":{"trusted":true,"_uuid":"7cde396cd21dae4b3235dff4045d8d38ce3cabf0"},"cell_type":"code","source":"def plot_2d(df): \n    data = (\n        pd.DataFrame(\n            {'x': df[:, 0], \n             'y': df[:, 1]})\n    )\n\n    sns.lmplot(\n        data=data, \n        x='x', \n        y='y', \n        fit_reg=True)\n\n    plt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"080bbfdc9c8c1c3a0aa13850f5fdd7e458d85474"},"cell_type":"code","source":"X_embedded = TSNE(n_components=2).fit_transform(X_unlabeled.sample(5000).values)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"9c593238d1530db8cf0319b8f53d04110a570591"},"cell_type":"code","source":"plot_2d(X_embedded)","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"013b2e33a871b4b9fc34983dce444c7808d8810d"},"cell_type":"markdown","source":"**Hypothesis**:\n- Data is (almost) completely useless.\n- Maybe we can ask for dots on circle?"},{"metadata":{"_uuid":"cd7cb92437e0b9b47c62899f36b8518695956982"},"cell_type":"markdown","source":"Let's look more closely at a specific pair."},{"metadata":{"trusted":true,"_uuid":"2c56c3e453be3f3f0145ec3f75c86eeb375dd2e4"},"cell_type":"code","source":"sns.jointplot(\n    data=X_unlabeled.sample(100000), \n    x='d4', \n    y='d5', \n    kind='kde')\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"0a8eed634969fb2478ac1c088f183e3ff415d646"},"cell_type":"markdown","source":"**Conclusion**:\n- This notebook proved (almost) completely useless.\n- Maybe we don't need all features.\n- From describe it seems like 4, 5, 8 and 10 are similar features, and also 1, 2, 3, 6, 7 and 9 are from a slightly different distribution. "},{"metadata":{"trusted":true,"_uuid":"6f3bae222131c2efa3bb4fcd757799c93d64ae89"},"cell_type":"code","source":"pca = PCA(n_components=2)\nX_pca = pca.fit_transform(X=X_unlabeled)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"e6b5097cc6d0fc79abab78b820c1aff50a3ec270"},"cell_type":"code","source":"plot_2d(X_pca[0:10000, :])","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}