Kaggle competition: What's Cooking? (Kernels Only)
<split><EOS> 
train=pd.read_json('.. /input/train.json')
 test=pd.read_json('.. /input/test.json')
 train['ingredients'] = [", ".join(ingredients)for ingredients in train['ingredients']]
test['ingredients']=[", ".join(ingredients)for ingredients in test['ingredients']]
def multiclass_logloss(actual, predicted, eps=1e-15):

 if len(actual.shape)== 1:
actual2 = np.zeros(( actual.shape[0], predicted.shape[1]))
for i, val in enumerate(actual):
actual2[i, val] = 1
actual = actual2
clip = np.clip(predicted, eps, 1 - eps)
 rows = actual.shape[0]
vsota = np.sum(actual * np.log(clip))
return -1.0 / rows * vsota
lblencdr=preprocessing.LabelEncoder()
y_cuisine=lblencdr.fit_transform(train['cuisine'].values)
 X_train, X_val, y_train, y_val = train_test_split(train['ingredients'].values, y_cuisine,
stratify=y_cuisine,
test_size=0.1,
shuffle=True,
random_state=0)
 vect=TfidfVectorizer().fit(list(X_train)+list(X_val))
X_train_vect=vect.transform(X_train)
 x_valid_vect=vect.transform(X_val)
 ftwo_scorer=metrics.make_scorer(fbeta_score, average='micro', beta=0.5)
 param_grid={
'kernel': ['rbf'],
'C': [0.1, 1.0, 100],
'gamma': [0,1,10]
}
classifier=SVC()
model=GridSearchCV(estimator=classifier, param_grid=param_grid, scoring=ftwo_scorer,
verbose=10, n_jobs=4, cv=5)
 model.fit(X_train_vect, y_train)
 print("Best score: %0.3f" % model.best_score_)
 print("Best Parameters set:")
 best_parameters=model.best_estimator_.get_params()
for param_name in sorted(param_grid.keys()):
print("\t%s: %r" %(param_name, best_parameters[param_name]))
predictions=model.predict(vect.transform(X_val))
print(f1_score(predictions, y_val, average='micro'))
y_predict=model.predict(vect.transform(test['ingredients']))
test['cuisine']=lblencdr.inverse_transform(y_predict)
 test = test.sort_values('id' , ascending=True)
 test[['id' , 'cuisine' ]].to_csv("submission.csv", index=False )