Category : regression

I have input data X_train with dimension (477 x 200) and y_train with length 477. I want to use a support vector machine regressor and I am doing grid search. param_grid = {‘kernel’: [‘poly’, ‘rbf’, ‘linear’,’sigmoid’], ‘degree’: [2,3,4,5], ‘C’:[0.01,0.1,0.3,0.5,0.7,1,1.5,2,5,10]} grid = GridSearchCV(estimator=regressor_2, param_grid=param_grid, scoring=’neg_root_mean_squared_error’, n_jobs=1, cv=3, verbose = 1) grid_result = grid.fit(X_train, y_train)) I get ..

Read more

I have 2 tables. Table A has 105 rows: bbgid dt weekly_price_per_stock weekly_pct_change 0 BBG000J9HHN8 2018-12-31 13562.328 0.000000 1 BBG000J9HHN8 2019-01-07 34717.536 1.559851 2 BBG000J9HHN8 2019-01-14 28300.218 -0.184844 3 BBG000J9HHN8 2019-01-21 35370.134 0.249818 4 BBG000J9HHN8 2019-01-28 36104.512 0.020763 … … … … … 100 BBG000J9HHN8 2020-11-30 62065.827 0.278765 101 BBG000J9HHN8 2020-12-07 62145.445 0.001283 102 BBG000J9HHN8 ..

Read more

I’m trying to usde rolling OLS to make a trend on a moving windows frame. it seems theat it’s doing someting but it’s out of scale so I’m missing something. the data is a dataframe of float value (‘Close’) over datetime. any idea what’s the problem? here’s the code: import datetime import matplotlib.pyplot as plt ..

Read more

Let’s assume that I have defined a regressor like that tree = MultiOutputRegressor(DecisionTreeRegressor(random_state=0)) tree.fit(X_train, y_train) And now I want to do a grid cross validation to optimize the parameter ccp_alpha (I don’t know if it is the best parameter to optimize but I take it as example). Thus I do it like that: alphas = ..

Read more

I am trying to create a loop for regression over several dependent variables. For example, import statsmodels.api as sm import statsmodels.formula.api as smf list = [‘A’, ‘B’, ‘C’] for i in list: result = smf.glm(formula = ‘i ~ x1+ x2 + x3′, data=data) This code doesn’t work and I want to save the results for ..

Read more

I watned to predict the income using text data(description) as a predictor. This is how my dataframe looks like: c_description 641 fierce roman commander marcus vinicius become … 645 melancholy poet reflect three woman love lose … 644 disturb blanche dubois move sister new orleans… 643 lonely woman recall first love thirteen year p… 642 ..

Read more