Kaggle competition: Digit Recognizer
<SOS> metric: categorizationaccuracy Kaggle data source: digit-recognizer<drop_column>
%matplotlib inline
X_test = df_test.copy()
test_date = X_test['datetime']
X_test.drop(columns = ['WeekOfYear','datetime','holiday'],inplace = True )<drop_column>
train = pd.read_csv('/kaggle/input/digit-recognizer/train.csv')
 test = pd.read_csv('/kaggle/input/digit-recognizer/test.csv' )
X_test = X_test[cols_list]<predict_on_test>
X_train = train.iloc[:,1:].values.astype('float32')
 y_train = train['label'].values.astype('int32')
 test = test.values.astype('float32')
 del train
y_test_predict=xgb_best.predict(X_test)
 y_test_final = rev_trans(y_test_predict)
 df_test['count']=y_test_final<save_to_csv>
X_train = X_train / 255.0
test = test / 255.0
df_test[['datetime','count']].to_csv('/kaggle/working/submissionNoParams.csv', index=False )<set_options>
X_train = X_train.reshape(X_train.shape[0], 28, 28, 1)
 test = test.reshape(test.shape[0], 28, 28, 1 )
%matplotlib inline 
<load_from_csv>
y_train = to_categorical(y_train)
 y_train
train_df = pd.read_csv('.. /input/bike-sharing-demand/train.csv')
 test_df = pd.read_csv('.. /input/bike-sharing-demand/test.csv')
<count_missing_values>
np.random.seed(2 )
print(train_df.isnull().values.any() ,'
',test_df.isnull().values.any() )<create_dataframe>
X_train, X_test, y_train, y_test = train_test_split(X_train, y_train, test_size = 0.1, random_state = 2 )
test = pd.DataFrame(test_df)
 test<create_dataframe>
model = Sequential()
model.add(Conv2D(filters = 64, kernel_size =(5,5), padding = 'Same', activation = 'relu', input_shape =(28,28,1)))
 model.add(Conv2D(filters = 64, kernel_size =(5,5), padding = 'Same', activation = 'relu'))
model.add(MaxPool2D(pool_size=(2,2)))
 model.add(Dropout(0.2))
model.add(Conv2D(filters = 128, kernel_size =(3,3), padding = 'Same', activation = 'relu'))
model.add(Conv2D(filters = 128, kernel_size =(3,3), padding = 'Same', activation = 'relu'))
model.add(MaxPool2D(pool_size=(2,2), strides=(2,2)))
 model.add(Dropout(0.2))
model.add(Flatten())
 model.add(Dense(512, activation = 'relu'))
model.add(Dropout(0.2))
model.add(Dense(10, activation = 'softmax'))
train = pd.DataFrame(train_df)
 train<feature_engineering>
model.compile(optimizer="adam", loss='categorical_crossentropy', metrics=['accuracy'] )
train['datetime'] = pd.to_datetime(train['datetime'], format = '%Y-%m-%dT%H:%M:%S')
 train['year'] = train['datetime'].dt.year
train['month'] = train['datetime'].dt.month
train['day'] = train['datetime'].dt.day
train['hour'] = train['datetime'].dt.hour
train<drop_column>
epochs = 50
batch_size = 64
train = train_df.drop('datetime' , axis=1)
 train<sort_values>
datagen = ImageDataGenerator(featurewise_center=False,
samplewise_center=False,
featurewise_std_normalization=False,
samplewise_std_normalization=False,
zca_whitening=False,
rotation_range=10,
zoom_range=0.1,
width_shift_range=0.1,
height_shift_range=0.1,
horizontal_flip=False,
vertical_flip=False)
 datagen.fit(X_train )
train[["season", "count"]].groupby(['season'], as_index=False ).sum().sort_values(by='count', ascending=False )<sort_values>
history = model.fit_generator(datagen.flow(X_train,y_train, batch_size=batch_size),
epochs = epochs, validation_data =(X_test,y_test),
verbose = 2, steps_per_epoch=X_train.shape[0] // batch_size )
train[["holiday", "count"]].groupby(['holiday'], as_index=False ).sum().sort_values(by='count', ascending=False )<sort_values>
results = model.predict(test)
train[["workingday", "count"]].groupby(['workingday'], as_index=False ).sum().sort_values(by='count', ascending=False )<feature_engineering>
output = pd.concat([pd.Series(range(1,28001), name = 'ImageId'), results], axis = 1)
 output
<create_dataframe><EOS> 
output.to_csv('submission.csv', index=False )