This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.datasets import cifar10 | |
import matplotlib.pyplot as plt | |
(X_train, y_train), (X_test, y_test) = cifar10.load_data() | |
plt.figure(facecolor='white') | |
for i in range(100): | |
plt.subplot(10, 10, i+1) | |
plt.imshow(X_train[i]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import library --------------------------------------------------------------- | |
import pygame.midi | |
import time | |
# define all the constant values ----------------------------------------------- | |
device = 0 # device number in win10 laptop | |
instrument = 9 # http://www.ccarh.org/courses/253/handout/gminstruments/ | |
note_Do = 48 # http://www.electronics.dit.ie/staff/tscarff/Music_technology/midi/midi_note_numbers_for_octaves.htm | |
note_Re = 50 | |
note_Me = 52 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Import library in Keras 1.2.0 | |
from keras.layers.recurrent import SimpleRNN, GRU, LSTM | |
from keras.models import Sequential | |
from keras.layers import Dense, Activation | |
from keras.callbacks import EarlyStopping | |
from keras.utils.visualize_util import plot | |
# Define parameters | |
HIDDEN_SIZE = 128 | |
BATCH_SIZE = 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
train( [60, 67, 63, 60, 65, 62, 60, 67, 63, 60] ) -> label( 65 ) | |
train( [67, 63, 60, 65, 62, 60, 67, 63, 60, 65] ) -> label( 62 ) | |
train( [63, 60, 65, 62, 60, 67, 63, 60, 65, 62] ) -> label( 60 ) | |
train( [60, 65, 62, 60, 67, 63, 60, 65, 62, 60] ) -> label( 67 ) | |
train( [65, 62, 60, 67, 63, 60, 65, 62, 60, 67] ) -> label( 63 ) | |
train( [62, 60, 67, 63, 60, 65, 62, 60, 67, 63] ) -> label( 60 ) | |
train( [60, 67, 63, 60, 65, 62, 60, 67, 63, 60] ) -> label( 65 ) | |
train( [67, 63, 60, 65, 62, 60, 67, 63, 60, 65] ) -> label( 62 ) | |
train( [63, 60, 65, 62, 60, 67, 63, 60, 65, 62] ) -> label( 60 ) | |
train( [60, 65, 62, 60, 67, 63, 60, 65, 62, 60] ) -> label( 67 ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60, 67, 63, 60, 65, 62, 60, 67, 63, 60, 65, 62, 60, 67, 63, 60, 65, 62, 60, 67, ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# import library from Scikit-Learn --------------------------------------------- | |
from sklearn.metrics import accuracy_score | |
from sklearn.metrics import confusion_matrix | |
# algorithm 1 ------------------------------------------------------------------ | |
print(" Naive Bayes ... ") | |
start = timeit.default_timer() | |
from sklearn import naive_bayes | |
classifier = naive_bayes.GaussianNB() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_________________________________________________________________ | |
Layer (type) Output Shape Param # | |
================================================================= | |
dense_1 (Dense) (None, 32) 16032 | |
_________________________________________________________________ | |
activation_1 (Activation) (None, 32) 0 | |
_________________________________________________________________ | |
dense_2 (Dense) (None, 32) 1056 | |
_________________________________________________________________ | |
activation_2 (Activation) (None, 32) 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MLP (3 layers, 32 neurons, 30 epochs) ... | |
accuracy = 0.9986 time = 14.8910531305 | |
[[3378 0 0] | |
[ 0 3407 0] | |
[ 13 1 3201]] | |
Naive Bayes ... | |
accuracy = 0.9874 time = 1.30055759897 | |
[[3252 0 126] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Train on 9000 samples, validate on 1000 samples | |
Epoch 1/15 | |
9000/9000 [==============================] - 1865s 207ms/step - loss: 0.6278 - acc: 0.6629 - val_loss: 0.5947 - val_acc: 0.6845 | |
Epoch 2/15 | |
9000/9000 [==============================] - 1810s 201ms/step - loss: 0.5216 - acc: 0.7424 - val_loss: 0.4472 - val_acc: 0.7916 | |
Epoch 3/15 | |
9000/9000 [==============================] - 1789s 199ms/step - loss: 0.4024 - acc: 0.8191 - val_loss: 0.3396 - val_acc: 0.8529 | |
Epoch 4/15 | |
9000/9000 [==============================] - 1817s 202ms/step - loss: 0.3204 - acc: 0.8646 - val_loss: 0.3059 - val_acc: 0.8740 | |
Epoch 5/15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file_name one_hot_encoding ordered_labels ordered_categories | |
---------------------------------------------------------------------------------------------------- | |
0.png [0, 1, 1, 1, 0, 0, 1, 0, 0, 0] [6, 3, 2, 1] [Shirt, Dress, Pullover, Trouser] | |
1.png [1, 0, 0, 0, 1, 1, 1, 0, 0, 0] [5, 4, 0, 6] [Sandal, Coat, T-shirt/top, Shirt] | |
2.png [1, 1, 0, 1, 0, 0, 0, 0, 0, 0] [1, 3, 0, 3] [Trouser, Dress, T-shirt/top, Dress] | |
3.png [0, 0, 0, 0, 0, 1, 1, 1, 0, 0] [5, 5, 7, 6] [Sandal, Sandal, Sneaker, Shirt] |
OlderNewer