From 6a79fad795cf527e4263494979c1dc1fd483afec Mon Sep 17 00:00:00 2001 From: A Farzat Date: Sun, 2 Nov 2025 18:29:23 +0300 Subject: Add the cancer detection project --- content/blog/csca5642-w3/notebook.html | 9244 ++++++++++++++++++++++++++++++++ 1 file changed, 9244 insertions(+) create mode 100644 content/blog/csca5642-w3/notebook.html (limited to 'content/blog/csca5642-w3/notebook.html') diff --git a/content/blog/csca5642-w3/notebook.html b/content/blog/csca5642-w3/notebook.html new file mode 100644 index 0000000..f4d23e7 --- /dev/null +++ b/content/blog/csca5642-w3/notebook.html @@ -0,0 +1,9244 @@ + + + + + +cours3w3submission + + + + + + + + + + + + +
+ + + + +# Train each model architecture +# This cell can be left without running if the checkpoint files are available +for model in arch_models: + print("\nTraining %s..." % model["name"]) + + model_instance = create_cnn_model(**model["params"]) + + # Callbacks + early_stopping = EarlyStopping(monitor='val_auc', patience=5, restore_best_weights=True, mode='max') + reduce_lr = ReduceLROnPlateau(monitor='val_auc', factor=.5, patience=3, min_lr=1e-7, mode='max') + model_checkpoint = ModelCheckpoint(model["checkpoint"], save_best_only=True, monitor='val_auc', mode='max') + hist_logger = CSVLogger(model["history_file"]) + + # Reset generators to ensure consistent training across models + train_generator.reset() + val_generator.reset() + + model_instance.fit( + train_generator, + epochs=15, # Fewer epochs for tuning + validation_data=val_generator, + callbacks=[early_stopping, reduce_lr, model_checkpoint, hist_logger], + verbose=1 + )# Train each regularization model +# This cell can be left without running if the checkpoint files are available +for model in reg_models: + print("\nTraining %s..." % model["name"]) + + model_instance = create_cnn_model(**model["params"]) + + # Callbacks + early_stopping = EarlyStopping(monitor='val_auc', patience=5, restore_best_weights=True, mode='max') + reduce_lr = ReduceLROnPlateau(monitor='val_auc', factor=.5, patience=3, min_lr=1e-7, mode='max') + model_checkpoint = ModelCheckpoint(model["checkpoint"], save_best_only=True, monitor='val_auc', mode='max') + hist_logger = CSVLogger(model["history_file"]) + + # Reset generators to ensure consistent training + train_generator.reset() + val_generator.reset() + + model_instance.fit( + train_generator, + epochs=15, + validation_data=val_generator, + callbacks=[early_stopping, reduce_lr, model_checkpoint, hist_logger], + verbose=1 + )# This cell can be left without running if the checkpoint files are available +# Create the best regularized model +final_model = create_cnn_model(**best_reg_model["params"]) + +# Train the final model +final_model.fit( + full_train_generator, + epochs=EPOCHS, + validation_data=full_val_generator, + callbacks=[early_stopping, reduce_lr, final_checkpoint, final_csv_logger], + verbose=1 +) + +
+ + -- cgit v1.2.3-70-g09d2