{"cells":[{"metadata":{},"cell_type":"markdown","source":"# Ensembling the results\n\n### How the ensembling works for this competition?\n\nI was curious and just made a simple ensembling example.\nThe x-y coordinates and floor are weighted separately. There are some models that focus only on floors, or only on x-y. So it should be reasonable to do this.\n\nThis is just a WIP project, and I know it's so early to discuss ensembling with 3 months to go:)\n\n**Please upvote if it helps, it motivates me.**\n\n### About ensembled data\n\nI thank following people for sharing their knowledges.\nThey are quite helpful.\nIf you are interested, please upvote these notebooks as well.\n\n[Indoor GBM+postprocessing XY prediction](https://www.kaggle.com/oxzplvifi/indoor-gbm-postprocessing-xy-prediction)\n\n[wifi features with lightgbm/KFold](https://www.kaggle.com/hiro5299834/wifi-features-with-lightgbm-kfold)\n\n[Simple 👌 99% Accurate Floor Model 💯](https://www.kaggle.com/nigelhenry/simple-99-accurate-floor-model)\n\n[LSTM by Keras with Unified Wi-Fi Feats](https://www.kaggle.com/kokitanisaka/lstm-by-keras-with-unified-wi-fi-feats)\n\n[Indoor Navigation - \"Snap to Grid\" Post Processing](https://www.kaggle.com/robikscube/indoor-navigation-snap-to-grid-post-processing)"},{"metadata":{"trusted":true},"cell_type":"code","source":"import pandas as pd\nimport numpy as np","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"data_path_list = [\n    \"../input/indoor-gbm-postprocessing-xy-prediction/submission.csv\",\n    \"../input/wifi-features-with-lightgbm-kfold/submission.csv\",\n    \"../input/simple-99-accurate-floor-model/submission.csv\",\n    \"../input/lstm-by-keras-with-unified-wi-fi-feats/submission.csv\",\n    \"../input/indoor-navigation-snap-to-grid-post-processing/submission_snap_to_grid.csv\"\n]\n\nposition_weights = np.array([\n    0.15,\n    0.05,\n    0,\n    0.6,\n    0.2\n])\n\nfloor_weights = np.array([\n    0,\n    0,\n    1,\n    0,\n    0\n])\n\nposition_weights = position_weights / np.sum(position_weights) # normalize\nfloor_weights = floor_weights / np.sum(floor_weights) # normalize","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df_list = [pd.read_csv(d) for d in data_path_list]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"sub = pd.read_csv(\"../input/indoor-location-navigation/sample_submission.csv\")\n\nsub.floor = df_list[np.argmax(floor_weights)].floor\nsub.x = 0\nsub.y = 0\n\nfor df, w in zip(df_list, position_weights):\n    sub[[\"x\", \"y\"]] += df[[\"x\", \"y\"]] * w\n    \nsub.to_csv(\"submission.csv\", index=False)","execution_count":null,"outputs":[]}],"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":4,"nbformat_minor":4}