Kaggle competition: Aerial Cactus Identification
<SOS> metric: AUC Kaggle data source: aerial-cactus-identification<count_values>
import numpy as np
import pandas as pd
dataset['Cabin'].value_counts()<feature_engineering>
from pathlib import Path
from fastai import *
from fastai.vision import *
import torch
dataset['CabinType'] = dataset['Cabin'].apply(lambda x: str(x)[0].upper() if type(x)== str else 'None' )<filter>
data_folder = Path(".. /input")
dataset[dataset['CabinType'] == 'T']<feature_engineering>
train_df = pd.read_csv(".. /input/train.csv")
 test_df = pd.read_csv(".. /input/sample_submission.csv" )
t_idx = dataset[dataset['CabinType'] == 'T'].index
dataset.loc[t_idx, 'CabinType'] = 'None'<filter>
learn = cnn_learner(train_img, models.densenet161, metrics=[error_rate, accuracy] )
dataset.iloc[t_idx]<count_missing_values>
lr = 3e-02
learn.fit_one_cycle(5, slice(lr))
survival_rate_with_cabin = 100 * train[train['Cabin'].isnull() == False]['Survived'].value_counts() [1] / \
train[train['Cabin'].isnull() == False]['Survived'].shape[0]
survival_rate_without_cabin = 100 * train[train['Cabin'].isnull() == True]['Survived'].value_counts() [1] / \
train[train['Cabin'].isnull() == True]['Survived'].shape[0]
print(f'Survival rate with cabin: {survival_rate_with_cabin:.1f}%')
 print(f'Survival rate without cabin: {survival_rate_without_cabin:.1f}%' )<categorify>
preds,_ = learn.get_preds(ds_type=DatasetType.Test )
cabin_mapping = {"None": 0, "A": 1, "B": 2, "C": 3, "D": 4, "E": 5, "F": 6, "G": 7}
dataset['CabinType'] = dataset['CabinType'].map(cabin_mapping )<count_values>
test_df.has_cactus = preds.numpy() [:, 0]
<feature_engineering><EOS> 
test_df.to_csv('submission.csv', index=False )