Posts

Showing posts with the label Theano

Simple Neural Network get 95.83% accuracy with RMSprop optimizer

Image
Simple Neural Network by using RMSprop optimzer with only 5 layers. Here's the coding. from __future__ import print_function import keras from keras.models import Sequential from keras.layers import Dense, Dropout from keras.optimizers import RMSprop from keras.utils import np_utils import os from six.moves import cPickle as pickle batch_size = 128 num_classes = 10 epochs = 20 def load_data():     test_filename = "notMNIST.pickle"     if os.path.exists(test_filename):         with open(test_filename, 'rb') as f:             letter_dataset = pickle.load(f)     return (letter_dataset)       lt_dt = load_data()   train_dataset = lt_dt['train_dataset'] train_labels = lt_dt['train_labels'] valid_dataset = lt_dt['valid_dataset'] valid_labels = lt_dt['valid_labels'] test_dataset = lt_dt['test_dataset'] test_labels = lt_dt['test_labels'] x_train = train_datase...

96.24% accuracy with higher epoch numbers for Convolutional Neural Network

Image
For Convolutional Neural Network , there are a lots of factors affect the model accuracy. Factors included the structure of Convolutional Neural Network , hyper parameters values, over-fitting and etc. Only correct or suitable network structure can produce high model accuracy. If wrong network structure is used, whatever you tune the hyper parameters, the accuracy will still worse. So, after we found the right network structure, only we can start to tune the hyper parameters. However, over-fitting may happened on your model accuracy. There are several methods to prevent that. One of the over-fitting prevention is by using the dropout function. Dropout give the model a way to find alternative way to train the model by removed some characteristic according to the ratio. Another way to prevent over-fitting is by increasing the number of samples. Besides, we can also simplify the network structure. Some complicated network structure sometimes can cause over-fitting too.  Fi...

Accuracy 96% with Simple Deep NN using Keras Theano backend for nonMNist alphabet recognition

Image
Here's first try to build a simple simple deep neurons network by using Keras with Theano backend. By using the previous data pickles sample   nonMNist dataset we have saved, here's the completed coding. The summarized deep filter layers can be described as combination of common dense layer with 512 units, relu activation, dropout ratio of 0.2, softmax activation, and RMSprop optimizer. from __future__ import print_function import keras from keras.models import Sequential from keras.layers import Dense, Dropout from keras.optimizers import RMSprop from keras.utils import np_utils import os from six.moves import cPickle as pickle batch_size = 128 num_classes = 10 epochs = 20 def load_data(): test_filename = "notMNIST.pickle" if os.path.exists(test_filename): with open(test_filename, 'rb') as f: letter_dataset = pickle.load(f) return (letter_dataset) lt_dt = load_data() train_dataset = lt_dt['train_...