Skip to content
Snippets Groups Projects
Commit 97b12c51 authored by Simon Adick's avatar Simon Adick
Browse files

refactor: Anzeige der Merkmale überarbeitet

parent 8c470359
No related branches found
No related tags found
No related merge requests found
from korpus import create_bewegung, Sensor
from features.moving_average import moving_average
from features.moving_stdev import moving_stdev
from plot import plotter
from features.moving_feature import moving_feature
from features.standard_deviation import standard_deviation
from korpus import create_bewegung
def classify_and_plot(sensor_name: str, messung1_name: str, messung1: Sensor, messung2_name: str, messung2: Sensor,
feature, window_size=0, line_plot=True, scatter_plot=True):
if window_size > 0:
first_feature = feature(window_size, messung1.werte)
second_feature = feature(window_size, messung2.werte)
else:
first_feature = feature(messung1)
second_feature = feature(messung2)
if line_plot:
plotter.plot_sensors([messung1, messung2])
if scatter_plot:
plotter.plot_scatters([
{'values': first_feature, 'name': f"{str(feature)} {messung1_name}: {sensor_name}"},
{'values': second_feature, 'name': f"{str(feature)} {messung2_name}: {sensor_name}"}
])
def binary_classification_feature(window_size=30):
# Wir holen uns den Höhensensor des Fußes (Bleibt bei Kniebeugen gleich und bewegt sich beim Laufen)
joggen_values = create_bewegung('joggen').messungen[1].sensoren[1].werte
kniebeuge_values = create_bewegung('kniebeuge').messungen[1].sensoren[1].werte
if __name__ == '__main__':
joggen = create_bewegung('joggen').messungen[1].sensoren[1]
kniebeuge = create_bewegung('kniebeuge').messungen[1].sensoren[1]
# Berechne die Standardabweichung (Bei Kniebeugen gering, bei Joggen hoch)
joggen_feature = moving_feature(standard_deviation, window_size, joggen_values)
kniebeuge_feature = moving_feature(standard_deviation, window_size, kniebeuge_values)
return joggen_feature, kniebeuge_feature
classify_and_plot('Acc_Y', 'Joggen', joggen, 'Kniebeuge', kniebeuge, moving_stdev, 25)
if __name__ == '__main__':
binary_classification_feature(30)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment