Kaggle competition: Aerial Cactus Identification
train.groupby('BsmtFullBath')['SalePrice'].agg(['count','min','max','mean'] ).sort_values(by='count' )<correct_missing_values>
print(fastai.__version__ )
test['BsmtFullBath'].fillna(0,inplace=True )<correct_missing_values>
PATH = Path('.')
 !ls {PATH}
test['BsmtHalfBath'].fillna(0,inplace=True )<count_values>
df = pd.read_csv(PATH/'.. /input/train.csv'); df.head()
train['HalfBath'].value_counts(dropna=False )<count_values>
bs = 128
test['HalfBath'].value_counts(dropna=False )<groupby>
tfms = get_transforms(do_flip=True, flip_vert=True )
train.groupby('KitchenQual')['SalePrice'].agg(['count','min','max','mean'] ).sort_values(by='count' )<count_values>
data =(ImageList.from_csv(csv_name='train.csv', path=PATH/'.. /input', folder='train/train')
.split_by_rand_pct() 
.label_from_df(cols='has_cactus')
.transform(tfms)
.add_test_folder('test/test')
.databunch(bs=bs)
.normalize(imagenet_stats))
test['KitchenQual'].fillna(test['KitchenQual'].value_counts(dropna=False ).index[0],inplace=True )<count_values>
data.show_batch(rows=3, figsize=(7, 7))
train['TotRmsAbvGrd'].value_counts(dropna=False ).sort_index()<count_values>
data.classes, data.c
train['Functional'].value_counts(dropna=False ).sort_values()<count_values>
learn = cnn_learner(data, models.resnet34, metrics=accuracy, path=PATH )
test['Functional'].fillna(test['Functional'].value_counts(dropna=False ).index[0],inplace=True )<count_values>
learn.fit_one_cycle(4 )
train['Fireplaces'].value_counts(dropna=False ).sort_index()<groupby>
learn.fit_one_cycle(1 )
train.groupby('Fireplaces')['SalePrice'].agg(['count','min','max','mean'] ).sort_values(by='count' )<count_missing_values>
probs, preds = learn.get_preds(ds_type=DatasetType.Test )
train['GarageType'].isna().sum() ,test['GarageType'].isna().sum()<rename_columns>
ilst = data.test_ds.x
train['GarageType'].fillna("No_Garage",inplace=True)
 test['GarageType'].fillna("No_Garage",inplace=True )<groupby>
fnames = [item.name for item in ilst.items]; fnames[:10]
train.groupby('GarageType')['SalePrice'].agg(['count','min','max','mean'] ).sort_values(by='count' )<count_missing_values>
test_df = pd.DataFrame({'id': fnames, 'has_cactus': probs[:, 1]}); test_df
<data_type_conversions><EOS> 
test_df.to_csv('submission.csv', index=None )