Skip to content

Commit

Permalink
Merge pull request #24 from ragavvenkatesan/dev
Browse files Browse the repository at this point in the history
PR for the fix with mat2yann
  • Loading branch information
Ragav Venkatesan committed Feb 23, 2017
2 parents 8bc44a2 + a998fd3 commit cb8f868
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
4 changes: 2 additions & 2 deletions pantry/tutorials/mat2yann.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def cook_svhn_normalized( location, verbose = 1, **kwargs):
dataset = setup_dataset(dataset_init_args = data_params,
save_directory = save_directory,
preprocess_init_args = preprocess_params,
verbose = 3)
verbose = verbose)
return dataset

if __name__ == '__main__':
Expand All @@ -64,4 +64,4 @@ def cook_svhn_normalized( location, verbose = 1, **kwargs):
raise Exception("Provide Dataset Location")
else:
location = sys.argv[1]
cook_svhn_normalized(location)
cook_svhn_normalized(location, verbose = 3)
18 changes: 6 additions & 12 deletions yann/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -2166,22 +2166,16 @@ def print_status (self, epoch , verbose = 2):
if self.cooked_datastream is None:
raise Exception(" Cook first then run this.")

if verbose >=2 :
if len(self.cost) < self.batches2train * self.mini_batches_per_batch[0]:
print(".. Cost : " + str(self.cost[-1]))
else:
print(".. Cost : " + str(numpy.mean(self.cost[-1 *
self.batches2train * self.mini_batches_per_batch[0]:])))

if verbose >= 3:
print("... Learning Rate : " + str(self.learning_rate.get_value(borrow=\
self.borrow)))
print("... Momentum : " + str(self.current_momentum(epoch)))
if len(self.cost) < self.batches2train * self.mini_batches_per_batch[0]:
cost = self.cost[-1]
else:
cost = numpy.mean(self.cost[-1 *
self.batches2train * self.mini_batches_per_batch[0]:])

lr = self.learning_rate.get_value(borrow = self.borrow)
mom = self.current_momentum(epoch)

self.cooked_resultor.process_results(cost = self.cost,
self.cooked_resultor.process_results(cost = cost,
lr = lr,
mom = mom,
verbose = verbose)
Expand Down
5 changes: 4 additions & 1 deletion yann/utils/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,10 +838,11 @@ def __init__(self,
print(". Setting up dataset ")

self.source = dataset_init_args [ "source" ]

if self.source == 'skdata':
self.name = dataset_init_args ["name"]

elif self.source == 'mat':
elif self.source == 'matlab':
self.location = dataset_init_args [ "location" ]

if "height" in dataset_init_args.keys():
Expand Down Expand Up @@ -959,6 +960,8 @@ def _mat2yann (self, verbose = 2):
self.channels,
self.preprocessor )

if verbose >=3:
print ("... Dumping batch " + str(batch))
# compute number of minibatches for training, validation and testing
f = open(self.root + "/" + type + "/" + 'batch_' + str(batch) + '.pkl', 'wb')
obj = (data_x, data_y )
Expand Down

0 comments on commit cb8f868

Please sign in to comment.