Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Breast Cancer Prediction Model #52

Closed

Conversation

murtaza-sadri-19
Copy link

I have a updated the structure using new repository because the commits were conflicting with each other.
@yashasvini121 kindly let me know about any further changes.

@murtaza-sadri-19
Copy link
Author

Hi @yashasvini121,
I am sorry that this mess happened but I managed to adhere to Project Structure. Please review this and if any changes please let me know

Copy link
Owner

@yashasvini121 yashasvini121 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks great so far! However, the page for this model hasn't been created yet. Refer the tutorial on how to create the page. Additionally, make sure to update the app.py file accordingly to list your model page. You can ignore model_details for now.

@yashasvini121 yashasvini121 changed the title Chnages updated in new repository Add Breast Cancer Prediction Model Oct 5, 2024
@yashasvini121 yashasvini121 linked an issue Oct 5, 2024 that may be closed by this pull request
@murtaza-sadri-19
Copy link
Author

Hi @yashasvini121, I have updated the app.py file.

And I'm confused that is the PR merged or approved. Please help me regarding this.

@yashasvini121
Copy link
Owner

yashasvini121 commented Oct 6, 2024

@murtaza-sadri-19, your earlier changes were correct, so those changes were approved but not merged.

As long as the PR shows as open, it has not been merged.

P.S. The app.py and pages.json files have not been updated yet, hope you are working on that.

@murtaza-sadri-19
Copy link
Author

@murtaza-sadri-19, your earlier changes were correct, so those changes were approved but not merged.

As long as the PR shows as open, it has not been merged.

P.S. The app.py and pages.json files have not been updated yet, hope you are working on that.

Got it @yashasvini121, Thanks for helping.
And I have updated App.py, pages and form_configs for Breast Cancer Detection.

@murtaza-sadri-19
Copy link
Author

Hi @yashasvini121, can you review the changes I have made under App.py, pages and form_configs for Breast Cancer Detection.

Copy link
Owner

@yashasvini121 yashasvini121 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add your page details to pages/pages.json for it to be rendered by the page_handler class.

from page_handler import PageHandler

page_handler = PageHandler("pages/pages.json")
page_handler.render_page("Breast Tumor Classifier Form")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Page not found, please update pages/pages.json.

models/Breast_Cancer_Detector/predict.py Outdated Show resolved Hide resolved
import pickle
import numpy as np

Loaded_model = pickle.load(open("D:\DS_March\Projects\Breast_cancer_model.pkl", 'rb'))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write relative file path over here

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a model_details() function over here.
The predict.py file should include a properly implemented model_details() function, or the notebook should contain this function to print a detailed model report. The model will not be accepted without this function, as it is essential for generating the necessary model details.

Sorry if I forgot to mention this earlier. Let me know if you have any confusion regarding the model_details()

@murtaza-sadri-19
Copy link
Author

Hi @yashasvini121 , I have modified predict.py accordingly to differ from model.py and added model details function into predict.py which could be called from pages.json and resolved the issue in same.

@abhisek2004
Copy link

Hi admin @yashasvini121 give me access i want to contribute to this project i will add Model Details in every page and other details. Can i add my own heart failure predction in this project . please give me acess......

@murtaza-sadri-19
Copy link
Author

@yashasvini121, please review the changes

Comment on lines 7 to 8
# Add a new tab for model details
page_handler.add_tab("Model Details", model_details)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to write this, it will automatically show if you have written model_details in pages.json

@@ -0,0 +1,8 @@
from page_handler import PageHandler
from models.Breast_Cancer_Detector.predict import model_details
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this since it's not used (if you remove the lines 7-8

Comment on lines 46 to 83
def model_details():
st.write("## Breast Cancer Detector Model Details")
st.write("### Model Type")
st.write("The Breast Cancer Detector model is a machine learning model that uses a classification algorithm to predict whether a tumor is malignant or benign based on a set of input features.")
st.write("### Features")
st.write("The model uses the following features to make predictions:")
st.write("* Mean radius")
st.write("* Mean texture")
st.write("* Mean perimeter")
st.write("* Mean area")
st.write("* Mean smoothness")
st.write("* Mean compactness")
st.write("* Mean concavity")
st.write("* Mean concave points")
st.write("* Mean symmetry")
st.write("* Mean fractal dimension")
st.write("* Radius error")
st.write("* Texture error")
st.write("* Perimeter error")
st.write("* Area error")
st.write("* Smoothness error")
st.write("* Compactness error")
st.write("* Concavity error")
st.write("* Concave points error")
st.write("* Symmetry error")
st.write("* Fractal dimension error")
st.write("* Worst radius")
st.write("* Worst texture")
st.write("* Worst perimeter")
st.write("* Worst area")
st.write("* Worst smoothness")
st.write("* Worst compactness")
st.write("* Worst concavity")
st.write("* Worst concave points")
st.write("* Worst symmetry")
st.write("* Worst fractal dimension")
st.write("### Model Performance")
st.write("The model has been trained on a dataset of breast cancer samples and has achieved a high accuracy in predicting the type of cancer.")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current implementation of model_details() is invalid because it contains hardcoded values. Please modify the function to dynamically calculate and return values such as accuracy, precision, etc., instead of hardcoding them.

Alternatively, consider moving the function into the notebook itself where it can be properly executed and remove it from this part of the code.

App.py Outdated
@@ -74,3 +76,28 @@
- **spread1**, **spread2**, **PPE**: Nonlinear measures of fundamental frequency variation.
"""
)
# Breast Cancer Tumor Detector Section
with st.expander("Breast Cancer Tumor Detector - More Information"):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintain consistency in terminology by choosing either "Breast Cancer Detector" or "Breast Cancer Tumor Detector"

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The min_value, max_value, default_value and step should all be in the same unit. Please ensure that either all values are floats or integers for consistency. For example:
Eg:

"min_value": 0.0,
"max_value": 100.0,
"default_value": 10.0,
"step": 0.1

Comment on lines 4 to 40
def main():
mean_radius = float(input("Enter mean radius: "))
mean_texture = float(input("Enter mean texture: "))
mean_perimeter = float(input("Enter mean perimeter: "))
mean_area = float(input("Enter mean area: "))
mean_smoothness = float(input("Enter mean smoothness: "))
mean_compactness = float(input("Enter mean compactness: "))
mean_concavity = float(input("Enter mean concavity: "))
mean_concave_points = float(input("Enter mean concave points: "))
mean_symmetry = float(input("Enter mean symmetry: "))
mean_fractal_dimension = float(input("Enter mean fractal dimension: "))
radius_error = float(input("Enter radius error: "))
texture_error = float(input("Enter texture error: "))
perimeter_error = float(input("Enter perimeter error: "))
area_error = float(input("Enter area error: "))
smoothness_error = float(input("Enter smoothness error: "))
compactness_error = float(input("Enter compactness error: "))
concavity_error = float(input("Enter concavity error: "))
concave_points_error = float(input("Enter concave points error: "))
symmetry_error = float(input("Enter symmetry error: "))
fractal_dimension_error = float(input("Enter fractal dimension error: "))
worst_radius = float(input("Enter worst radius: "))
worst_texture = float(input("Enter worst texture: "))
worst_perimeter = float(input("Enter worst perimeter: "))
worst_area = float(input("Enter worst area: "))
worst_smoothness = float(input("Enter worst smoothness: "))
worst_compactness = float(input("Enter worst compactness: "))
worst_concavity = float(input("Enter worst concavity: "))
worst_concave_points = float(input("Enter worst concave points: "))
worst_symmetry = float(input("Enter worst symmetry: "))
worst_fractal_dimension = float(input("Enter worst fractal dimension: "))

input_data = [mean_radius, mean_texture, mean_perimeter, mean_area, mean_smoothness, mean_compactness, mean_concavity, mean_concave_points, mean_symmetry, mean_fractal_dimension, radius_error, texture_error, perimeter_error, area_error, smoothness_error, compactness_error, concavity_error, concave_points_error, symmetry_error, fractal_dimension_error, worst_radius, worst_texture, worst_perimeter, worst_area, worst_smoothness, worst_compactness, worst_concavity, worst_concave_points, worst_symmetry, worst_fractal_dimension]

prediction = cancer_type_prediction(input_data)

print("Predicted cancer type:", prediction)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this from main(), and create a proper usable function.
Also this doesn't work, your model accepts some different arguments, or maybe some different count of args. Look into that and fix it

Comment on lines 42 to 43
if __name__ == "__main__":
main()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this, this file is a module so that isn't to be written over here.

@@ -0,0 +1,83 @@
from model import Loaded_model, cancer_type_prediction
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write the correct paths over here, like:
from models.Breast_Cancer_Detector.model import Loaded_model, cancer_type_prediction

worst_symmetry = float(input("Enter worst symmetry: "))
worst_fractal_dimension = float(input("Enter worst fractal dimension: "))

input_data = [mean_radius, mean_texture, mean_perimeter, mean_area, mean_smoothness, mean_compactness, mean_concavity, mean_concave_points, mean_symmetry, mean_fractal_dimension, radius_error, texture_error, perimeter_error, area_error, smoothness_error, compactness_error, concavity_error, concave_points_error, symmetry_error, fractal_dimension_error, worst_radius, worst_texture, worst_perimeter, worst_area, worst_smoothness, worst_compactness, worst_concavity, worst_concave_points, worst_symmetry, worst_fractal_dimension]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The number of features required by your model does not match the number of features you are currently passing in. Ensure that both are consistent.

These are around 30, but your model requires less count. Look into this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The actual parameter which contribute to Cancer Detector are less so I am passing only required features to model.

@murtaza-sadri-19
Copy link
Author

@yashasvini121, I am working on changes and would commit it soon.

@murtaza-sadri-19
Copy link
Author

@yashasvini121, Changes made in PR #129

@abhisek2004
Copy link

@yashasvini121 Admin Can I add Heart Failure Predictive Project

@murtaza-sadri-19
Copy link
Author

@yashasvini121 Admin Can I add Heart Failure Predictive Project
@abhisek2004, you could open a new issue regarding that.

@abhisek2004
Copy link

ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Breast Cancer Prediction from Numerical Features from MRI
3 participants