Page 1 of 1
Predicting Thyroid Cancer Recurrence with Machine Learning Project
Posted: Wed Oct 16, 2024 7:57 am
by Fullmoonnicky
PLEASE HELP! I am having an issue with the code in Code Block 1F, when I run it it brings value error that the values I mapped are all NaN but when I check Code Bode D, the values I mapped are there. Please someone help I really need to finish this project for a science fair.
[Administrator note: Project url:
https://www.sciencebuddies.org/science- ... oid_cancer ]
Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project
Posted: Wed Oct 16, 2024 3:48 pm
by amyCC
Please make sure you've done the TODO steps for CodeBlock 1F. You mention that you ran 1D, but there are tasks you need to do to run 1E and 1F as well. These are explained in the procedure.
After running 1E, look at the directions for 1F:
(Code Block 1F) In this code block, you will map each ‘Physical Examination’ condition to a number, based on the list below. Rank each condition from least to most severe. Inside the curly braces ( they look like this: { }), map each condition to a number (E.g. {‘Normal’: 0, ‘Diffuse goiter’: 1…}). Note that since left and right single nodular goiters have the same severity, you can assign them the same number. Here, we will rank them from least to most severe:
- Normal: A normal thyroid gland indicates no visible abnormalities or nodules.
Diffuse goiter: A smooth thyroid gland with some swelling around the gland.
- Single nodular goiter-left: A solitary nodule located on the left side of the thyroid gland. (This should be assigned the same value as Single Nodular Goiter Right.)
- Single nodular goiter-right: A solitary nodule located on the right side of the thyroid gland. (This should be assigned the same value as Single Nodular Goiter Left.)
- Multinodular goiter: The presence of multiple nodules within the thyroid gland.
Did you do this step? If so, maybe there is a syntax error. Can you upload a screenshot of your code for this block?
Amy
Science Buddies
Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project
Posted: Thu Oct 17, 2024 7:30 am
by Fullmoonnicky
Yes, I followed all the steps in the code blocks before but still got an error. I have reloaded and repeated the steps multiple times but still the same error. Here is the screenshot:
Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project
Posted: Thu Oct 17, 2024 8:17 am
by amyCC
That image shows that you have not done the TODO for the step, as described in the step I quoted previously. In your screenshot, you have: mapping = {'Normal': 0}
The directions tell you that you need to type in ALL of the mapping there: "you will map each ‘Physical Examination’ condition to a number" (based on the list of conditions).
You need to update that line in colab correctly to make the codeblock run. There are 5 conditions listed, and per the directions, you will use numbers 0, 1, 2, and 3. (Two of them are given the same number.)
Take another look at the directions and see if you can properly update the code for this step.
Amy
Science Buddies
Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project
Posted: Thu Oct 17, 2024 10:03 am
by Fullmoonnicky
Oh yeah, thanks
Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project
Posted: Tue Oct 22, 2024 10:20 am
by Fullmoonnicky
im having an issue with code block 1DD
Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project
Posted: Tue Oct 22, 2024 11:18 am
by amyCC
Have you done all of the TODO steps in the sections before this without an error? When you look at the output in block 1V, are all values now numeric?
Make sure you then ran each of the blocks in 1.1.4, 1.2, and 1.3. (They don't necessarily require you to change the code, but they need to be run.
Doublecheck that you have a checkmark showing each of the Label Encoding steps in the project (section 1.1.1) has been run without an error. Most of those require you to edit the code.
If you don't find that you've overlooked anything, can you show a screenshot of what you see for 1V and 1X?
Amy
Science Buddies
Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project
Posted: Wed Oct 23, 2024 7:37 am
by Fullmoonnicky
Hi, I did everything but I decided to run the code blocks before again and now all the codes before have errors and this is not the first time it has happened, every time I run into an error and try to re-run the code blocks before, they get errors as well and I end up having to repeat from the beginning. I have repeated 5 times now
Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project
Posted: Wed Oct 23, 2024 7:41 am
by Fullmoonnicky
Now it's bringing an error on code block 1Z as I was repeating, that it does not recognise the y_train label
Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project
Posted: Wed Oct 23, 2024 8:53 am
by amyCC
If 1Z is throwing an error, 1X may not have successfully run. If you are in 1Z, try using Runtime / Run Before to make sure all previous blocks are re-run. Then run 1Z again.
When you are running into these issues and needing to rerun blocks, are you still seeing that the changes you have made to the code (filling in the TODO blocks) are in place?
Amy
Science Buddies
Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project
Posted: Wed Oct 23, 2024 11:38 am
by Fullmoonnicky
Thank you, using the runtime/run before worked plus yes, when I would rerun all the things I had done in the code block were still intact but thank you it worked!
Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project
Posted: Wed Oct 23, 2024 12:15 pm
by amyCC
Wonderful! Let us know if you run into any other problems. Is this for a school science project?
Amy
Science Buddies
Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project
Posted: Wed Oct 23, 2024 11:08 pm
by Fullmoonnicky
Yes this is for my school STEM project
Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project
Posted: Thu Oct 24, 2024 5:17 am
by Fullmoonnicky
Although i have a question, how do i show the judges that the code works using a fake set of data i created. Should i remove certain blocks of code or make a whole new notebook of code?
Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project
Posted: Thu Oct 24, 2024 5:38 am
by Fullmoonnicky
Is there a way for me to like isolate the model and import a fake set of data to show the judges what the results would be
Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project
Posted: Thu Oct 24, 2024 8:26 am
by amyCC
You can certainly use the visualizations from the project to show the outcome of the models (and the comparisons between the models you train with more or less data).
I'm not sure what you are hoping to show by using an alternate or fake data set. To work in the model you've set up in the project, it would need to use the same format as the data provided.
But if you are wanting to run your models with different data, you can use the format of the csv file provided, populate it with your own data, and then import that in block 1B instead of the file used in the project. (I would create a new copy of your notebook before doing that so that you keep your working project copy intact.)
Does that help?
Amy
Science Buddies
Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project
Posted: Fri Oct 25, 2024 7:22 am
by Fullmoonnicky
Is there a way i can save the already trained model and import it in another notebook
Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project
Posted: Fri Oct 25, 2024 7:49 am
by Fullmoonnicky
its ok i figured out how to save the mode and then run it with the new set of data
Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project
Posted: Fri Oct 25, 2024 10:25 am
by amyCC
Great! I'm glad you sorted that out. You can click File/Save a Copy in Drive to make a copy of a notebook (which is probably what you did). That holds the changes you've made to the code/model, and you can then use a different data file or make other changes. (You can rename the file at the top the way you would any other Drive file.)
Amy
Science Buddies