Last active
October 4, 2023 00:03
-
-
Save petrosDemetrakopoulos/8bcb0b649b7caaea34e4326c84b66ed4 to your computer and use it in GitHub Desktop.
Fall Detector - All
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from matplotlib import pyplot as plt | |
import numpy as np | |
import pandas as pd | |
from scipy.stats import skew, kurtosis | |
from sklearn.decomposition import PCA | |
from sklearn.cluster import KMeans | |
def main(): | |
data = read_data() | |
normalized_data = normalize(data) | |
# time related columns are not needed after this point | |
normalized_data = normalized_data.drop(['time','seconds_elapsed'],axis=1) | |
extracted_features = feature_extraction(normalized_data) | |
# dimensionality reduction using PCA | |
plot_pca(extracted_features) | |
# fit K-Means | |
kmeans = KMeans(n_clusters=2) | |
kmeans.fit(extracted_features) | |
predictions = kmeans.predict(extracted_features) | |
# plot the results | |
plot_pca(extracted_features, predictions) | |
plot_out_signal(predictions) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment