Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WS-23-SAS-02
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michael Mutote
WS-23-SAS-02
Commits
d8655b22
Commit
d8655b22
authored
1 year ago
by
Michael Mutote
Browse files
Options
Downloads
Patches
Plain Diff
Merge remote-tracking branch 'origin/main'
# Conflicts: DisplayWindow.py
parent
47131af3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
DisplayWindow.py
+25
-51
25 additions, 51 deletions
DisplayWindow.py
RegressionModel.py
+5
-2
5 additions, 2 deletions
RegressionModel.py
with
30 additions
and
53 deletions
DisplayWindow.py
+
25
−
51
View file @
d8655b22
import
sys
from
PyQt6.QtCore
import
Qt
import
RegressionModel
from
pyqtgraph
import
PlotWidget
,
plot
import
pyqtgraph
as
pg
from
PyQt6.QtWidgets
import
(
QApplication
,
QMainWindow
,
QWidget
,
QVBoxLayout
,
QHBoxLayout
,
QGridLayout
,
QLabel
,
QPushButton
,
QSlider
,
QDateTimeEdit
,
QLineEdit
,
QComboBox
,
QDateEdit
,
QTabWidget
)
QLineEdit
,
QComboBox
,
QDateEdit
,
QTabWidget
,
QCheckBox
)
from
PyQt6.QtGui
import
QPalette
,
QColor
,
QIcon
...
...
@@ -76,7 +79,7 @@ class MainWindow(QMainWindow):
def
update_values
(
self
):
menu_items
=
{
0
:
'
cut
'
,
1
:
'
color
'
,
2
:
'
clarity
'
,
3
:
'
carat
'
,
4
:
'
depth
'
,
5
:
'
table
'
,
6
:
'
x
'
,
7
:
'
y
'
,
8
:
'
z
'
}
for
key
,
value
in
menu_items
.
items
():
for
key
,
value
in
menu_items
.
items
():
print
(
key
)
if
key
<
3
:
RegressionModel
.
GUI_selections
[
value
]
=
self
.
input_fields
[
key
].
currentText
()
...
...
@@ -91,55 +94,26 @@ class Advanced(QMainWindow):
super
().
__init__
()
self
.
setWindowIcon
(
QIcon
(
"
icon.ico
"
))
self
.
setMinimumSize
(
720
,
640
)
#
# # Create a central widget
# central_widget = QWidget(self)
# self.setCentralWidget(central_widget)
#
# # Create a grid layout and set it to the central widget
# grid_layout = QGridLayout(central_widget)
#
# # Create labels and input fields
# self.labels_text = ['Date', 'Airline', 'Destination', 'Model Start Year']
# self.input_fields = [QDateEdit(self), QComboBox(self), QComboBox(self), QComboBox(self)]
# self.input_fields[1].addItems(RegressionModel.airlines)
# self.input_fields[2].addItems(RegressionModel.destinations)
# self.input_fields[3].addItems(list(map(str, RegressionModel.model_years)))
#
# # Add labels and input fields to the grid layout
# for i in range(4):
# label = QLabel(self.labels_text[i], self)
# grid_layout.addWidget(label, 0, i)
# grid_layout.addWidget(self.input_fields[i], 1, i)
#
# # Connect signals
# for i in range(len(self.input_fields)):
# if i == 0:
# self.input_fields[i].dateChanged.connect(self.update_values)
# else:
# self.input_fields[i].currentTextChanged.connect(self.update_values)
#
# # Create a plot widget
# graphWidget = pg.PlotWidget(self)
# graphWidget.setBackground('w')
# graphWidget.plot(RegressionModel.selected_day, RegressionModel.delay)
#
# # Add the plot widget to the grid layout
# grid_layout.addWidget(graphWidget, 2, 0, 1, 4)
# grid_layout.addWidget(QLabel("EXPECTED DELAY: ", self), 3, 0, 1, 1)
# # Remember to add the delay value here
#
# self.setWindowTitle('Assistance Systems')
# self.show()
#
# def update_values(self):
# menu_items = {0: "date", 1: "airline", 2: "destination", 3: "years to model"}
# sender = self.sender()
# for i in range(4):
# if sender == self.input_fields[i]:
# RegressionModel.GUI_selections[menu_items[i]] = sender.currentText() if i != 0 \
# else sender.dateTime()
# print(RegressionModel.GUI_selections[menu_items[i]])
central_widget
=
QWidget
(
self
)
self
.
setCentralWidget
(
central_widget
)
# Create a grid layout and set it to the central widget
grid_layout
=
QGridLayout
(
central_widget
)
self
.
check_labels
=
[
'
Cut
'
,
'
Colour
'
,
'
Clarity
'
,
'
Carat
'
,
'
Depth
'
,
'
Table
'
,
'
X
'
,
'
Y
'
,
'
Z
'
]
self
.
checkboxes
=
[]
grid_layout
.
addWidget
(
QLabel
(
"
select features to include in Modelling
"
),
0
,
0
)
for
i
,
label
in
enumerate
(
self
.
check_labels
):
checkbox
=
QCheckBox
(
label
,
self
)
checkbox
.
setChecked
(
True
)
checkbox
.
stateChanged
.
connect
(
self
.
handle_checkbox_state
)
# Connect signal
grid_layout
.
addWidget
(
checkbox
,
i
,
1
)
self
.
checkboxes
.
append
(
checkbox
)
# Store checkboxes in the list
def
handle_checkbox_state
(
self
):
for
i
,
checkbox
in
enumerate
(
self
.
checkboxes
):
state
=
checkbox
.
checkState
()
RegressionModel
.
Advanced_selections
[
checkbox
.
text
()]
=
(
state
==
Qt
.
CheckState
.
Checked
)
app
=
QApplication
(
sys
.
argv
)
...
...
This diff is collapsed.
Click to expand it.
RegressionModel.py
+
5
−
2
View file @
d8655b22
...
...
@@ -9,7 +9,10 @@ diamonds = pd.read_csv('diamonds.csv')
cut
=
list
(
diamonds
[
"
cut
"
].
unique
())
colors
=
list
(
diamonds
[
"
color
"
].
unique
())
clarity
=
list
(
diamonds
[
"
clarity
"
].
unique
())
GUI_selections
=
{}
GUI_selections
=
{}
# user inputs
Advanced_selections
=
{}
price_caret
=
[]
price
=
0
price
=
98
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment