Predicting Future water Quality with Machine Learning

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, bfinio, MadelineB, Moderators

Post Reply
AdeyantLFC
Posts: 5
Joined: Sun Nov 03, 2024 8:42 am
Occupation: Student

Predicting Future water Quality with Machine Learning

Post by AdeyantLFC »

I'm currently working on this project and when I go to click the IPYNB file that opens the code (Google Colab) I need to put my data in, it says "No preview available". I've tried to open the code on multiple devices and it still doesn't work. Are there any solutions to this, or does the code need to be updated? Thanks.
amyCC
Site Admin
Posts: 405
Joined: Wed Apr 01, 2020 4:02 pm
Occupation: Moderator
Project Question: *
Project Due Date: *
Project Status: Not applicable

Re: Predicting Future water Quality with Machine Learning

Post by amyCC »

Hi - Can you confirm that you’ve set up the files as noted in the directions and put the .ipynb notebook on Google Drive, as described in Section 2 - Preparing the Workspace?

Is Colab opening when you double click the file? (Make sure you are logged in on the same Google account in Colab that you are using for drive, if you happen to use more than one Google account.)

Amy
Science Buddies
amyCC
Site Admin
Posts: 405
Joined: Wed Apr 01, 2020 4:02 pm
Occupation: Moderator
Project Question: *
Project Due Date: *
Project Status: Not applicable

Re: Predicting Future water Quality with Machine Learning

Post by amyCC »

Following up with a bit of additional information in case you are still experiencing a problem.

1) Check to see if when you downloaded the file, there are extra letters AFTER the .ipnyb extension. If there are, please "rename" the file, removing those extra letters so that just .iynpb remains at the end. THEN,
2) Upload the .ipnyb file to Google Drive, as explained in the directions.
3) From within Google Drive, doubleclick the file to open it in colab. (If you just download the file and doubleclick on it from your downloads folder, you may find that it opens the code itself in a browser or otherwise suggests it can't be viewed.)

Please see if renaming the file helps resolve the issue.

Amy
Science Buddies
AdeyantLFC
Posts: 5
Joined: Sun Nov 03, 2024 8:42 am
Occupation: Student

Re: Predicting Future water Quality with Machine Learning

Post by AdeyantLFC »

Sorry, for the late reply, I've checked to see if the file upload had nothing after "ipynb" and it didn't. I've also downloaded the file correctly as stated in section 2. After doing this I still don't get a code to pop up as it says "no preview available". Have people had a recurring problem like this in the past?
amyCC
Site Admin
Posts: 405
Joined: Wed Apr 01, 2020 4:02 pm
Occupation: Moderator
Project Question: *
Project Due Date: *
Project Status: Not applicable

Re: Predicting Future water Quality with Machine Learning

Post by amyCC »

I just retested the downloadable file, and it works properly.

Please make sure that after downloading it to your computer you then upload it to Google drive. Doubleclicking that file from within Google drive should open it in Colab.

Per the project directions, you will be putting your data file and notebook in the same folder:
  • Within your Google Drive, click on ‘My Drive,’ then create a new folder and rename it “Water Quality.” Inside the folder, upload your ‘water_data.csv’ file.
  • Download the ‘dissolved_oxygen.ipynb’ file from Science Buddies and upload it to the same folder. This is the code you will need to process your data.
You can open the file from within Google colab to see if that helps with your problem.

Go to https://colab.research.google.com/ -- from the Open Notebook popup window, choose Google Drive. Navigate to the right folder and select the file and open it. (This has the same effect as opening it by doubleclicking the file in Drive.)
colab-open.png
colab-open.png (57.62 KiB) Viewed 10843 times


Amy
Science Buddies
AdeyantLFC
Posts: 5
Joined: Sun Nov 03, 2024 8:42 am
Occupation: Student

Re: Predicting Future water Quality with Machine Learning

Post by AdeyantLFC »

So I clicked the link and I've got the file set up on google drive in the "Water Quality" folder. However, when I went to google drive on colab it didn't show any items for some reason. I also noticed that the logo for the ipynb file I have in my google drive doesn't have a "Colab" logo.
Screenshot 2025-01-11 at 11.18.33 AM.png
Screenshot 2025-01-11 at 11.18.33 AM.png (120.13 KiB) Viewed 10830 times
amyCC
Site Admin
Posts: 405
Joined: Wed Apr 01, 2020 4:02 pm
Occupation: Moderator
Project Question: *
Project Due Date: *
Project Status: Not applicable

Re: Predicting Future water Quality with Machine Learning

Post by amyCC »

Is there any chance you are logged into colab with a different Google account than the drive you put your files on? (That would explain them not showing when you tried to open them in colab.)

Check the top right corner (in colab) to see what account is logged in. Log into the other one, if necessary. When I switch accounts this way, I often have to reload the collab page an extra time (for some reason). Then check and see if you see your files on drive when you try to open from within colab.

Amy
AdeyantLFC
Posts: 5
Joined: Sun Nov 03, 2024 8:42 am
Occupation: Student

Re: Predicting Future water Quality with Machine Learning

Post by AdeyantLFC »

Okay, I've fixed the problem. Turns out I had to upload the IPYNB file manually in cola. Thanks for your help!
AdeyantLFC
Posts: 5
Joined: Sun Nov 03, 2024 8:42 am
Occupation: Student

Re: Predicting Future water Quality with Machine Learning

Post by AdeyantLFC »

Hey, so I've tried to fix this issue a few times but it keeps occurring when I am trying to run Code Block 5B in Google Collab for the code related to this project. The issue is that it keeps stating, "Input y contains NaN". What is a proper way to fix this problem because I have followed the directions based off the video.
amyCC
Site Admin
Posts: 405
Joined: Wed Apr 01, 2020 4:02 pm
Occupation: Moderator
Project Question: *
Project Due Date: *
Project Status: Not applicable

Re: Predicting Future water Quality with Machine Learning

Post by amyCC »

Hi - I would first like to remind you that the written directions are available here: https://www.sciencebuddies.org/science- ... ved_oxygen

Please make sure you are following the written directions, not just the video.

The NaN error you are seeing sounds like you may have missing data in the .csv file you created. Look back at your file. Are there any columns that don't have data?

If so, you may need to choose another location. In step 3 of the project, it explains the data you need to gather and that you need to choose a location for which all of the fields listed is available:
You will now see yellow and black dots and triangles populating the map of the United States. The black locations mean that recent measurements are unavailable, so it is preferable that you choose a yellow point instead. Click on a location that interests you. You should get a pop-up showing the name of the area that you clicked on as well as its water quality data. Scroll down and make sure that the location you have chosen has all of the properties that we will be using for this project (see the list below). After verifying that the site has all of these properties, click on ‘Site page’ at the top of the pop-up window; otherwise pick another location:

When you check your .csv file, is that the problem?

Amy
Science Buddies
Post Reply

Return to “Grades 6-8: Life, Earth, and Social Sciences”