diff --git a/statapp/calculations.py b/statapp/calculations.py index 8c1c759..4359ca4 100644 --- a/statapp/calculations.py +++ b/statapp/calculations.py @@ -132,8 +132,11 @@ def _calculateStatistics(y, x, xPoly, predictions, model, polyFeatures): ) # Заменяем пробелы на звездочки для представления умножения в названиях мономов monomials = [monomial.replace(' ', '*') for monomial in monomials] + weightsCoef = np.concatenate((np.array([0]), tStats[1:] / np.sum(tStats[1:]))) # Возвращаем рассчитанные статистики и названия мономов - return params, tStats, residualVariance, scaledResidualVariance, rSquared, fStatistic, monomials + return (params, tStats, weightsCoef, + residualVariance, scaledResidualVariance, + rSquared, fStatistic, monomials) @@ -142,7 +145,7 @@ def _regressionAnalysis(data, degree): data, degree ) model, predictions = _trainModelAndPredict(y, xPoly) - (params, tStats, residualVariance, + (params, tStats, weightsCoef, residualVariance, scaledResidualVariance, rSquared, fStatistic, monomials) = ( _calculateStatistics( y, @@ -154,7 +157,7 @@ def _regressionAnalysis(data, degree): )) return RegressionResult( - np.vstack((params, tStats)).T, + np.vstack((params, tStats, weightsCoef)).T, residualVariance, scaledResidualVariance, rSquared, diff --git a/statapp/models/regression_result_model.py b/statapp/models/regression_result_model.py index 059e6ea..17af473 100644 --- a/statapp/models/regression_result_model.py +++ b/statapp/models/regression_result_model.py @@ -28,7 +28,7 @@ class RegressionResultModel(ROTableModel): self._monomials = result.monomials def getHorizontalHeader(self): - return ['Коэффициент регрессии', 'Коэффициент значимости'] + return ['Коэффициент регрессии', 'Коэффициент значимости', 'Весовые коэффициенты'] def getVerticalHeader(self): return self._monomials