{"cells":[{"metadata":{"_uuid":"edde389932d63b0e42a5fb6289a0ab75b57281d0"},"cell_type":"markdown","source":"Notebook source: https://www.kaggle.com/sudalairajkumar/simple-exploration-notebook-elo"},{"metadata":{"_uuid":"3b2cd3d87f335dc35d537ca0f31530563ab56725"},"cell_type":"markdown","source":"### Competition Objective\n\n![Elo](https://www.cloudera.com/content/dam/www/marketing/images/logos/customers/cartao-elo.png)\n\n[Elo](https://www.cartaoelo.com.br/), one of the largest payment brands in Brazil, has built partnerships with merchants in order to offer promotions or discounts to cardholders.  The objective of the competition is to identify and serve the most relevant opportunities to individuals, by uncovering signal in customer loyalty.\n\n### Objective of the Notebook\n\nObjevtive of the notebook is to explore the given data and get some interesting insights which will help in our model building process."},{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"_kg_hide-input":true},"cell_type":"code","source":"import os\nimport json\nimport numpy as np\nimport pandas as pd\nfrom pandas.io.json import json_normalize\nimport matplotlib.pyplot as plt\nimport seaborn as sns\ncolor = sns.color_palette()\n\n%matplotlib inline\n\nfrom plotly import tools\nimport plotly.offline as py\npy.init_notebook_mode(connected=True)\nimport plotly.graph_objs as go\n\nfrom sklearn import model_selection, preprocessing, metrics\nimport lightgbm as lgb\n\npd.options.mode.chained_assignment = None\npd.options.display.max_columns = 999","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"b80cd7ae160231cb08f85b75a8e1743ed5198d98"},"cell_type":"markdown","source":"### Dataset Exploration\n\nIn this part, let us look at the given files before we get into data exploration."},{"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","trusted":true},"cell_type":"code","source":"!ls ../input/","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"7332e3e20838e5097c0e56e2f5697198372dd4ec"},"cell_type":"markdown","source":"So we are given the above files. The description of the files are\n\n* train.csv - the training set\n* test.csv - the test set\n* sample_submission.csv - a sample submission file in the correct format - contains all card_ids you are expected to predict for.\n* historical_transactions.csv - up to 3 months' worth of historical transactions for each card_id\n* merchants.csv - additional information about all merchants / merchant_ids in the dataset.\n* new_merchant_transactions.csv - two months' worth of data for each card_id containing ALL purchases that card_id made at merchant_ids that were not visited in the historical data.\n\nFirst let us explore the train and test set."},{"metadata":{"trusted":true,"_uuid":"bfdab255f309f4ca9239eaa07f17398e643010a3"},"cell_type":"code","source":"train_df = pd.read_csv(\"../input/train.csv\", parse_dates=[\"first_active_month\"])\ntest_df = pd.read_csv(\"../input/test.csv\", parse_dates=[\"first_active_month\"])\nprint(\"Number of rows and columns in train set : \",train_df.shape)\nprint(\"Number of rows and columns in test set : \",test_df.shape)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"a00bb53642516cefacf7159a02e84f0ce26a5d58"},"cell_type":"code","source":"train_df.head()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"dcc76ca4c430f5c90b4089ebe0dbf55ada020d2b"},"cell_type":"markdown","source":"### Target Column Exploration:\n\nIn this section, let us explore the target column"},{"metadata":{"_kg_hide-input":true,"trusted":true,"_uuid":"584ac32fd52b6d74472779681a671cc66afa67c6"},"cell_type":"code","source":"target_col = \"target\"\n\nplt.figure(figsize=(8,6))\nplt.scatter(range(train_df.shape[0]), np.sort(train_df[target_col].values))\nplt.xlabel('index', fontsize=12)\nplt.ylabel('Loyalty Score', fontsize=12)\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-input":true,"trusted":true,"_uuid":"93b6dd9e83e3d762a7dd0ac80efedd94a98defb8"},"cell_type":"code","source":"plt.figure(figsize=(12,8))\nsns.distplot(train_df[target_col].values, bins=50, kde=False, color=\"red\")\nplt.title(\"Histogram of Loyalty score\")\nplt.xlabel('Loyalty score', fontsize=12)\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"3ac53af6e71346176abafc19666c18d5ee512840"},"cell_type":"markdown","source":"We can see that some of the loyalty values are far apart (less than -30) compared to others. Let us just get their count."},{"metadata":{"trusted":true,"_uuid":"9a6b77591f0cd86505e6bcaac84240af09143011"},"cell_type":"code","source":"(train_df[target_col]<-30).sum()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"0132162b004ec52f5f42c5080886fd932f8aea97"},"cell_type":"markdown","source":"We have about 2207 rows (almost 1% of the data), which has values different from the rest. Since the metric RMSE these rows might play an important role. So beware of them."},{"metadata":{"_uuid":"f0077823b76b67ff16106bdce2bc03c30db16543"},"cell_type":"markdown","source":"### First Active Month\n\nIn this section, let us see if there are any distribution change between train and test sets with respect to first active month of the card."},{"metadata":{"_kg_hide-input":true,"trusted":true,"_uuid":"e1bad37ff53af54a0e42f3ab2512e9b7e5615f00"},"cell_type":"code","source":"cnt_srs = train_df['first_active_month'].dt.date.value_counts()\ncnt_srs = cnt_srs.sort_index()\nplt.figure(figsize=(14,6))\nsns.barplot(cnt_srs.index, cnt_srs.values, alpha=0.8, color='green')\nplt.xticks(rotation='vertical')\nplt.xlabel('First active month', fontsize=12)\nplt.ylabel('Number of cards', fontsize=12)\nplt.title(\"First active month count in train set\")\nplt.show()\n\ncnt_srs = test_df['first_active_month'].dt.date.value_counts()\ncnt_srs = cnt_srs.sort_index()\nplt.figure(figsize=(14,6))\nsns.barplot(cnt_srs.index, cnt_srs.values, alpha=0.8, color='green')\nplt.xticks(rotation='vertical')\nplt.xlabel('First active month', fontsize=12)\nplt.ylabel('Number of cards', fontsize=12)\nplt.title(\"First active month count in test set\")\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"98e7987dcb9628e93107fe4ad9fe8f6e6e054bf4"},"cell_type":"markdown","source":"Looks like the distribution is kind of similar between train and test set. So we need not really have to do time based split I think.\n\n### Feature 1,2 & 3:"},{"metadata":{"_uuid":"a2da071d99e4006ba77b8669e5a1a21acc557906"},"cell_type":"markdown","source":"In this section, let us see if the other variables in the train dataset has good predictive power in finding the loyalty score."},{"metadata":{"_kg_hide-input":true,"trusted":true,"_uuid":"bfca0eaf96632146c7a0f725ce2075ff1405b6f0"},"cell_type":"code","source":"# feature 1\nplt.figure(figsize=(8,4))\nsns.violinplot(x=\"feature_1\", y=target_col, data=train_df)\nplt.xticks(rotation='vertical')\nplt.xlabel('Feature 1', fontsize=12)\nplt.ylabel('Loyalty score', fontsize=12)\nplt.title(\"Feature 1 distribution\")\nplt.show()\n\n# feature 2\nplt.figure(figsize=(8,4))\nsns.violinplot(x=\"feature_2\", y=target_col, data=train_df)\nplt.xticks(rotation='vertical')\nplt.xlabel('Feature 2', fontsize=12)\nplt.ylabel('Loyalty score', fontsize=12)\nplt.title(\"Feature 2 distribution\")\nplt.show()\n\n# feature 3\nplt.figure(figsize=(8,4))\nsns.violinplot(x=\"feature_3\", y=target_col, data=train_df)\nplt.xticks(rotation='vertical')\nplt.xlabel('Feature 3', fontsize=12)\nplt.ylabel('Loyalty score', fontsize=12)\nplt.title(\"Feature 3 distribution\")\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"80b2a72f84348e2008d2d948a23239917f676461"},"cell_type":"markdown","source":"To the naked eyes, the distribution of the different categories in all three features look kind of similar. May be the models are able to find something here. "},{"metadata":{"_uuid":"f829143f2ca82af92aa793c7cee8effcc5fb1d8e"},"cell_type":"markdown","source":"### Historical Transactions:\n\nNow let us look at the historical transactions data for the cards."},{"metadata":{"trusted":true,"_uuid":"ebb27ee19be1dc40b94731d4dcd0ce670aacc86d"},"cell_type":"code","source":"hist_df = pd.read_csv(\"../input/historical_transactions.csv\")\nhist_df.head()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"9603854979b42cd70d2d1f7fa714b63dc8c1e933"},"cell_type":"markdown","source":"The field descriptions are as follows:\n* card_id\t- Card identifier\n* month_lag\t- month lag to reference date\n* purchase_date\t- Purchase date\n* authorized_flag -\t'Y' if approved, 'N' if denied\n* category_3 - anonymized category\n* installments -\tnumber of installments of purchase\n* category_1 -\tanonymized category\n* merchant_category_id -\tMerchant category identifier (anonymized )\n* subsector_id -\tMerchant category group identifier (anonymized )\n* merchant_id -\tMerchant identifier (anonymized)\n* purchase_amount -\tNormalized purchase amount\n* city_id -\tCity identifier (anonymized )\n* state_id -\tState identifier (anonymized )\n* category_2 -\tanonymized category\n\nNow let us make some features based on the historical transactions and merge them with train and test set.\n\n#### Number of Historical Transactions for the card"},{"metadata":{"_kg_hide-input":true,"trusted":true,"_uuid":"756c8ef8d3756fb21365e0a66540b7eb92a0b5d3"},"cell_type":"code","source":"gdf = hist_df.groupby(\"card_id\")\ngdf = gdf[\"purchase_amount\"].size().reset_index()\ngdf.columns = [\"card_id\", \"num_hist_transactions\"]\ntrain_df = pd.merge(train_df, gdf, on=\"card_id\", how=\"left\")\ntest_df = pd.merge(test_df, gdf, on=\"card_id\", how=\"left\")","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-input":true,"trusted":true,"_uuid":"2778542c23b6484319e7818c120a30adc07a4ccb"},"cell_type":"code","source":"cnt_srs = train_df.groupby(\"num_hist_transactions\")[target_col].mean()\ncnt_srs = cnt_srs.sort_index()\ncnt_srs = cnt_srs[:-50]\n\ndef scatter_plot(cnt_srs, color):\n    trace = go.Scatter(\n        x=cnt_srs.index[::-1],\n        y=cnt_srs.values[::-1],\n        showlegend=False,\n        marker=dict(\n            color=color,\n        ),\n    )\n    return trace\n\ntrace = scatter_plot(cnt_srs, \"orange\")\nlayout = dict(\n    title='Loyalty score by Number of historical transactions',\n    )\ndata = [trace]\nfig = go.Figure(data=data, layout=layout)\npy.iplot(fig, filename=\"Histtranscnt\")","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"41fe55f2834824cf44578cec42c81e840e4ba64f"},"cell_type":"markdown","source":"Now let us bin the count of historical transactions and then do some box plots to see the plots better."},{"metadata":{"_kg_hide-input":true,"trusted":true,"scrolled":true,"_uuid":"068b1339422f063cb0daaf7649bd96c4eba00fb9"},"cell_type":"code","source":"bins = [0, 10, 20, 30, 40, 50, 75, 100, 150, 200, 500, 10000]\ntrain_df['binned_num_hist_transactions'] = pd.cut(train_df['num_hist_transactions'], bins)\ncnt_srs = train_df.groupby(\"binned_num_hist_transactions\")[target_col].mean()\n\nplt.figure(figsize=(12,8))\nsns.boxplot(x=\"binned_num_hist_transactions\", y=target_col, data=train_df, showfliers=False)\nplt.xticks(rotation='vertical')\nplt.xlabel('binned_num_hist_transactions', fontsize=12)\nplt.ylabel('Loyalty score', fontsize=12)\nplt.title(\"binned_num_hist_transactions distribution\")\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"172321f1785060cc9aab7e8d8aeab884f6aea9fd"},"cell_type":"markdown","source":"#### Value of Historical Transactions\n\nNow let us check the value of the historical transactions for the cards and check the loyalty score distribution based on that."},{"metadata":{"_kg_hide-input":true,"trusted":true,"_uuid":"216d9ff997e3cafaf1be538f5a7227eabc6fa9af"},"cell_type":"code","source":"gdf = hist_df.groupby(\"card_id\")\ngdf = gdf[\"purchase_amount\"].agg(['sum', 'mean', 'std', 'min', 'max']).reset_index()\ngdf.columns = [\"card_id\", \"sum_hist_trans\", \"mean_hist_trans\", \"std_hist_trans\", \"min_hist_trans\", \"max_hist_trans\"]\ntrain_df = pd.merge(train_df, gdf, on=\"card_id\", how=\"left\")\ntest_df = pd.merge(test_df, gdf, on=\"card_id\", how=\"left\")","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-input":true,"trusted":true,"_uuid":"7da6b4337b8f8f10bab70175b2031561d0fcc111"},"cell_type":"code","source":"bins = np.percentile(train_df[\"sum_hist_trans\"], range(0,101,10))\ntrain_df['binned_sum_hist_trans'] = pd.cut(train_df['sum_hist_trans'], bins)\n#cnt_srs = train_df.groupby(\"binned_sum_hist_trans\")[target_col].mean()\n\nplt.figure(figsize=(12,8))\nsns.boxplot(x=\"binned_sum_hist_trans\", y=target_col, data=train_df, showfliers=False)\nplt.xticks(rotation='vertical')\nplt.xlabel('binned_sum_hist_trans', fontsize=12)\nplt.ylabel('Loyalty score', fontsize=12)\nplt.title(\"Sum of historical transaction value (Binned) distribution\")\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"631c654233d8a277047dd4c9c70ef1e3373d2f56"},"cell_type":"markdown","source":"As we could see, the loyalty score seem to increase with the \"sum of historical transaction value\". This is expected. Now we can do the same plot with \"Mean value of historical transaction\"."},{"metadata":{"_kg_hide-input":true,"trusted":true,"_uuid":"816c04fd10019149fe1fd6f20e06f2a22a29ff87"},"cell_type":"code","source":"bins = np.percentile(train_df[\"mean_hist_trans\"], range(0,101,10))\ntrain_df['binned_mean_hist_trans'] = pd.cut(train_df['mean_hist_trans'], bins)\n#cnt_srs = train_df.groupby(\"binned_mean_hist_trans\")[target_col].mean()\n\nplt.figure(figsize=(12,8))\nsns.boxplot(x=\"binned_mean_hist_trans\", y=target_col, data=train_df, showfliers=False)\nplt.xticks(rotation='vertical')\nplt.xlabel('Binned Mean Historical Transactions', fontsize=12)\nplt.ylabel('Loyalty score', fontsize=12)\nplt.title(\"Mean of historical transaction value (Binned) distribution\")\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"80d9a378203a3cfc75a7a189c66ada9478a6d67e"},"cell_type":"markdown","source":"### New Merchant Transactions\n\nIn this section, let us look at the new merchant transactions data and do some analysis"},{"metadata":{"trusted":true,"_uuid":"191aed6554c8698d5a0a4b782fe1ed4e5a306a8a"},"cell_type":"code","source":"new_trans_df = pd.read_csv(\"../input/new_merchant_transactions.csv\")\nnew_trans_df.head()","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-input":true,"trusted":true,"_uuid":"e2c425d22c6100926bf1ca200271e80a4c86ec34"},"cell_type":"code","source":"gdf = new_trans_df.groupby(\"card_id\")\ngdf = gdf[\"purchase_amount\"].size().reset_index()\ngdf.columns = [\"card_id\", \"num_merch_transactions\"]\ntrain_df = pd.merge(train_df, gdf, on=\"card_id\", how=\"left\")\ntest_df = pd.merge(test_df, gdf, on=\"card_id\", how=\"left\")","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-input":true,"trusted":true,"_uuid":"ac6e86379a359f5156eb1eb36a85cd3cc0ca0a57"},"cell_type":"code","source":"bins = [0, 10, 20, 30, 40, 50, 75, 10000]\ntrain_df['binned_num_merch_transactions'] = pd.cut(train_df['num_merch_transactions'], bins)\ncnt_srs = train_df.groupby(\"binned_num_merch_transactions\")[target_col].mean()\n\nplt.figure(figsize=(12,8))\nsns.boxplot(x=\"binned_num_merch_transactions\", y=target_col, data=train_df, showfliers=False)\nplt.xticks(rotation='vertical')\nplt.xlabel('binned_num_merch_transactions', fontsize=12)\nplt.ylabel('Loyalty score', fontsize=12)\nplt.title(\"Number of new merchants transaction (Binned) distribution\")\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"0599ae300ccdb23a5285b35f267837f25421b718"},"cell_type":"markdown","source":"Loyalty score seem to decrease as the number of new merchant transactions increases except for the last bin. "},{"metadata":{"_kg_hide-input":true,"trusted":true,"_uuid":"b860890fa58461a623b3706e8f1509b33902c660"},"cell_type":"code","source":"gdf = new_trans_df.groupby(\"card_id\")\ngdf = gdf[\"purchase_amount\"].agg(['sum', 'mean', 'std', 'min', 'max']).reset_index()\ngdf.columns = [\"card_id\", \"sum_merch_trans\", \"mean_merch_trans\", \"std_merch_trans\", \"min_merch_trans\", \"max_merch_trans\"]\ntrain_df = pd.merge(train_df, gdf, on=\"card_id\", how=\"left\")\ntest_df = pd.merge(test_df, gdf, on=\"card_id\", how=\"left\")","execution_count":null,"outputs":[]},{"metadata":{"_kg_hide-input":true,"trusted":true,"_uuid":"9b3717a18720aa24f520c113161f2cb227367da9"},"cell_type":"code","source":"bins = np.nanpercentile(train_df[\"sum_merch_trans\"], range(0,101,10))\ntrain_df['binned_sum_merch_trans'] = pd.cut(train_df['sum_merch_trans'], bins)\n#cnt_srs = train_df.groupby(\"binned_sum_hist_trans\")[target_col].mean()\n\nplt.figure(figsize=(12,8))\nsns.boxplot(x=\"binned_sum_merch_trans\", y=target_col, data=train_df, showfliers=False)\nplt.xticks(rotation='vertical')\nplt.xlabel('binned sum of new merchant transactions', fontsize=12)\nplt.ylabel('Loyalty score', fontsize=12)\nplt.title(\"Sum of New merchants transaction value (Binned) distribution\")\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"03292ab9712d0f97da286fcbb2de672b5c0d70c0"},"cell_type":"markdown","source":"Loyalty scores seem to increase with the increase in the sum of new merchant transaction values but for the last bin."},{"metadata":{"_kg_hide-input":true,"trusted":true,"_uuid":"3ba9ac6783176fd0e369d659b8a7bd9b2259b2e5"},"cell_type":"code","source":"bins = np.nanpercentile(train_df[\"mean_merch_trans\"], range(0,101,10))\ntrain_df['binned_mean_merch_trans'] = pd.cut(train_df['mean_merch_trans'], bins)\n#cnt_srs = train_df.groupby(\"binned_sum_hist_trans\")[target_col].mean()\n\nplt.figure(figsize=(12,8))\nsns.boxplot(x=\"binned_mean_merch_trans\", y=target_col, data=train_df, showfliers=False)\nplt.xticks(rotation='vertical')\nplt.xlabel('binned mean of new merchant transactions', fontsize=12)\nplt.ylabel('Loyalty score', fontsize=12)\nplt.title(\"Mean of New merchants transaction value (Binned) distribution\")\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"555afcb2ab2a11a4f0c667c8e8f18a3bd0c0acf9"},"cell_type":"markdown","source":"### Baseline Model\n\nLet us build a baseline model using the features created so far."},{"metadata":{"trusted":true,"_uuid":"5471ee15f494ad6977a89eef7c12f130622099aa"},"cell_type":"code","source":"train_df[\"year\"] = train_df[\"first_active_month\"].dt.year\ntest_df[\"year\"] = test_df[\"first_active_month\"].dt.year\ntrain_df[\"month\"] = train_df[\"first_active_month\"].dt.month\ntest_df[\"month\"] = test_df[\"first_active_month\"].dt.month\n\ncols_to_use = [\"feature_1\", \"feature_2\", \"feature_3\", \"year\", \"month\", \n               \"num_hist_transactions\", \"sum_hist_trans\", \"mean_hist_trans\", \"std_hist_trans\", \n               \"min_hist_trans\", \"max_hist_trans\",\n               \"num_merch_transactions\", \"sum_merch_trans\", \"mean_merch_trans\", \"std_merch_trans\",\n               \"min_merch_trans\", \"max_merch_trans\",\n              ]\n\ndef run_lgb(train_X, train_y, val_X, val_y, test_X):\n    params = {\n        \"objective\" : \"regression\",\n        \"metric\" : \"rmse\",\n        \"num_leaves\" : 30,\n        \"min_child_weight\" : 50,\n        \"learning_rate\" : 0.05,\n        \"bagging_fraction\" : 0.7,\n        \"feature_fraction\" : 0.7,\n        \"bagging_frequency\" : 5,\n        \"bagging_seed\" : 2018,\n        \"verbosity\" : -1\n    }\n    \n    lgtrain = lgb.Dataset(train_X, label=train_y)\n    lgval = lgb.Dataset(val_X, label=val_y)\n    evals_result = {}\n    model = lgb.train(params, lgtrain, 1000, valid_sets=[lgval], early_stopping_rounds=100, verbose_eval=100, evals_result=evals_result)\n    \n    pred_test_y = model.predict(test_X, num_iteration=model.best_iteration)\n    return pred_test_y, model, evals_result\n\ntrain_X = train_df[cols_to_use]\ntest_X = test_df[cols_to_use]\ntrain_y = train_df[target_col].values\n\npred_test = 0\nkf = model_selection.KFold(n_splits=5, random_state=2018, shuffle=True)\nfor dev_index, val_index in kf.split(train_df):\n    dev_X, val_X = train_X.loc[dev_index,:], train_X.loc[val_index,:]\n    dev_y, val_y = train_y[dev_index], train_y[val_index]\n    \n    pred_test_tmp, model, evals_result = run_lgb(dev_X, dev_y, val_X, val_y, test_X)\n    pred_test += pred_test_tmp\npred_test /= 5.\n    ","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"a6479cb3ed15c5556045d2fc048c56d614bee3a5"},"cell_type":"code","source":"fig, ax = plt.subplots(figsize=(12,10))\nlgb.plot_importance(model, max_num_features=50, height=0.8, ax=ax)\nax.grid(False)\nplt.title(\"LightGBM - Feature Importance\", fontsize=15)\nplt.show()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"7371f1139137edebc6a475d2f3bffcbcdf6c1b00"},"cell_type":"code","source":"sub_df = pd.DataFrame({\"card_id\":test_df[\"card_id\"].values})\nsub_df[\"target\"] = pred_test\nsub_df.to_csv(\"baseline_lgb.csv\", index=False)","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"6cb7c9c5d217319a379a9e30568114f53fe8a7d8"},"cell_type":"markdown","source":"Let us add more features in the upcoming versions and check the results.\n\n**More to come. Stay Tuned.!**"}],"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}