text_html_output_1.png
from keras.layers import Dense

from sklearn.preprocessing import OrdinalEncoder

import pandas as pd

import pandas as pd

train = pd.read_csv('../input/30-days-of-ml/train.csv', index_col=0)
test = pd.read_csv('../input/30-days-of-ml/test.csv', index_col=0)

y = train['target']
features = train.drop(['target'], axis=1)

object_cols = [col for col in features.columns if 'cat' in col]
X = features.copy()
X_test = test.copy()
ordinal_encoder = OrdinalEncoder()
X[object_cols] = ordinal_encoder.fit_transform(features[object_cols])
X_test[object_cols] = ordinal_encoder.transform(test[object_cols])

def create_model():
    model = Sequential()
    model.add(Dense(320, input_dim=X_train.shape[1], activation='relu'))
    model.add(Dense(384, activation='relu'))
    model.add(Dense(352, activation='relu'))
    model.add(Dense(448, activation='relu'))
    model.add(Dense(160, activation='relu'))
    model.add(Dense(160, activation='relu'))
    model.add(Dense(32, activation='relu'))
    model.add(Dense(1))
    model.compile(optimizer=Adam(learning_rate=0.0001), loss='mse')
    return model
model = create_model()
model.summary()

X_train.shape

early_stop = EarlyStopping(monitor='val_loss', mode='min', verbose=1, patience=10)
history = model.fit(x=X_train, y=y_train, validation_split=0.1, batch_size=128, epochs=150, callbacks=[early_stop])
losses = pd.DataFrame(model.history.history)

result = model.predict(X_test)

result