Beispiel #1
0
        Dense(500, input_dim=4, kernel_initializer='normal',
              activation='relu'))
    model.add(Dense(1))
    # Compile model
    model.compile(loss='mean_absolute_percentage_error', optimizer='adam')
    return model


dnn = make_pipeline(
    RobustScaler(),
    KerasRegressor(build_fn=NeuralNetModel,
                   epochs=10,
                   batch_size=200,
                   verbose=0))

stacked_averaged_models = StackingAveragedModels(
    base_models=[model_xgb, model_lgb], meta_model=lasso, n_folds=4)

ensemble_reg = EnsembleRegressor([model_lgb])

#Mapes and Submission
mapes = []
tcv_mapes = []
cv_mapes = []
Sub = []
tcv = False
cv = False
val = False

#Cross-Val and Training
#Filter on the right town and keep the test index
train_town = df_train
Beispiel #2
0
def NeuralNetModel():
  # create model
  model = Sequential()
  model.add(Dense(500, input_dim=4, kernel_initializer='normal', activation='relu'))
  model.add(Dense(1))
  # Compile model
  model.compile(loss='mean_absolute_percentage_error', optimizer='adam')
  return model

dnn = make_pipeline(PartScaler(last_col = 5), KerasRegressor(build_fn=NeuralNetModel, epochs=10, batch_size=200, verbose=0))

rfr = RandomForestRegressor(n_estimators = 10, n_jobs = -1, random_state = 123)

stacked_averaged_models = StackingAveragedModels(base_models = [model_slgb],
                                                 meta_model = model_sxgb,
                                                 n_folds = 4)



ensemble_reg = EnsembleRegressor([model_lgb])


#Mapes and Submission
mapes = []
tcv_mapes = []
cv_mapes = []
Sub = []
tcv = False
cv = False
val = False