python - How to pass values to a trained Regressor Function from a Javascript front end? -


i trained sgdregressor on dataset 3756 rows. returned alpha value want use. want output prediction based on new set of values received javascript front end. includes categorical data need 1 hot encoding. want know how pass values trained regressor module , generate prediction based on it.

def rmse_cv(model):     rmse = np.sqrt(-cross_val_score(model, x_train, y, scoring="neg_mean_squared_error", cv=5))     return(rmse)   alphas = [0.00005, 0.00015, 0.00045, 0.0135] mv_sgd = [rmse_cv(sgdregressor(alpha = alpha)).mean()          alpha in alphas] 

typically use .fit() , .predict() methods, assuming you're using sklearn. create predictor object this:

from sklearn import linear_model  clf = linear_model.sgdregressor() clf.fit(x, y) 

then when new value, javascript, use predict.method

prediction = clf.predict(newcase) 

there many ways value javascript, mentioned, django may start.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -