Python ML #03: Rainfall Prediction Using Linear Regression Model
HTML-код
- Опубликовано: 3 дек 2020
- In this video, you'll learn how to use linear regression model with the help of machine learning in Python to predict the rainfall in Austin, Texas since 2013 for a time span of 5 years [ 2013 - 2017 ].
Linear regression is a linear approach to modelling the relationship between a scalar response and one or more explanatory variables.
Website : bekbrace.netlify.app
Source code + CSV File: github.com/BekBrace/Machine.L...
DEV profile : dev.to/bekbrace
Github profile: github.com/BekBrace
Follow me on Instagram / Twitter: Bek Brace
Thank you, Very useful for me...
I’m glad, my friend 🙂
Hello sir, I'm trying to put together a scatter plot for the precipitation trend and precipitation vs. selected attributes, but I'm receiving an error [TypeError: unhashable type: 'numpy.ndarray'].
Could you please possibly assist me in figuring this out?
hello Bek Brace, can you explain more about the "input" please, what is it? why is it random? thanks!
Hi Kenneth.
So, the inp variable is used in this case because we need a sample input just to test the model - nothing more, and these are random values for a 2-D vector for each column in the dataset, checkout the dataset and you will see what I mean -
And ultimately, we will use the classifier ( variable clf to predict the rainfall based on our sample input :
>>> print('The precipitation in inches for the input is:', clf.predict(inp))
if you have more questions, just let me know - peace out
For your inp variable, shouldn't you have 16 inputs instead of 17? I am getting an error when predicting the precipitation
What the error report says ?
@@BekBrace When you imported the austin_clean.csv didn't you get an extra index column at the beginning ? That's why maybe you end up with 17 columns instead of 16
And this is the error I was getting: "ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 16 is different from 17)"
@@NandoRooster Thank you.
This is odd, because i didn't use matmul method but the array method instead which should create an array object
inp = np.array([[74], [60], [45], [67], [49], [43], [33], [45],
[57], [29.68], [10], [7], [2], [0], [20], [4], [31]])
They are 17 columns without the 0 index, in fact if you will take a look to the set you will find the numbers that i picked from 74 to 31 as a sample.
in the input data you have given 17 entries but only 16 are required as per the new final csv file. Why did you add an extra [0] in 14th place?
Unintentional, but If you will ignore the [0], you’ll get the same result
@@BekBrace but if we don't add that [0], an error occurs.
By any chance does your code predicts flood , if there is high rainfall??
No, but we can always train the model
Please what does it mean when tbs precipitation inches is 1.2
This means rainfall precipitation is 1.2 inches , precipitation is any product of the condensation of water vapor that falls under gravitational pull from cloud, in our case the rain 🌧️
Can I have a same dataset for Gujarat, India?
sure, check it out on Kaggle
Can you please explain this problem?
Q). you’ve implemented a regularized linear regression to identify whether it will rain or not. What steps will you take if your model continues to show large errors?
what do you mean ? like what if the model is overfitting the training data ?
@@BekBrace ok, 1) what if the model is overfitting?
2) What steps will you take if the above problem occurs due to underfitting?
why there is 1200 day from which we have to select , instead there should be index of 365 day because here we are predicting data of next year on the basis of past data ?
Exactly 💯
From where did you find the dataset? Please mention link.
Hello ! Of course, it's from Kaggle website, I'm sure you can find what you're looking for in their repos.
Link: www.kaggle.com/datasets?search=eeg
What to do if i want to use logistic regression
Hello Avinash!
The answer for your question requires a whole separate video, but I have another machine learning tutorial on the channel using logistic regression [ heart disease prediction tutorial #5 ]- maybe you can check it and see how you can modify the rainfall prediction mode to accommodate Logistic Regression -
@@BekBrace oh thanks i just want to confirm one more thing i run this code like a month ago and downloaded libraries but when i tried to run it today it is showing pd is not defined so do i need to install libraries again.
Check out first if the libraries are already installed or not using :
>>> pip freeze
Then check out what’s missing ..
Worst case scenario is you’re going to reinstall them all
@@BekBrace ohk thank you so much u been a great help
@@Avinash-er8tu welcome my friend
👍
I have one question in datasets.... Which is target value of the project .....which problem is solved by the project.... Explain it .....
You've got a long road to learn, son. And you have to say " PLEASE " if you ask someone for something.
@@BekBrace ok ... Please explain
Your Mouse cursor delay effect is very distracting.
Sorry to hear that
May god bless you the code is wrong
May God bless you're mistaken 😂