Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
Vorhersage der Verkehrslage CVH
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container 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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Frederic Aust
Vorhersage der Verkehrslage CVH
Commits
7ff4d7b7
Commit
7ff4d7b7
authored
4 years ago
by
Christoph Olberding
Browse files
Options
Downloads
Patches
Plain Diff
Update UI/UI.py
parent
0d0541ad
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
UI/UI.py
+5
-10
5 additions, 10 deletions
UI/UI.py
with
5 additions
and
10 deletions
UI/UI.py
+
5
−
10
View file @
7ff4d7b7
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 29 20:54:18 2021
@author: Christoph
"""
import
tkinter
as
tk
import
pickle
import
numpy
as
np
...
...
@@ -36,7 +30,8 @@ lsum.pack()
opt
=
tk
.
OptionMenu
(
app
,
variable
,
*
OptionList
)
#Drop-Down Menü
opt
.
config
(
width
=
90
,
font
=
(
'
Helvetica
'
,
32
))
opt
.
pack
()
ZielortID
=
[
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
]
Wochentag
=
[
0
,
0
,
0
,
0
,
0
,
0
,
0
]
def
berechne
():
now
=
datetime
.
now
()
# aktuelle Zeit
today
=
date
.
today
()
# aktuelles Datum
...
...
@@ -48,12 +43,12 @@ def berechne():
Jahr
=
current_date
[
6
:]
Monat
=
current_date
[
3
:
5
]
Tag
=
current_date
[
0
:
2
]
Wochentag
=
datetime
.
today
().
weekday
()
#Wochentag als Integer
Wochentag
[
datetime
.
today
().
weekday
()
]
=
1
#Wochentag als Integer
for
d
in
range
(
12
):
if
(
variable
.
get
()
==
OptionList
[
d
]):
ZielortID
=
d
+
2
ZielortID
[
d
]
=
1
loaded_model
=
pickle
.
load
(
open
(
'
model.sav
'
,
'
rb
'
))
#Lade den finalen Random Forest
x_test
=
np
.
array
([
ZielortID
,
Jahr
,
Monat
,
Tag
,
Wochentag
,
Stunde
,
Minute
]).
reshape
(
1
,
-
1
)
x_test
=
np
.
array
([
Jahr
,
Monat
,
Tag
,
Stunde
,
Minute
,
Wochentag
[
0
],
Wochentag
[
1
],
Wochentag
[
2
],
Wochentag
[
3
],
Wochentag
[
4
],
Wochentag
[
5
],
Wochentag
[
6
],
ZielortID
[
0
],
ZielortID
[
1
],
ZielortID
[
2
],
ZielortID
[
3
],
ZielortID
[
4
],
ZielortID
[
5
],
ZielortID
[
6
],
ZielortID
[
7
],
ZielortID
[
8
],
ZielortID
[
9
],
ZielortID
[
10
],
ZielortID
[
11
]
]).
reshape
(
1
,
-
1
)
result
=
loaded_model
.
predict
(
x_test
)
# Prüfe wie lange es mit den Parametern dauert
lsum
[
"
text
"
]
=
'
Sie benötigen:
'
+
str
(
int
(
result
/
60
))
+
'
Minuten
'
+
str
(
int
(
result
%
60
))
+
'
Sekunden
'
# ergänze die Zeit im Ergebnis-Label
#print(str(result)[1:3]+' Minuten '+str(result)[3:5]+' Sekunden')
...
...
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