<jupyter_start><jupyter_text>With validation<jupyter_code>def get_model(unit):
    model = Sequential()
    model.add(LSTM(unit, input_shape=(10, 6)))
    model.add(Dense(1, activation='sigmoid'))
    model.compile(loss='binary_crossentropy', optimizer='adam', metrics=[auc_roc])
    return model
scores = []
for i in range(12, 17):
    m = get_model(i)
    epochs = 10
    batch_size = 300
    print('Training', i)
    score = gdf_dfs[2].train_lstm(
        m, feature_name='pca_n_gdf_que', plot_name='here.png', n_steps=10,
        fit_kwargs={'epochs': epochs, 'batch_size': batch_size, 'verbose': 0, 'shuffle': False}, 
        class_weight=class_weights,
        compile_kwargs= { 'loss': 'binary_crossentropy', 'optimizer': 'adam', 'metrics': [auc_roc]})
    score = {**score, 'arch': m.to_json(), 'batch_size': batch_size, 'n_steps': 2, 'epochs': epochs, 
         'r': gdf_dfs[1].r, 's': gdf_dfs[1].s}
    print(i, score['matthews'], score['test_matthews'], score['roc_auc'], score['test_roc_auc'])
    scores.append(score)
df_scores = pd.DataFrame(scores)
df_scores
#pd.DataFrame([score]).to_csv(
#    '../gdf_pca/res_lstm_weird/res_lstm_pca_que_{}_len24000_r{}_s{}.csv'.format(stock, gdf_dfs[1].r, gdf_dfs[1].s))<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18130990415335463, 'fraction_numerical': 0.02156549520766773, 'mean_word_length': 5.024038461538462, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '520884', 'license': 'MIT', 'n_tokens_mistral': 517, 'n_tokens_neox': 492, 'n_words': 78, 'path': 'overview/playground/playground_11869_lstm.ipynb', 'repo_name': 'vevurka/mt-lob', 'size': '1252'}