def apply_ridge(self): if self.use_ridge: learner = linear.LinearRegressionLearner( name=self.name, ridgeLambda=self.ridge_lambda) else: learner = linear.LinearRegressionLearner(name=self.name) predictor = None if self.preprocessor: learner = self.preprocessor.wrapLearner(learner) self.error(0) if self.data is not None: try: predictor = learner(self.data) predictor.name = self.name except Exception, ex: self.error(0, "An error during learning: %r" % ex)
def apply(self): if self.reg_type == OWLinearRegression.OLS: learner = linear.LinearRegressionLearner() elif self.reg_type == OWLinearRegression.Ridge: learner = linear.RidgeRegressionLearner(alpha=self.ridgealpha) elif self.reg_type == OWLinearRegression.Lasso: learner = linear.RidgeRegressionLearner(alpha=self.lassoalpha) else: assert False learner.name = self.learner_name predictor = None if self.data is not None: predictor = learner(self.data) predictor.name = self.learner_name self.send("Learner", learner) self.send("Predictor", predictor)
import Orange from Orange.regression import linear from Orange.data import Table from Orange.evaluation import scoring, testing #data operations data = Table("auto-mpg.tab") #set up linear regressions ##regularizations Linear = linear.LinearRegressionLearner(preprocessors=None) Linear.name = "No regularization" Ridge = linear.RidgeRegressionLearner(alpha=0.0001, fit_intercept=True, normalize=False, copy_X=True, max_iter=None, tol=0.001, solver='auto', preprocessors=None) Ridge.name = "Ridge Regression(L2)" Lasso = linear.LassoRegressionLearner(alpha=1.0, fit_intercept=True, normalize=False, precompute=False, copy_X=True, max_iter=1000, tol=0.0001, warm_start=False, positive=False,
def setUp(self): self.learner = linear.LinearRegressionLearner(ridge_lambda=2)
def setUp(self): self.learner = linear.LinearRegressionLearner()