<jupyter_start><jupyter_text>Creating a custom test set<jupyter_code>from sklearn.model_selection import train_test_split
H_Train, H_Test , Pos_Train , Pos_Test = train_test_split(H2,Pos,test_size=0.05, random_state=42)
def CNN():
    model = Sequential()
    model.add(Conv2D(32,(3,3),activation = 'linear', padding='same',input_shape=(56,57,32) ))
    model.add(Conv2D(16,(3,3),activation = 'linear', padding='same'))
    model.add(Flatten())
    model.add(Dense(512 ,activation = 'relu'))
    model.add(Dense(256 ,activation = 'relu' ))
    model.add(Dense(128 ,activation = 'relu' ))
    model.add(Dense(3))
    model.compile(loss="mean_absolute_error", optimizer = Adam(1e-3)) 
    return model
model = CNN()
from tensorflow.keras.callbacks import EarlyStopping, ModelCheckpoint
earlystopper = EarlyStopping(patience = 80, verbose=1)
checkpointer = ModelCheckpoint('best_CNN.h5', verbose=1, save_best_only=True)
hist = model.fit(H,Pos , epochs=1000, validation_split=0.2  ,callbacks=[earlystopper, checkpointer],batch_size=32)
val_loss = hist.history['val_loss']
def mse(a,b):
    return np.sqrt(np.sum((a-b)**2,axis=1))
y2 = model.predict(H_Test)
rmse = np.mean(mse(y2,Pos_Test))
print(rmse)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15647921760391198, 'fraction_numerical': 0.04156479217603912, 'mean_word_length': 6.580246913580247, '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': '657086', 'license': 'MIT', 'n_tokens_mistral': 490, 'n_tokens_neox': 454, 'n_words': 72, 'path': 'AE&CNN.ipynb', 'repo_name': 'aayush2710/CTW2020-IDP', 'size': '1227'}