Create and fit a Multiplicative linear regression using Python/Sklearn -
i'm using python 2.7 , scikit-learn fit dataset using multiplicate linear regression, different terms multiplied instead of added in sklearn.linear_models.ridge
.
so instead of
y = c1 * x1 + c2 * x2 + c3 * x3 + ...
we need
y = c1 * x1 * c2 * x2 * c3 * x3...
can enable python , sklearn fit , predict such multiplicative/hedonic regression model?
i think should able regular linear regression manipulating input data set (data matrix).
the regression y ~ c1 * x1 * c2 * x2 *... equivalent y ~ k * (x1 * x2 *...) k constant
so if multiply of values in design matrix together, regress on that, think should able this.
i.e. if data matrix, x, 4 x 1000 features x1, x2, x3, , x4, use pre-processing step create new matrix x_new, 1 x 1000 single column equals x1 * x2 * x3 * x4, fit y ~ x_new (clf = linearregression(), clf.fit(x_new,y))
Comments
Post a Comment