Closed DeepBlockDeepak closed 7 months ago
import argparse
from src.random_forest.train import run_random_forest
from src.decision_tree.train import run_decision_tree
from src.svm.train import run_svm
def main():
parser = argparse.ArgumentParser(description="Titanic Survival Prediction Project")
parser.add_argument('--model', choices=['random_forest', 'decision_tree', 'svm'], required=True)
args = parser.parse_args()
if args.model == 'random_forest':
run_random_forest()
elif args.model == 'decision_tree':
run_decision_tree()
elif args.model == 'svm':
run_svm()
if __name__ == "__main__":
main()
Overview
Restructure the project to better modularize different machine learning models (Random Forest, SVM, Decision Tree) within the Titanic Survival Prediction project. Need to maintain a clear, organized, and scalable codebase that allows for easy navigation, addition of new models, and flexibility in execution. This restructuring will be a significant step towards maintaining a professional and scalable project.
Current Structure
The current structure has a single entry point (
main.py
) with all model-related code within thesrc/
directory. This setup, while functional, can become cluttered as I add more models or functionalities.Proposed Structure
The proposed structure introduces subdirectories within
src/
for each model and uses command-line arguments inmain.py
to run different models. This enhances clarity and maintains a single entry point for the project.New Project Tree
Main.py Modification
main.py
will use Python'sargparse
library to handle command-line arguments, allowing users to specify which model to run.Benefits
Tasks
src
for each model.main.py
to include runner functions and command-line argument handling.README.md
and documentation to reflect the new project structure.