mirror of
https://github.com/shizand/statapp.git
synced 2024-12-23 04:02:58 +03:00
parent
7cbb93e37c
commit
bb1b2f1ec5
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
@ -17,7 +17,11 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
import numpy as np
|
||||
from PySide2.QtWidgets import QDialog, QHeaderView
|
||||
import matplotlib
|
||||
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg
|
||||
from matplotlib.figure import Figure
|
||||
|
||||
from statapp.calculations import prediction
|
||||
from statapp.mathtex_header_view import MathTexHeaderView
|
||||
@ -27,6 +31,15 @@ from statapp.ui.ui_polynom_window import Ui_PolynomWindow
|
||||
from statapp.utils import addIcon, FloatDelegate
|
||||
|
||||
|
||||
matplotlib.use('Qt5Agg')
|
||||
|
||||
class MplCanvas(FigureCanvasQTAgg):
|
||||
|
||||
def __init__(self, parent=None, width=5, height=4, dpi=100):
|
||||
fig = Figure(figsize=(width, height), dpi=dpi)
|
||||
self.axes = fig.add_subplot()
|
||||
super().__init__(fig)
|
||||
|
||||
class PolynomWindow(QDialog):
|
||||
def __init__(self, data, result, windowTitle):
|
||||
super().__init__()
|
||||
@ -47,7 +60,30 @@ class PolynomWindow(QDialog):
|
||||
self.ui.fStatisticValueLabel.setText(str(result.fStatistic))
|
||||
self.ui.rSquaredValueLabel.setText(str(result.scaledResidualVariance))
|
||||
|
||||
self.predictionModel = PreditionTableModel(prediction(data, result))
|
||||
predictionResult = prediction(data, result)
|
||||
|
||||
self.predictionModel = PreditionTableModel(predictionResult)
|
||||
self.ui.predictionTableView.setModel(self.predictionModel)
|
||||
header = self.ui.predictionTableView.horizontalHeader()
|
||||
header.setSectionResizeMode(QHeaderView.ResizeMode.Stretch)
|
||||
|
||||
sc = MplCanvas(self, width=5, height=4, dpi=100)
|
||||
|
||||
xAxes = np.array(range(len(data[:, 0])))
|
||||
|
||||
realY = predictionResult[:, 0]
|
||||
calculatedY = predictionResult[:, 1]
|
||||
|
||||
print(xAxes)
|
||||
print(realY)
|
||||
print(calculatedY)
|
||||
|
||||
sc.axes.scatter(xAxes, realY)
|
||||
|
||||
# xnew = np.linspace(xAxes.min(), xAxes.max(), 300)
|
||||
# gfg = scipy.interpolate.make_interp_spline(xAxes, y, k=3)
|
||||
# y_new = gfg(xnew)
|
||||
|
||||
sc.axes.plot(xAxes, calculatedY)
|
||||
|
||||
self.ui.plotContainer.addWidget(sc)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
@ -26,6 +26,7 @@ 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.polynoms.polynom_window import MplCanvas
|
||||
from statapp.ui.ui_polynom_window import Ui_PolynomWindow
|
||||
from statapp.utils import addIcon
|
||||
|
||||
@ -41,11 +42,20 @@ class TransformPolynomWindow(QDialog):
|
||||
self.data = data
|
||||
result = linearPolynom(data)
|
||||
|
||||
self.predictionModel = PreditionTableModel(prediction(data, result))
|
||||
predictionResult = prediction(data, result)
|
||||
self.predictionModel = PreditionTableModel(predictionResult)
|
||||
self.ui.predictionTableView.setModel(self.predictionModel)
|
||||
header = self.ui.predictionTableView.horizontalHeader()
|
||||
header.setSectionResizeMode(QHeaderView.ResizeMode.Stretch)
|
||||
|
||||
self.sc = MplCanvas(self, width=5, height=4, dpi=100)
|
||||
xAxes = np.array(range(len(data[:, 0])))
|
||||
realY = predictionResult[:, 0]
|
||||
calculatedY = predictionResult[:, 1]
|
||||
self.sc.axes.scatter(xAxes, realY)
|
||||
self.sc.axes.plot(xAxes, calculatedY)
|
||||
self.ui.plotContainer.addWidget(self.sc)
|
||||
|
||||
# Создание столбца из нулей
|
||||
zeroCol = np.zeros((result.paramsAndImportance.shape[0], 1))
|
||||
# Добавление столбца к исходному массиву
|
||||
@ -84,7 +94,17 @@ class TransformPolynomWindow(QDialog):
|
||||
|
||||
def rebuildData(self, data):
|
||||
result = linearPolynom(data)
|
||||
self.predictionModel.updateAllData(prediction(data, result))
|
||||
predictionResult = prediction(data, result)
|
||||
self.predictionModel.updateAllData(predictionResult)
|
||||
self.ui.plotContainer.removeWidget(self.sc)
|
||||
self.sc = MplCanvas(self, width=5, height=4, dpi=100)
|
||||
xAxes = np.array(range(len(data[:, 0])))
|
||||
realY = predictionResult[:, 0]
|
||||
calculatedY = predictionResult[:, 1]
|
||||
self.sc.axes.scatter(xAxes, realY)
|
||||
self.sc.axes.plot(xAxes, calculatedY)
|
||||
self.ui.plotContainer.addWidget(self.sc)
|
||||
|
||||
zeroCol = np.zeros((result.paramsAndImportance.shape[0], 1))
|
||||
result.paramsAndImportance = np.column_stack((zeroCol, result.paramsAndImportance))
|
||||
self.model.updateAllData(result)
|
||||
|
@ -120,6 +120,16 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
<string>График</string>
|
||||
</attribute>
|
||||
<layout class="QGridLayout" name="gridLayout_5">
|
||||
<item row="0" column="0">
|
||||
<layout class="QGridLayout" name="plotContainer"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
2
statapp/ui/ui_about_window.py
generated
2
statapp/ui/ui_about_window.py
generated
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
2
statapp/ui/ui_correlation_analysis_window.py
generated
2
statapp/ui/ui_correlation_analysis_window.py
generated
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
2
statapp/ui/ui_generate_factor_window.py
generated
2
statapp/ui/ui_generate_factor_window.py
generated
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
2
statapp/ui/ui_generate_window.py
generated
2
statapp/ui/ui_generate_window.py
generated
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
2
statapp/ui/ui_main_window.py
generated
2
statapp/ui/ui_main_window.py
generated
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
13
statapp/ui/ui_polynom_window.py
generated
13
statapp/ui/ui_polynom_window.py
generated
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
@ -117,6 +117,16 @@ class Ui_PolynomWindow(object):
|
||||
self.gridLayout_4.addWidget(self.predictionTableView, 0, 0, 1, 1)
|
||||
|
||||
self.tabWidget.addTab(self.prediction, "")
|
||||
self.tab = QWidget()
|
||||
self.tab.setObjectName(u"tab")
|
||||
self.gridLayout_5 = QGridLayout(self.tab)
|
||||
self.gridLayout_5.setObjectName(u"gridLayout_5")
|
||||
self.plotContainer = QGridLayout()
|
||||
self.plotContainer.setObjectName(u"plotContainer")
|
||||
|
||||
self.gridLayout_5.addLayout(self.plotContainer, 0, 0, 1, 1)
|
||||
|
||||
self.tabWidget.addTab(self.tab, "")
|
||||
|
||||
self.gridLayout_2.addWidget(self.tabWidget, 0, 6, 1, 1)
|
||||
|
||||
@ -141,4 +151,5 @@ class Ui_PolynomWindow(object):
|
||||
self.rSquaredValueLabel.setText(QCoreApplication.translate("PolynomWindow", u"undefined", None))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.model), QCoreApplication.translate("PolynomWindow", u"\u041c\u043e\u0434\u0435\u043b\u044c", None))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.prediction), QCoreApplication.translate("PolynomWindow", u"\u041f\u0440\u043e\u0433\u043d\u043e\u0437", None))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QCoreApplication.translate("PolynomWindow", u"\u0413\u0440\u0430\u0444\u0438\u043a", None))
|
||||
# retranslateUi
|
||||
|
2
statapp/ui/ui_variance_analysis_window.py
generated
2
statapp/ui/ui_variance_analysis_window.py
generated
@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2023 Maxim Slipenko, Eugene Lazurenko.
|
||||
# Copyright (c) 2024 Maxim Slipenko, Eugene Lazurenko.
|
||||
#
|
||||
# This file is part of Statapp
|
||||
# (see https://github.com/shizand/statapp).
|
||||
|
Loading…
Reference in New Issue
Block a user