def _generate_pfa_regressor(result, indep_vars, featurizer): # Create mock SGDRegressor for sklearn_to_pfa estimator = SGDRegressor() estimator.intercept_ = [result['intercept']] # NOTE: linearly dependent columns will be assigned 0 estimator.coef_ = [ result.get(c, {'coef': 0.})['coef'] for c in featurizer.columns if c != 'intercept' ] types = [(var['name'], var['type']['name']) for var in indep_vars] return sklearn_to_pfa(estimator, types, featurizer.generate_pretty_pfa())
def get_SGDRegressor(self): sr = SGDRegressor(fit_intercept = False) sr.coef_ = self.coef_ sr.intercept_ = 0. self.t_ = 0 return sr