{"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\nimport xgboost as xgb\nimport matplotlib.pyplot as plt\nimport seaborn as sns\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":"train = pd.read_csv(\"../input/train/train.csv\")\ntest = pd.read_csv(\"../input/test/test.csv\")\nbreeds = pd.read_csv(\"../input/breed_labels.csv\")\ncolors = pd.read_csv(\"../input/color_labels.csv\")\nstates = pd.read_csv(\"../input/state_labels.csv\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"ec3f3dab278fc59305c44e43293d2364577b6013"},"cell_type":"code","source":"train.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"1fed3c6ee7c83f2f31ad57e21ea7789b72ba1d90"},"cell_type":"code","source":"test.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"03f5aa00bf3560da9cd93629337971b225ca9010"},"cell_type":"code","source":"breeds.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"bfb9252e329f32a1aeaccbaab38cabda5245f7a0"},"cell_type":"code","source":"colors.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"97c190d374714960355d7f57f98ab6e23c271c6b"},"cell_type":"code","source":"states.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"93bf45c6cca5c2f725c1684d7412061576b59e6e"},"cell_type":"code","source":"train.isnull().sum()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"9900dfe5275a1d9ef66839bc50d0e4be2689bf0b"},"cell_type":"code","source":"train.dtypes","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"ed60698c2a1cdde74037dc4adef87038c77a1314"},"cell_type":"code","source":"target=train['AdoptionSpeed']\ntarget.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"f2fb4e4823fa67780119360e903fd83cd335fe61"},"cell_type":"code","source":"df_train=train.drop(['Name','RescuerID','Description','PetID','AdoptionSpeed'],axis=1)\ndf_test=test.drop(['Name','RescuerID','Description','PetID'],axis=1)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"e8261ef538244133c4bd543d9a5bc90a24ecc264"},"cell_type":"code","source":"xg=xgb.XGBClassifier()\nxg.fit(df_train,target)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"3dc8ac3cffe2f291734f7a2d58aa1d0efcb7d414"},"cell_type":"code","source":"pred=xg.predict(df_test)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"304a51a70d68832325fad2bb5afcde5afff4016f"},"cell_type":"code","source":"submit=pd.DataFrame()\nsubmit['PetID']=test['PetID']\nsubmit['AdoptionSpeed']=pred\nsubmit.to_csv('submission.csv',index=False)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"60cdbbb1ba6a91b5024a723dfeb0431b6fc60987"},"cell_type":"code","source":"xgb.plot_importance(xg)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"1e16b356f13c9201bc88c86361248a77d158b0fd"},"cell_type":"code","source":"sns.distplot(target)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"82789b9d6e69d2a73a7397a7a57549556f7b5e9c"},"cell_type":"code","source":"","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}