An interactive web application for breast cancer risk prediction using Machine Learning and Deep Learning models. Built with Streamlit and tracked using MLflow.
- Upload CSV files for batch predictions
- Visualize model predictions with SHAP values
- Adjust confidence thresholds for classification
- Compare performance between ML and DL models
├── streamlit_app.py # Streamlit web application
├── models/
│ ├── deep_learning_model.h5 # Deep Learning model
├── random_forest_model.pkl # Random Forest model
├── deep_learning_model.h5 # Deep Learning model
├── stacking_model.pkl # Stacking model
├── bagging_model.pkl # Bagging model
├── svm_model.pkl # SVM model
├── mlruns/ # MLflow tracking directory
├── Dockerfile # Docker configuration for containerization
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore file
└── README.md # Project documentation
-
Clone the repository:
git clone https://github.com/sivkri/interactive-cancer-risk-predictor-ml-dl.git cd interactive-cancer-risk-predictor-ml-dl
-
Install dependencies:
pip install -r requirements.txt
- Run the Streamlit application:
streamlit run app/streamlit_app.py
- Open the provided local URL in your browser to interact with the application.
To run the application in a Docker container:
- Build the Docker image:
docker build -t DockerFile .
- Run the Docker container:
docker run -p 8501:8501 DockerFile
- Access the application at
http://localhost:8501
MLflow is used to track experiments, log parameters and metrics, and save trained models.
mlflow ui
This will launch the MLflow Tracking UI at (http://localhost:5000)
import mlflow
import mlflow.sklearn
with mlflow.start_run():
mlflow.log_param("model_type", "RandomForest")
mlflow.log_param("n_estimators", 100)
mlflow.log_metric("accuracy", 0.95)
mlflow.sklearn.log_model(rf_model, "model")
This will: - Log hyperparameters (model_type
, n_estimators
) - Log a performance metric (accuracy
) - Save the trained model as an artifact
To explore: - Runs and experiments - Parameters and metrics - Downloadable models
mlflow.set_experiment("CancerRiskPrediction")
To log to this experiment:
with mlflow.start_run(run_name="RandomForest_Trial_1"): ...
import matplotlib.pyplot as plt
plt.plot([0, 1], [0.5, 0.9])
plt.savefig("plot.png")
mlflow.log_artifact("plot.png")
Experiment logs are stored under the mlruns/
directory - Each run contains logged metrics, parameters, models, and artifacts