-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
|
||
|
||
import numpy as np | ||
import matplotlib.pyplot as plt | ||
from util import get_data | ||
from datetime import datetime | ||
from scipy.stats import norm | ||
|
@@ -60,3 +61,9 @@ def predict(self, X): | |
t0 = datetime.now() | ||
print("Test accuracy:", model.score(Xtest, Ytest)) | ||
print("Time to compute test accuracy:", (datetime.now() - t0), "Test size:", len(Ytest)) | ||
|
||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
lazyprogrammer
Owner
|
||
# plot the mean of each class | ||
for c, g in iteritems(model.gaussians): | ||
plt.imshow(g['mean'].reshape(28, 28)) | ||
plt.title(c) | ||
plt.show() |
Dear @lazyprogrammer
I think there is a problem with this part that needs to be fixed. When I run the code, I get this error:
ValueError: cannot reshape array of size 20 into shape (28,28)
And then I changed the numbers in the
reshape
function so that their product would be 20 (i.e.(1,20)
or(4,5)
), but then I couldn't understand it. Here is a screenshot of the result though: