-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored Code Structure, Added Error Handling, Increased Flexibility
- Refactored Code Structure: The initial script was a single block of code that was refactored into separate functions, each with a specific task. This makes the code easier to read, understand, and maintain. The functions include 'prepare_data', 'create_model', 'compile_and_train_model', 'evaluate_model', 'predict_new_sample', 'cross_validation', and 'main'. - Added Error Handling: While the initial script assumed that everything would work perfectly, the refactored script includes some basic error checking. For example, it checks whether the target column exists in the DataFrame. - Increased Flexibility: The initial script was hard-coded to work with a specific DataFrame and target column. In the refactored script, these are parameters that can be passed to the main function, making it easier to work with different datasets or target columns. - Added Scaler Saving: The refactored script includes a line to save the 'StandardScaler' object using 'joblib'. This is important because the same scaler must be used to transform any new data in the future.
- Loading branch information
Showing
1 changed file
with
136 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters