Kaggle competition: What's Cooking?
learn.lr_find()<train_model>
train_df = pd.read_json(".. /input/train.json")
 categories = sorted(train_df['cuisine'].astype("category" ).unique())
 train_df['cuisine'] = train_df['cuisine'].astype("category" ).cat.codes
train_df['ingredients'] = train_df['ingredients'].apply(lambda x: " ".join(x))
learn.fit_one_cycle(2, slice(1e-8,1e-7/5))<save_model>
train_docs = train_df['ingredients']
train_tf = TfidfVectorizer(lowercase=False, preprocessor=None)
 train_tf.fit(train_docs)
 train_X= train_tf.transform(train_docs)
 train_Y = train_df['cuisine']
learn.save(save_dir/'stage2-32-resnet34' )<load_pretrained>
clf = svm.SVC(decision_function_shape='ovr')
 clf.fit(train_X, train_Y)
learn.load(save_dir/'stage2-32-resnet34' )<load_from_csv>
test_df = pd.read_json(".. /input/test.json")
 test_df['ingredients'] = test_df['ingredients'].apply(lambda x: " ".join(x))
test_docs = test_df['ingredients']
test_vecs = train_tf.transform(test_docs)
 Y = clf.decision_function(test_vecs )
test_df = pd.read_csv(".. /input/sample_submission.csv")
<create_dataframe>
test_df['pred'] = np.argmax(Y, axis=1)
 test_df.head()
test_img = ImageList.from_df(test_df, path=test_path, folder='' )<feature_engineering>
test_df['cuisine'] = test_df['pred'].apply(lambda x : categories[x] )
<predict_on_test><EOS> 
test_df.to_csv('submission.csv',columns = ['id','cuisine'],index = False )