Skip to content

Commit

Permalink
Merge pull request #26 from ragavvenkatesan/dev
Browse files Browse the repository at this point in the history
pushing python 2 dump
  • Loading branch information
Ragav Venkatesan committed Feb 26, 2017
2 parents 1c1bb91 + 19fcb45 commit a61687f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
3 changes: 3 additions & 0 deletions pantry/tutorials/lenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ def lenet5 ( dataset= None, verbose = 1 ):

net.test(verbose = verbose)

from yann.utils.pickle import pickle
pickle(net, 'network.pkl')

# Advaned version of the CNN
def lenet_maxout ( dataset= None, verbose = 1 ):
"""
Expand Down
15 changes: 15 additions & 0 deletions yann/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -2599,6 +2599,21 @@ def test(self, show_progress = True, verbose = 2):
if verbose >= 2:
print(".. Mean testing error : " + str(testing_accuracy))

def deactivate_layer (self, id, verbose = 2):
"""
This method will remove a layer's parameters from the active_layer dictionary.
Args:
id: Layer which you want to de activate.
verbose: as usual.
Notes:
If the network was cooked, it would have to be re-cooked after deactivation.
"""
for param in self.dropout_layers[id].params:
if param in self.active_params:
self.active_params.remove(param)

def get_params (self, verbose = 2):
"""
This method returns a dictionary of layer weights and bias in numpy format.
Expand Down
6 changes: 3 additions & 3 deletions yann/utils/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

import numpy
import scipy.io
#import cPickle
#for python3 compatability
import pickle as cPickle
import cPickle
# for python3 compatability
# import pickle as cPickle
import imp

from image import *
Expand Down

0 comments on commit a61687f

Please sign in to comment.