Menu

Training the KNN Regression Model

Training the KNN Regression Model

Train the model using the optimal value of K.

Code

model = KNeighborsRegressor(
n_neighbors=grid.best_params_['n_neighbors']
)
model.fit(
X_train,
Y_train
)

Explanation

The KNN Regression model learns relationships between the engineered features and stock closing prices.