mirror of
https://github.com/shizand/statapp.git
synced 2024-12-23 04:02:58 +03:00
feat: добавлены весовые коэффициенты (#126)
This commit is contained in:
parent
babfd48ee1
commit
1900785502
@ -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,
|
||||
|
@ -28,7 +28,7 @@ class RegressionResultModel(ROTableModel):
|
||||
self._monomials = result.monomials
|
||||
|
||||
def getHorizontalHeader(self):
|
||||
return ['Коэффициент регрессии', 'Коэффициент значимости']
|
||||
return ['Коэффициент регрессии', 'Коэффициент значимости', 'Весовые коэффициенты']
|
||||
|
||||
def getVerticalHeader(self):
|
||||
return self._monomials
|
||||
|
Loading…
Reference in New Issue
Block a user