{"cells":[{"metadata":{"_uuid":"61352dbaaad4aac45480ea7391841647a0521944"},"cell_type":"markdown","source":"**Introduction**\n\nThis is a very simple kernel to bring a person onboard for Pet Finder - Competition\n\nAdaBoostClassifier is used with Python for the predictions. It helps you to get started with this competition. Further Analysis and enhancements can be built over this kernel. Feel free to fork and use it as per your needs.\n\n\n**Steps:-**\n\n**Step 1.** Load the required Python Modules"},{"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","trusted":true},"cell_type":"code","source":"# Loading the required python modules\n\nimport pandas as pd\nfrom sklearn.model_selection import train_test_split\nfrom sklearn import metrics\nfrom sklearn.ensemble import AdaBoostClassifier","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"0a02b7840e9a637040d21cd500f8ce528deb40f4"},"cell_type":"markdown","source":"**Step 2. **Read and Load the Test and Train Data"},{"metadata":{"trusted":true,"_uuid":"f8e7861e7f86d058dbf2b237e9d464c0aea7fc61"},"cell_type":"code","source":"# Reading Training Data\ntrainDataCsvFilepath = '../input/train/train.csv'\ntrainDataFrame = pd.read_csv(trainDataCsvFilepath)\n\n# Reading Test Data\ntestDataCsvFilepath = '../input/test/test.csv'\ntestDataFrame = pd.read_csv(testDataCsvFilepath)","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"e5c148a25285c24dd3eff6a56d59d92f250a6f5c"},"cell_type":"markdown","source":"**Step 3.** List out the Most Significant Features of the Data. Then, Create the Training DataFrames and Test DataFrames using the features list."},{"metadata":{"trusted":true,"_uuid":"2dc01e684ab52b18790f72434a28a5a9a74886af"},"cell_type":"code","source":"# Features List which are being targeted\nfeaturesList = ['Age','Health','Vaccinated','Dewormed','Sterilized','PhotoAmt','Gender','Breed1','Breed2','Color1','Color2','Fee','MaturitySize']\nx = trainDataFrame[featuresList]\ny = trainDataFrame.AdoptionSpeed\n\n# DataFrame for testing the Prediction Model\ntest_x = testDataFrame[featuresList]","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"2fd74f41303cce900209e35426ab476b222fc23c"},"cell_type":"markdown","source":"**Step 4.** Use AdaBoostClassifier to generate predictions on Test Dataset and save predictions to submission.csv file"},{"metadata":{"trusted":true,"_uuid":"9b7078c91a889591dfd11de7f83a9c94ce7f7504"},"cell_type":"code","source":"#Prediction using AdaBoostClassifier\nclf = AdaBoostClassifier()\n\n# Load Training Dataset into the Classifier\nclf.fit(x, y)\npred = pd.DataFrame()\npred['PetID'] = testDataFrame['PetID']\n\n# Generate Prediction on Test Dataset using the Trained Model\npred['AdoptionSpeed'] = clf.predict(test_x)\n\n# Saving Predicitions to submission.csv file\npred.set_index('PetID').to_csv(\"submission.csv\", index=True)","execution_count":null,"outputs":[]},{"metadata":{"_uuid":"3a77c870da2d5a4f46ca6db66ba49400e33e00c7"},"cell_type":"markdown","source":""}],"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}