Question

I want to calculate the amount of rainfall today in mm.So I want to know first whether is Linear Regression or Logistic Regression problem and how to calculate if i have datasets with some attributes with large no. of instances.
And how to know when to use feature scaling & how my program effects if i don't use feature scaling where it is neccessary.
Can I have java code of feature scaling.

Was it helpful?

Solution

If you are calculating the amount of rainfall today then you should go for Linear Regression which will best suits this problem.
Since amount belongs to R(real) then it is a concrete value, if you have classification especially a binary classification then you must go with Logistic Regression.
suppose there are 6 attributes in calculating the amount of rainfall today then your model must be:-

y = w(0)+x(1)w(1)+x(2)w(2)+x(3)w(3)+x(4)w(4)+x(5)w(5)+x(6)w(6)
y is amount of rainfall you want to predict.
Where x(1)...x(6) are attributes and w(0)...w(6) what you have to calculate.

Then you should a loss function which you have reduce:-


Now you want to calculate w(0)...w(6).
Now use gradient descent in it.
enter image description here
//Actually i donot have any image of gradient descent but i can make you understand from this.
theta(j) is w(j) and alpha is learning rate. And E is J(theta) ,t(p) is given value where y(p) is predictive value which is original y.

And feature scaling is done when data is too sparse this can be done dividing all elements by maximum element.This is done to normalize the independent data.So first feature selection then scaling.
More about Linear regression.
Why logistic regression cannot be applied here?
Because in logistic regression we get s-shaped curved which best suits for binary classification .
Above 0.5 take 1 or true or below 0.5 take 0 or false. enter image description here
Hope this is useful to you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top