Predicting Thyroid Cancer Recurrence with Machine Learning Project

Ask questions about projects relating to: biology, biochemistry, genomics, microbiology, molecular biology, pharmacology/toxicology, zoology, human behavior, archeology, anthropology, political science, sociology, geology, environmental science, oceanography, seismology, weather, or atmosphere.

Moderators: AmyCowen, kgudger, MadelineB, Moderators

Post Reply
Fullmoonnicky
Posts: 12
Joined: Wed Oct 16, 2024 7:54 am
Occupation: Student

Predicting Thyroid Cancer Recurrence with Machine Learning Project

Post 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 ]
amyCC
Site Admin
Posts: 398
Joined: Wed Apr 01, 2020 4:02 pm
Occupation: Moderator
Project Question: *
Project Due Date: *
Project Status: Not applicable

Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project

Post 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
Fullmoonnicky
Posts: 12
Joined: Wed Oct 16, 2024 7:54 am
Occupation: Student

Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project

Post 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:
Attachments
the screenshot of the error
the screenshot of the error
error.png (79.91 KiB) Viewed 8408 times
amyCC
Site Admin
Posts: 398
Joined: Wed Apr 01, 2020 4:02 pm
Occupation: Moderator
Project Question: *
Project Due Date: *
Project Status: Not applicable

Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project

Post 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
Fullmoonnicky
Posts: 12
Joined: Wed Oct 16, 2024 7:54 am
Occupation: Student

Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project

Post by Fullmoonnicky »

Oh yeah, thanks
Fullmoonnicky
Posts: 12
Joined: Wed Oct 16, 2024 7:54 am
Occupation: Student

Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project

Post by Fullmoonnicky »

im having an issue with code block 1DD
Attachments
Screenshot 2024-10-22 195805.png
Screenshot 2024-10-22 195805.png (54.45 KiB) Viewed 8363 times
amyCC
Site Admin
Posts: 398
Joined: Wed Apr 01, 2020 4:02 pm
Occupation: Moderator
Project Question: *
Project Due Date: *
Project Status: Not applicable

Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project

Post 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
Fullmoonnicky
Posts: 12
Joined: Wed Oct 16, 2024 7:54 am
Occupation: Student

Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project

Post 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
Fullmoonnicky
Posts: 12
Joined: Wed Oct 16, 2024 7:54 am
Occupation: Student

Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project

Post 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
amyCC
Site Admin
Posts: 398
Joined: Wed Apr 01, 2020 4:02 pm
Occupation: Moderator
Project Question: *
Project Due Date: *
Project Status: Not applicable

Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project

Post 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
Fullmoonnicky
Posts: 12
Joined: Wed Oct 16, 2024 7:54 am
Occupation: Student

Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project

Post 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!
amyCC
Site Admin
Posts: 398
Joined: Wed Apr 01, 2020 4:02 pm
Occupation: Moderator
Project Question: *
Project Due Date: *
Project Status: Not applicable

Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project

Post by amyCC »

Wonderful! Let us know if you run into any other problems. Is this for a school science project?

Amy
Science Buddies
Fullmoonnicky
Posts: 12
Joined: Wed Oct 16, 2024 7:54 am
Occupation: Student

Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project

Post by Fullmoonnicky »

Yes this is for my school STEM project
Fullmoonnicky
Posts: 12
Joined: Wed Oct 16, 2024 7:54 am
Occupation: Student

Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project

Post 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?
Fullmoonnicky
Posts: 12
Joined: Wed Oct 16, 2024 7:54 am
Occupation: Student

Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project

Post 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
amyCC
Site Admin
Posts: 398
Joined: Wed Apr 01, 2020 4:02 pm
Occupation: Moderator
Project Question: *
Project Due Date: *
Project Status: Not applicable

Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project

Post 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
Fullmoonnicky
Posts: 12
Joined: Wed Oct 16, 2024 7:54 am
Occupation: Student

Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project

Post by Fullmoonnicky »

Is there a way i can save the already trained model and import it in another notebook
Fullmoonnicky
Posts: 12
Joined: Wed Oct 16, 2024 7:54 am
Occupation: Student

Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project

Post by Fullmoonnicky »

its ok i figured out how to save the mode and then run it with the new set of data
amyCC
Site Admin
Posts: 398
Joined: Wed Apr 01, 2020 4:02 pm
Occupation: Moderator
Project Question: *
Project Due Date: *
Project Status: Not applicable

Re: Predicting Thyroid Cancer Recurrence with Machine Learning Project

Post 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
Post Reply

Return to “Grades 9-12: Life, Earth, and Social Sciences”