Kaggle competition: Digit Recognizer
test["NumberOfDependents"].fillna(train["NumberOfDependents"].mode() [0], inplace=True)
 mData2 = test.iloc[:,[6,2,3,4,5,7,8,9,10,11]]
test_known = mData2[mData2.MonthlyIncome.notnull() ].values
test_unknown = mData2[mData2.MonthlyIncome.isnull() ].values
test_X2 = test_known[:,1:]
test_y2 = test_known[:,0]
rfr2 = RandomForestRegressor(random_state=0,n_estimators=200,max_depth=3,n_jobs=-1)
 rfr2.fit(test_X2,test_y2)
 predicted_y = rfr2.predict(test_unknown[:,1:] ).round(0)
 test.loc[test.MonthlyIncome.isnull() ,'MonthlyIncome'] = predicted_y<predict_on_test>
hist = model.fit_generator(datagen.flow(X_train, Y_train, batch_size=32),
steps_per_epoch=1000,
epochs=1000,
verbose=2,
validation_data=(X_train[:400,:], Y_train[:400,:]),
callbacks=[annealer])
 final_loss, final_acc = model.evaluate(X_train, Y_train, verbose=0)
 print("Final loss: {0:.4f}, final accuracy: {1:.4f}".format(final_loss, final_acc))
test2 = test[test.columns[2:]]
pre_y2 = lgbm.predict_proba(test2)[:,1]<save_to_csv>
results = model.predict(test)
 results = np.argmax(results,axis = 1)
 results = pd.Series(results,name="Label")
 submission = pd.concat([pd.Series(range(1,28001),name = "ImageId"),results],axis = 1)
 submission.to_csv("MNIST_ver21.csv",index=False )