Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MEML
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Fabian Poker
MEML
Commits
7dfc30a8
Commit
7dfc30a8
authored
1 year ago
by
Simon Adick
Browse files
Options
Downloads
Patches
Plain Diff
feat: In der Übersicht den Grenzwert ergänzt
parent
f3153f91
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
aufgaben/p5/apply_pla.py
+6
-11
6 additions, 11 deletions
aufgaben/p5/apply_pla.py
aufgaben/p5/draw_results.ipynb
+14
-7
14 additions, 7 deletions
aufgaben/p5/draw_results.ipynb
with
20 additions
and
18 deletions
aufgaben/p5/apply_pla.py
+
6
−
11
View file @
7dfc30a8
import
math
import
random
import
numpy
from
algorithm.pla.perceptron
import
Perceptron
from
algorithm.pla.perceptron_learning_algorithm
import
train
from
algorithm.pla.transfer_functions
import
normalized_tanh
from
aufgaben.p4.binary_classification
import
binary_classification_feature
from
aufgaben.p6.error_rate
import
ErrorRate
...
...
@@ -32,23 +30,20 @@ def apply_pla():
threshold
=
0.5
perceptron
=
Perceptron
(
weights
,
threshold
,
numpy
.
sign
)
# Trainiere das Perzeptron
train
(
perceptron
,
training_data
,
300
,
0.1
)
result_joggen
=
[]
result_kniebeuge
=
[]
# Vergleiche alle Ergebnisse mit der erwarteten Klasse
fehlerrate
=
ErrorRate
()
for
features
,
correct_class
in
training_data
:
result
=
perceptron
.
classify
(
features
)
fehlerrate
.
evaluate
(
correct_class
,
result
)
print
(
"
Fehlerrate:
"
+
fehlerrate
.
error_rate
())
if
result
==
CLASS_KNIEBEUGE
:
result_kniebeuge
.
append
(
features
[
0
])
else
:
result_joggen
.
append
(
features
[
0
])
# Berechne den Grenzwert, ab wann ein Feature anders eingeordnet wird
grenzwert
=
-
perceptron
.
weights
[
0
]
/
perceptron
.
weights
[
1
]
print
(
fehlerrate
.
error_rate
())
return
result_joggen
,
result_kniebeuge
return
joggen_feature
,
kniebeuge_feature
,
grenzwert
if
__name__
==
'
__main__
'
:
...
...
This diff is collapsed.
Click to expand it.
aufgaben/p5/draw_results.ipynb
+
14
−
7
View file @
7dfc30a8
...
...
@@ -2,15 +2,22 @@
"cells": [
{
"cell_type": "code",
"execution_count":
2
,
"execution_count":
1
,
"metadata": {
"collapsed": true,
"ExecuteTime": {
"start_time": "2023-05-08T12:
14:51.676509
Z",
"end_time": "2023-05-08T12:
15:27.98764
7Z"
"start_time": "2023-05-08T12:
39:32.036232
Z",
"end_time": "2023-05-08T12:
39:34.56363
7Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.0\n"
]
},
{
"data": {
"text/plain": "<IPython.core.display.Javascript object>",
...
...
@@ -22,7 +29,7 @@
{
"data": {
"text/plain": "<IPython.core.display.HTML object>",
"text/html": "<div id='
01f9591f-0f28-4bca-9e3b-96d356224e68
'></div>"
"text/html": "<div id='
34b44e73-7218-4dd4-84df-b6a1ee280f7a
'></div>"
},
"metadata": {},
"output_type": "display_data"
...
...
@@ -45,14 +52,14 @@
},
{
"cell_type": "code",
"execution_count":
2
,
"execution_count":
1
,
"outputs": [],
"source": [],
"metadata": {
"collapsed": false,
"ExecuteTime": {
"start_time": "2023-05-08T12:
15:27.98764
7Z",
"end_time": "2023-05-08T12:
15:28.003270
Z"
"start_time": "2023-05-08T12:
39:34.56363
7Z",
"end_time": "2023-05-08T12:
39:34.579637
Z"
}
}
}
...
...
%% Cell type:code id: tags:
```
python
from
aufgaben.p5.apply_pla
import
apply_pla
%
matplotlib
notebook
import
matplotlib.pyplot
as
plotter
joggen
,
kniebeuge
,
grenzwert
=
apply_pla
()
plotter
.
scatter
(
joggen
,
[
0
]
*
len
(
joggen
),
label
=
"
Joggen
"
)
plotter
.
scatter
(
kniebeuge
,
[
0
]
*
len
(
kniebeuge
),
label
=
"
Kniebeuge
"
)
plotter
.
scatter
(
grenzwert
,
[
0
],
label
=
"
Grenzwert
"
)
plotter
.
legend
()
plotter
.
show
()
```
%% Output
0.0
%% Cell type:code id: tags:
```
python
```
...
...
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