Every line of 'sklearn linear regression get coefficients' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
53 def coefficient_for_category(predictors, category): 54 predictor = [p for p in predictors if p.get('value') == category] 55 56 if not predictor: 57 return 0 58 59 return float(predictor[0].get('coefficient'))
84 def _calculate_coefficients(self): 85 return self._coefficients
138 @property 139 def coef_(self): 140 return self.clf_.coef_
1017 @property 1018 def coef_(self): 1019 """ 1020 Get the model's coefficients on the covariates. 1021 1022 Returns 1023 ------- 1024 coef_ : {(d,), (p, d)} nd array like 1025 The coefficients of the variables in the linear regression. If label y 1026 was p-dimensional, then the result is a matrix of coefficents, whose p-th 1027 row containts the coefficients corresponding to the p-th coordinate of the label. 1028 """ 1029 if self.fit_intercept: 1030 if self._n_out == 0: 1031 return self._param[1:] 1032 else: 1033 return self._param[1:].T 1034 else: 1035 if self._n_out == 0: 1036 return self._param 1037 else: 1038 return self._param.T
87 def calc_linear_regression(coeff, x): 88 result = 0 89 for i in range(1, len(coeff)): 90 result += x[i - 1] * coeff[i] 91 92 result += coeff[0] 93 return result