<jupyter_start><jupyter_text>============================================================<jupyter_code>X_train_control = []
y_train_control = []

for i in range(len(y_train_steer)):
    if y_train_steer[i] == 1:
        X_train_control.append(X_train[i])
        y_train_control.append(y_train[i])
        
print(f"Control points: {len(X_train_control)}")
assert steer_count == len(X_train_control)
keras.backend.clear_session()

model = ImiCarla(input_shape=input_shape)
optim = optimizers.Adam(learning_rate=0.001)
model.compile(optim, loss="mean_absolute_error")
history = model.fit(x=np.array(X_train_control), 
                    y=np.array(y_train_control), 
                    batch_size=16, 
                    epochs=50, 
                    verbose=2, 
                    validation_split=0.05, 
                    shuffle=True, 
                    callbacks=cb_list)
plt.plot(history.history["loss"])
plt.plot(history.history["val_loss"])
plt.title("Control Training History")
plt.ylabel("Loss")
plt.xlabel("Epoch")
plt.legend(["Train", "Val"], loc="upper left")
plt.show()
MODEL_PATH = "ImiCarla.h5"
model.save(MODEL_PATH)
loaded_model = load_model(MODEL_PATH, compile=True)
NUM_SAMPLES = 6

for _ in range(NUM_SAMPLES):
    FRAME = random.randint(1, len(X_train_control))
    y_pred = loaded_model.predict(x=np.array([X_train_control[FRAME]]), batch_size=None)

    print(f"Frame: {FRAME}")
    print(f"Prediction: {y_pred}")
    print(f"Actual: {y_train_control[FRAME]}\n")<jupyter_output>Frame: 947
Prediction: [[0.06264371]]
Actual: [0.08666]

Frame: 1108
Prediction: [[0.03683466]]
Actual: [0.02804]

Frame: 1665
Prediction: [[-0.02176173]]
Actual: [-0.02788]

Frame: 825
Prediction: [[0.02816018]]
Actual: [0.01906]

Frame: 711
Prediction: [[-0.0200767]]
Actual: [-0.02362]

Frame: 1560
Prediction: [[-0.0234744]]
Actual: [-0.00772]
{'fraction_non_alphanumeric': 0.1804956896551724, 'fraction_numerical': 0.06734913793103449, 'mean_word_length': 4.059945504087193, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '307234', 'license': 'Apache-2.0', 'n_tokens_mistral': 780, 'n_tokens_neox': 682, 'n_words': 103, 'path': 'Playground.ipynb', 'repo_name': 'kdliu00/ROAR', 'size': '1856'}