{"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":"code","source":"import numpy as np # linear algebra\nimport pandas as pd\nimport seaborn as sns\nimport matplotlib.pyplot as plt","metadata":{"_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"chunks = pd.read_csv(\"../input/bosch-production-line-performance/train_numeric.csv.zip\",chunksize=50000)","metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a"},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import xgboost as xgb","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"model = xgb.XGBClassifier(n_estimators=30)","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ctr=0\nfor chunk in chunks:\n    model.fit(chunk.drop(['Id','Response'],axis=1),chunk['Response'])\n    ctr+=1\n    print(ctr)","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(figsize=(12,18))\nxgb.plot_importance(model,ax =ax,max_num_features=40)","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"np.set_printoptions(suppress\n                    =True)","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"imp = model.feature_importances_","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"name =model.get_booster().feature_names","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pd.DataFrame({'feat':name,'impo':imp}).sort_values(by='impo',ascending=False)['feat'].head(35).values","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}