-
Notifications
You must be signed in to change notification settings - Fork 72
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
Conversation
Hi @yashasvini121, |
There was a problem hiding this 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.
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. |
@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 |
Got it @yashasvini121, Thanks for helping. |
Hi @yashasvini121, can you review the changes I have made under App.py, pages and form_configs for Breast Cancer Detection. |
There was a problem hiding this 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.
pages/Breast_cancer_Detector.py
Outdated
from page_handler import PageHandler | ||
|
||
page_handler = PageHandler("pages/pages.json") | ||
page_handler.render_page("Breast Tumor Classifier Form") |
There was a problem hiding this comment.
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
.
import pickle | ||
import numpy as np | ||
|
||
Loaded_model = pickle.load(open("D:\DS_March\Projects\Breast_cancer_model.pkl", 'rb')) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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()
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. |
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...... |
@yashasvini121, please review the changes |
pages/Breast_cancer_Detector.py
Outdated
# Add a new tab for model details | ||
page_handler.add_tab("Model Details", model_details) |
There was a problem hiding this comment.
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
pages/Breast_cancer_Detector.py
Outdated
@@ -0,0 +1,8 @@ | |||
from page_handler import PageHandler | |||
from models.Breast_Cancer_Detector.predict import model_details |
There was a problem hiding this comment.
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
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.") |
There was a problem hiding this comment.
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"): |
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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
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) |
There was a problem hiding this comment.
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
if __name__ == "__main__": | ||
main() |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
@yashasvini121, I am working on changes and would commit it soon. |
cd5580f
to
39a9ec2
Compare
5327159
to
7c989e9
Compare
@yashasvini121, Changes made in PR #129 |
@yashasvini121 Admin Can I add Heart Failure Predictive Project |
|
ok |
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.