fft_window = 0.50
fft_step = 0.25 #50% windows
fft_thresh = 2.0 #Works with new dc_lowcut, investigate better values
fft_set_thresh = 0.0

#Datasets Sizes (%)
test_size = 0.15
valid_size = 0.15

###################################################################

#Get unfiltered data
path = os.path.abspath(os.path.join(__file__,"../"))
predataset = readdata(path + "/curated/raw-presamples")
dataset = readdata(path + "/curated/raw-samples")
labels = readlabels(path + "/curated/raw-inputs")

#Constants
fs = 250.0 #Frequency in Hz
sample_time = dataset.shape[1]/fs #Total time for sample
presample_time = predataset.shape[1]/fs #Total time for sample

#Apply filters
print("DC Filter:", enable_dc)
print("Discrete Wavelet Transform:", enable_dwt)
print("Fast Fourier Transform:", enable_fft)
print("Applying filters...")
dataset.flags['WRITEABLE'] = True
predataset.flags['WRITEABLE'] = True
for i in range(0,dataset.shape[0]):
  for j in range(0,dataset.shape[2]):
import os
import sys
import pickle
import numpy as np
from dataio import readdata, readlabels, writedata

from sklearn import svm
from sklearn import linear_model
from sklearn.neighbors import KNeighborsClassifier
from sklearn.ensemble import VotingClassifier, AdaBoostClassifier, RandomForestClassifier, ExtraTreesClassifier
from sklearn.metrics import accuracy_score

path = os.path.abspath(os.path.join(__file__,"../"))
#Read data
train_dataset = readdata(path + "/curated/train_dataset")
train_labels = readlabels(path + "/curated/train_labels")
#valid_dataset = readdata(path + "/curated/valid_dataset")
#valid_labels = readlabels(path + "/curated/valid_labels")
test_dataset = readdata(path + "/curated/test_dataset")
test_labels = readlabels(path + "/curated/test_labels")
print("Training:", train_dataset.shape, train_labels.shape)
#print("Validation:", valid_dataset.shape, valid_labels.shape)
print("Testing:", test_dataset.shape, test_labels.shape)

#Reshape
n_input = 8*360 # EEG data input (8 channels * 1130 sample points)
n_classes = 5 # EEG total classes ("nothing", "up", "down", "left", "right")
train_dataset.shape = (train_dataset.shape[0], n_input)
test_dataset.shape = (test_dataset.shape[0], n_input)

#KNN