Skip to content

Instantly share code, notes, and snippets.

total_accuracy = 0.0
total_precision = 0.0
total_recall = 0.0
# Iterate over the cv and fit the decision tree using the training set
# https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.KFold.html
for i, (train_index, test_index) in enumerate(cv.split(X, Y)):
X_train, X_test = X[train_index], X[test_index]
y_train, y_test = Y[train_index], Y[test_index]
@josephbima
josephbima / features.py
Last active September 18, 2020 21:53
This code extracts the feature we have chosen from the data (window)
def _compute_mean_features(window):
"""
Computes the mean x, y and z acceleration over the given window.
"""
return np.mean(window, axis=0)
def _compute_std_features(window):
'''
Computes the standard deviation of x, y and z acceleration over the given window.