Kaggle competition: Dog Breed Identification
from sklearn.model_selection import GridSearchCV, cross_val_score, RepeatedStratifiedKFold, train_test_split
from xgboost import XGBClassifier
from sklearn.metrics import classification_report<find_best_model_class>
doggo_images = np.empty(( len(imagenames), 224, 224, 3), dtype=np.float16)
 doggo_targets = np.empty(( len(imagenames)) , dtype=np.uint8)
 labels = pd.read_csv('/kaggle/input/dog-breed-identification/labels.csv')
 le = preprocessing.LabelEncoder()
labels['target'] = le.fit_transform(labels.breed )
model = XGBClassifier()
cv = RepeatedStratifiedKFold(n_splits=10, n_repeats=5, random_state=11)
 scores = cross_val_score(model, x_train, y_train, cv=cv, n_jobs=-1, verbose=True, scoring='roc_auc')
 print(np.mean(scores),np.std(scores))<choose_model_class>
class_dogs = []
breed = []
for i in np.sort(np.unique(doggo_targets)) :
class_dogs.append(doggo_images[doggo_targets == i][np.random.randint(50)])
 breed.append(i )
best_model = XGBClassifier(n_estimators=100,
subsample=0.7,
max_depth=3,
learning_rate=0.01,
colsample_bytree=1 )<save_to_csv>
plt.figure(figsize=(11,11))
for i in range(len(np.unique(doggo_targets))):
plt.subplot(11, 11, i+1)
 plt.imshow(class_dogs[i].astype(np.float32))
plt.axis('off')
 plt.show()
best_model.fit(x_train,y_train)
 answer = pd.DataFrame(best_model.predict(test_df))
test_file = pd.read_csv('.. /input/titanic/test.csv')
 answer['PassengerId']= test_file.PassengerId.tolist()
answer.set_index('PassengerId',inplace=True)
 answer.columns=['Survived']
answer.Survived = answer.Survived.astype('int')
 answer.to_csv('answer_xgb_binning_new02_bin7_familysize02.csv' )<import_modules>
keras.backend.clear_session()
model_base = keras.applications.inception_resnet_v2.InceptionResNetV2(weights='imagenet', include_top=False, input_shape=(224,224,3))
model = keras.models.Sequential()
for layer in model_base.layers:
layer.trainable = False
model.add(model_base)
 model.add(keras.layers.GlobalAveragePooling2D())
 model.add(keras.layers.Dense(120, activation='softmax'))
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
 history = model.fit(doggo_images, doggo_targets, validation_split=0.05, epochs=20, batch_size=1024 )
Conv2D, SeparableConv1D, Add, BatchNormalization, Activation, GlobalAveragePooling2D, LeakyReLU, Flatten
Lambda, Multiply, LSTM, Bidirectional, PReLU, MaxPooling1D
%matplotlib inline
print(os.listdir(".. /input/"))<data_type_conversions>
predictions = pd.DataFrame(model.predict(doggo_test_images))
predictions.columns = list(le.inverse_transform([int(col)for col in predictions.columns]))
predictions['id'] = [testname.rstrip('.jpg')for testname in testnames]
<define_variables><EOS> 
predictions.to_csv('submission.csv', index=False )