Page 1 of 1
Predicting Future Water Quality with Machine Learning
Posted: Sun Dec 01, 2024 7:33 pm
by SwrDes
Hi there! I am currently doing a project that utilizes decision trees and random forests, and I had a quick question. Can decision trees and random forests be used in iOS apps or apps in general? An example would be if the two types of machine learning were able to predict future water quality and their predictions were then displayed in an app. If so, how might it be accomplished? Thank you!
[Administrator note: project url for the machine learning project at Science Buddies:
https://www.sciencebuddies.org/science- ... ved_oxygen ]
Re: Predicting Future Water Quality with Machine Learning
Posted: Sat Dec 14, 2024 7:14 pm
by calixte
Hello!
Decision trees and random forests can be used in IOS. To do so you first train the model on your computer using data and machine learning tools like Python's scikit-learn. After training, you convert the model to a format that works on iOS using Appleās Core ML tool. Then, you add this model to your iOS app using Xcode and use it to make predictions. Good luck!
Re: Predicting Future Water Quality with Machine Learning
Posted: Sat Feb 01, 2025 2:18 pm
by SwrDes
Hi!
Thank you for the help! I had another quick question. According to the instructions on the project page, it seems like the training of the model is already accomplished without Python. Should I still use Python sci-kit or is there another way to directly export the results to my app?
Predicting Water Quality With Machine Learning
Posted: Sat Feb 15, 2025 5:31 pm
by SwrDes
Hi! So, I've downloaded the ipnyb, and am currently running it, but when I get to code block 4A is says that there is an error. The error says KeyError: "['Date', 'Average Dissolved Oxygen +4 weeks mg/l'] not found in axis". I am not able to solve this error and I was wondering if there is any way to fix this, as my final sheet does have those two properties.
Re: Predicting Future Water Quality with Machine Learning
Posted: Sun Feb 16, 2025 11:25 am
by amyCC
Can you take a screenshot of the output after running block 3B that shows the column names (showing that column name that is giving you an error).
I just ran through the notebook, and I'm not seeing an error with running 4A or 4B. So we need to look back at your data.
In step 1 of the directions, sub-step 10, you renamed all of the columns in the spreadsheet. Make sure you named it this way: Average Dissolved Oxygen +4 weeks mg/l and make sure that the location you pulled data for has data in the column.
Seeing a screenshot of your 3B will help.
(Also, remember that if you stopped and came back to your notebook at any point, you will need to run all the prior cells again.)
Amy
Science Buddies
Re: Predicting Future Water Quality with Machine Learning
Posted: Mon Feb 17, 2025 10:22 am
by SwrDes
Sure! Here is my code for 3B and 4A.
Re: Predicting Future Water Quality with Machine Learning
Posted: Mon Feb 17, 2025 11:12 am
by amyCC
Thank you or uploading the screenshots. The first column I see in your 3B screenshot says "Unnamed." That should be your Date column.
Go back to Section 1, step 7.... you should have renamed that column Date there:
Rename these columns in Row 1 as Date (column A), Time (column B), and Temperature (column C).
Please make that change and run the block again.
(It looks like you are missing the Average Dissolved Oxygen column that should show up in 3B. But please relabel the Date column and see what happens when you run the cell.)
Amy