Я использую следующий код для нелинейной регрессии, и я получаю коэффициенты перехвата и 20. Как интерпретировать эти коэффициенты, чтобы иметь возможность построить формулу y = перехват + коэффициент*feat_a + .....? < /P>
data = pd.read_csv("data.csv")
# Step 2: Preprocess the data
X = data[['feat_a', 'feat_b', 'feat_c', 'feat_d', 'feat_e' ]] # Independent variables including blue (b)
y = data['Y']
#splitting Train and Test
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.15, random_state=101)
# Dependent variable
# Step 3: Fit a polynomial regression model
degree = 2 # Adjust the degree of the polynomial as needed
poly_features = PolynomialFeatures(degree=degree, include_bias=False)
X_poly = poly_features.fit_transform(X_train)
model = LinearRegression()
model.fit(X_poly, y_train)
# Step 4: Evaluate the model (optional)
# Step 5: Extract the formula and parameters
intercept = model.intercept_
coefficients = model.coef_
print("coeff size{}".format(len(coefficients)))
print(coefficients)
Подробнее здесь: https://stackoverflow.com/questions/783 ... ikit-learn
Как интерпретировать коэффициент нелинейной регрессии в Scikit Learn? ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение