Reputation: 1033
I have the following code which runs a simple Ridge regression:
for col in cols: #zscore normalization
df[col] = (df[col] - df[col].mean())/df[col].std(ddof=0)
y = df['SPXR_{}D'.format(horizon)] #my dependent variable (future market returns)
x = df[cols] #a bunch of variables that predict market returns
model = linear_model.Ridge(alpha=0.5) #ridge regression, guess & check based alpha
res = model.fit(x, y)
I have read that using the first half of my data to find an alpha is the easiest approach, however how is this possible?
Upvotes: 2
Views: 2964
Reputation: 4150
Let me point you in 2 possible directions.
1) Cross validation:
2) Bayesian approach:
Upvotes: 2