feat: добавлен "Прогноз" (#92)

Closes #85
This commit is contained in:
2024-01-02 17:22:59 +03:00
committed by GitHub
parent 51fc413fca
commit 8ea3cffa7e
12 changed files with 236 additions and 315 deletions

View File

@@ -24,4 +24,4 @@ from statapp.polynoms.polynom_window import PolynomWindow
class LinearPolynomWindow(PolynomWindow):
def __init__(self, data):
result = linearPolynom(data)
super().__init__(result, "Линейный полином")
super().__init__(data, result, "Линейный полином")

View File

@@ -18,14 +18,17 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from PySide2.QtWidgets import QDialog, QHeaderView
from statapp.calculations import prediction
from statapp.mathtex_header_view import MathTexHeaderView
from statapp.models.prediction_table_model import PreditionTableModel
from statapp.models.regression_result_model import RegressionResultModel
from statapp.ui.ui_polynom_window import Ui_PolynomWindow
from statapp.utils import addIcon, FloatDelegate
class PolynomWindow(QDialog):
def __init__(self, result, windowTitle):
def __init__(self, data, result, windowTitle):
super().__init__()
self.ui = Ui_PolynomWindow()
self.ui.setupUi(self)
@@ -43,3 +46,8 @@ class PolynomWindow(QDialog):
self.ui.scaledResidualVarianceValueLabel.setText(str(result.scaledResidualVariance))
self.ui.fStatisticValueLabel.setText(str(result.fStatistic))
self.ui.rSquaredValueLabel.setText(str(result.scaledResidualVariance))
self.predictionModel = PreditionTableModel(prediction(data, result))
self.ui.predictionTableView.setModel(self.predictionModel)
header = self.ui.predictionTableView.horizontalHeader()
header.setSectionResizeMode(QHeaderView.ResizeMode.Stretch)

View File

@@ -24,4 +24,4 @@ from statapp.polynoms.polynom_window import PolynomWindow
class SquaredPolynomWindow(PolynomWindow):
def __init__(self, data):
result = squaredPolynom(data)
super().__init__(result, "Квадратичный полином")
super().__init__(data, result, "Квадратичный полином")

View File

@@ -21,11 +21,12 @@ import numpy as np
from PySide2.QtCore import Qt
from PySide2.QtWidgets import QDialog, QHeaderView
from statapp.calculations import linearPolynom
from statapp.calculations import linearPolynom, prediction
from statapp.combo_delegate import ComboDelegate
from statapp.mathtex_header_view import MathTexHeaderView
from statapp.models.prediction_table_model import PreditionTableModel
from statapp.models.transform_polynom_model import TransformPolynomModel, TRANSFORMS
from statapp.ui.ui_transform_polynom_window import Ui_PolynomWindow
from statapp.ui.ui_polynom_window import Ui_PolynomWindow
from statapp.utils import addIcon
@@ -40,6 +41,11 @@ class TransformPolynomWindow(QDialog):
self.data = data
result = linearPolynom(data)
self.predictionModel = PreditionTableModel(prediction(data, result))
self.ui.predictionTableView.setModel(self.predictionModel)
header = self.ui.predictionTableView.horizontalHeader()
header.setSectionResizeMode(QHeaderView.ResizeMode.Stretch)
# Создание столбца из нулей
zeroCol = np.zeros((result.paramsAndImportance.shape[0], 1))
# Добавление столбца к исходному массиву
@@ -78,6 +84,7 @@ class TransformPolynomWindow(QDialog):
def rebuildData(self, data):
result = linearPolynom(data)
self.predictionModel.updateAllData(prediction(data, result))
zeroCol = np.zeros((result.paramsAndImportance.shape[0], 1))
result.paramsAndImportance = np.column_stack((zeroCol, result.paramsAndImportance))
self.model.updateAllData(result)