from sklearn.naive_bayes import GaussianNB from sklearn.model_selection import GroupShuffleSplit, GridSearchCV from sklearn.pipeline import Pipeline import matplotlib.pyplot as plt ############################################################################## # First, we load the dataset and plot an example of one subject performing # the 'Walking' activity. # # .. tip:: # # In the jupyter notebook version, change the first cell to ``%matplotlib # notebook`` in order to get an interactive plot that you can zoom and pan. X = load_wisdm_dataarray() X_plot = X[np.logical_and(X.activity == 'Walking', X.subject == 1)] X_plot = X_plot[:500] / 9.81 X_plot['sample'] = (X_plot.sample - X_plot.sample[0]) / np.timedelta64(1, 's') f, axarr = plt.subplots(3, 1, sharex=True) axarr[0].plot(X_plot.sample, X_plot.sel(axis='x'), color='#1f77b4') axarr[0].set_title('Acceleration along x-axis') axarr[1].plot(X_plot.sample, X_plot.sel(axis='y'), color='#ff7f0e') axarr[1].set_ylabel('Acceleration [g]') axarr[1].set_title('Acceleration along y-axis') axarr[2].plot(X_plot.sample, X_plot.sel(axis='z'), color='#2ca02c')
def test_load_wisdm_dataarray(): load_wisdm_dataarray(folder=os.path.join(ROOT_DIR, "../data"))