thomas9t / ExploreCSR

Repo for ExploreCSR Project
0 stars 0 forks source link

EEG Analysis Practice Task Review (Anthony) #1

Open thomas9t opened 4 years ago

thomas9t commented 4 years ago

I have completed the EEG analysis practice task up "Step 3: Estimate Model Parameters" - however, I'm stuck because I keep getting a ValueError saying

Reshape your data either using 
X.reshape(-1, 1) if your data has a single feature or X.reshape(1, -1)
if it contains a single sample.

when I call CLF.fit(). I tried googling this error, but none of the suggested solutions worked for me. Do you have any idea what's going wrong here and how I can fix it?

Additionally, I noticed my code to extract features from the data is running very slowly (takes over 2 hours), can you please take a look at my work and let me know if there's a way I can improve my code's efficiency?

thomas9t commented 4 years ago

Hi @thomas9t - in response to your questions:

Do you have any idea what's going wrong here and how I can fix it?

The error is just telling you that Sci-Kit Learn wants the labels to be passed as an N x 1 array (e.g. a column-vector). Try calling the CLF.fit() method like this:

y_train = y_train.reshape(-1,1)
CLF.fit(X_train, y_train)

Additionally, I noticed my code to extract features from the data is running very slowly (takes over 2 hours), can you please take a look at my work and let me know if there's a way I can improve my code's efficiency?

This is probably because you're computing the mean and variance by hand using pure Python. NumPy has built in functions to do this which are much faster. Give this a try variance = np.var(X_w, aixs=0).