Get fitted coefficient of linear regression equation

0 votes

I have a dataset with predicted and observed data. The equation that predicts the data is given by: y = AfT \sqrt{gh}

With Af = constant (now at 1.35), T = wave period, g = gravitation 9.81, h = wave height.

Id like to use linear regression to find the best fitted coefficient (Af in the equation), so that the predicted value is closer to the observed data.

I now have Af = 1.35 (from suggestion in the literature) results in r^2 = 0.5676 Ideally, I`d use python to find the best fitted coefficient for my data.

import statsmodels.formula.api as smf
from sklearn.linear_model import LogisticRegression
from sklearn.datasets import load_iris

X = np.array([11.52, 11.559, 12.31, 16.46, 11.84, 7.38, 9.99, 16.72, 11.617, 11.77, 6.48, 9.035, 12.87, 11.18, 6.75])
y = np.array([25.51658407, 24.61306145, 19.4007494, 24.85111923, 25.99397106, 14.30284824, 17.69451713, 27.37460301, 22.23326366, 18.44905152, 10.28001306, 10.68681843, 28.85399089, 14.02840557, 18.41941787]).reshape((-1, 1))

X, y = load_iris(return_X_y=True)
clf = LogisticRegression(random_state=0).fit(X, y)

print(clf.coef_, clf.intercept_)

X = observed/measured values in the field, y = the predicted values of X using the equation

I have difficulties incorporating the actual equation and finding the best fit for Af.

Apr 11, 2022 in Machine Learning by Dev
• 6,000 points
734 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Machine Learning

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

What is the difference between Coefficient of Regression and Elasticity

It is questionable. I'll simplify the model ...READ MORE

answered Apr 4, 2022 in Machine Learning by Nandini
• 5,480 points
788 views
0 votes
1 answer
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 4,467 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP