Kaggle competition: Aerial Cactus Identification
<SOS> metric: AUC Kaggle data source: aerial-cactus-identification<feature_engineering>
from fastai import *
from fastai.vision import *
import pandas as pd
final['Cabin_final'] = df['Cabin'].str[0]<rename_columns>
labels = pd.read_csv('.. /input/train.csv')
 def get_labels(name):
return labels[labels['id'] == name.name]['has_cactus'].values[0]
final['Cabin_final'].fillna('Unknown',inplace = True )<count_values>
data = ImageList.from_folder('.. /input/train/train/' ).split_by_rand_pct(0.01 ).label_from_func(get_labels ).transform(get_transforms() , size=224 ).add_test(ItemList.from_folder('.. /input/test/test/')).databunch(bs=64 ).normalize(imagenet_stats )
final['Cabin_final'].value_counts()<drop_column>
learner = cnn_learner(data=data, base_arch=models.densenet201, model_dir='.. /.. /.. /.. /models/', metrics=accuracy )
final.drop(['Cabin'],axis = 1,inplace = True )<categorify>
learner.fit_one_cycle(5, slice(5e-2))
final = pd.get_dummies(final, columns = ["Cabin_final"],prefix="Cabin_" )<count_values>
preds = learner.get_preds(DatasetType.Test )
final.Ticket.value_counts()<data_type_conversions>
predictions = preds[0].argmax(dim=1)
 names = [item.name for item in data.test_ds.x.items]
pd.DataFrame({'id': names, 'has_cactus': predictions} ).to_csv('submission.csv', index=False )