{"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":"# This notebook is derived from Quadruple Grandmaster Bojan Tunguz's notebook\nwhich can be found here.\nhttps://www.kaggle.com/tunguz/elo-deep-automl\nI have modified it to run it using AutoViML. \nThe scores are mainly due to the feature engineering he did. \nAutoViML merely was able to select the best features and build a nice model. Take a look.","metadata":{"execution":{"iopub.status.busy":"2021-07-02T18:40:21.847117Z","iopub.execute_input":"2021-07-02T18:40:21.848011Z","iopub.status.idle":"2021-07-02T18:40:21.857402Z","shell.execute_reply.started":"2021-07-02T18:40:21.847933Z","shell.execute_reply":"2021-07-02T18:40:21.854901Z"}}},{"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\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 read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-04-23T22:18:15.976118Z","iopub.execute_input":"2022-04-23T22:18:15.976550Z","iopub.status.idle":"2022-04-23T22:18:15.999246Z","shell.execute_reply.started":"2022-04-23T22:18:15.976464Z","shell.execute_reply":"2022-04-23T22:18:15.997761Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train = pd.read_csv(\"../input/mitsuru-features-only-train-and-test/train_df_noindex.csv\")\ntest = pd.read_csv(\"../input/mitsuru-features-only-train-and-test/test_df_noindex.csv\")\nprint(train.shape)\ntrain.head()","metadata":{"execution":{"iopub.status.busy":"2022-04-23T22:18:31.957282Z","iopub.execute_input":"2022-04-23T22:18:31.958151Z","iopub.status.idle":"2022-04-23T22:18:46.133567Z","shell.execute_reply.started":"2022-04-23T22:18:31.958100Z","shell.execute_reply":"2022-04-23T22:18:46.132596Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(test.shape)\ntest.head(1)","metadata":{"execution":{"iopub.status.busy":"2022-04-23T22:18:52.789317Z","iopub.execute_input":"2022-04-23T22:18:52.790011Z","iopub.status.idle":"2022-04-23T22:18:52.820036Z","shell.execute_reply.started":"2022-04-23T22:18:52.789958Z","shell.execute_reply":"2022-04-23T22:18:52.818975Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip install autoviml --upgrade","metadata":{"execution":{"iopub.status.busy":"2022-04-23T22:18:55.592478Z","iopub.execute_input":"2022-04-23T22:18:55.592857Z","iopub.status.idle":"2022-04-23T22:19:06.024027Z","shell.execute_reply.started":"2022-04-23T22:18:55.592826Z","shell.execute_reply":"2022-04-23T22:19:06.022901Z"},"_kg_hide-output":true,"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from autoviml.Auto_ViML import Auto_ViML","metadata":{"execution":{"iopub.status.busy":"2022-04-23T22:20:10.907318Z","iopub.execute_input":"2022-04-23T22:20:10.907714Z","iopub.status.idle":"2022-04-23T22:20:13.349478Z","shell.execute_reply.started":"2022-04-23T22:20:10.907677Z","shell.execute_reply":"2022-04-23T22:20:13.348596Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# We are going to try Auto_ViML first and see whether it does well","metadata":{}},{"cell_type":"code","source":"target = \"target\"","metadata":{"execution":{"iopub.status.busy":"2022-04-23T22:20:15.833455Z","iopub.execute_input":"2022-04-23T22:20:15.833828Z","iopub.status.idle":"2022-04-23T22:20:15.838049Z","shell.execute_reply.started":"2022-04-23T22:20:15.833799Z","shell.execute_reply":"2022-04-23T22:20:15.837073Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"m, feats, trainm, testm = Auto_ViML(train, target, test,\n                            sample_submission='',\n                            scoring_parameter='', KMeans_Featurizer=False,\n                            hyper_param='RS',feature_reduction=True,\n                             Boosting_Flag='CatBoost', Binning_Flag=False,\n                            Add_Poly=0, Stacking_Flag=False,\n                                    Imbalanced_Flag=False,\n                            verbose=1)","metadata":{"execution":{"iopub.status.busy":"2022-04-23T22:20:16.500504Z","iopub.execute_input":"2022-04-23T22:20:16.500930Z","iopub.status.idle":"2022-04-23T22:23:40.698149Z","shell.execute_reply.started":"2022-04-23T22:20:16.500895Z","shell.execute_reply":"2022-04-23T22:23:40.696851Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"testm.head(2)","metadata":{"execution":{"iopub.status.busy":"2022-04-23T22:37:45.050035Z","iopub.execute_input":"2022-04-23T22:37:45.050847Z","iopub.status.idle":"2022-04-23T22:37:45.096381Z","shell.execute_reply.started":"2022-04-23T22:37:45.050792Z","shell.execute_reply":"2022-04-23T22:37:45.095528Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"preds = testm[target+'_predictions']\npreds[:5]","metadata":{"execution":{"iopub.status.busy":"2022-04-23T22:37:45.999603Z","iopub.execute_input":"2022-04-23T22:37:45.999990Z","iopub.status.idle":"2022-04-23T22:37:46.008151Z","shell.execute_reply.started":"2022-04-23T22:37:45.999956Z","shell.execute_reply":"2022-04-23T22:37:46.007074Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission = pd.read_csv('/kaggle/input/elo-merchant-category-recommendation/sample_submission.csv')","metadata":{"execution":{"iopub.status.busy":"2022-04-23T22:37:46.905789Z","iopub.execute_input":"2022-04-23T22:37:46.906187Z","iopub.status.idle":"2022-04-23T22:37:47.063380Z","shell.execute_reply.started":"2022-04-23T22:37:46.906153Z","shell.execute_reply":"2022-04-23T22:37:47.062221Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"sample_submission['target'] = preds\nsample_submission.to_csv('submission.csv', index=False)","metadata":{"execution":{"iopub.status.busy":"2022-04-23T22:37:57.343743Z","iopub.execute_input":"2022-04-23T22:37:57.344111Z","iopub.status.idle":"2022-04-23T22:37:57.857648Z","shell.execute_reply.started":"2022-04-23T22:37:57.344080Z","shell.execute_reply":"2022-04-23T22:37:57.856800Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}