comparison deep/stacked_dae/utils.py @ 192:e656edaedb48

Commented a few things, renamed the produit_croise_jobs function, replaced the cost function (NOT TESTED YET).
author fsavard
date Wed, 03 Mar 2010 12:51:40 -0500
parents 3632e6258642
children 7b4507295eba
comparison
equal deleted inserted replaced
191:3632e6258642 192:e656edaedb48
4 from __future__ import with_statement 4 from __future__ import with_statement
5 5
6 from jobman import DD 6 from jobman import DD
7 7
8 # from pylearn codebase 8 # from pylearn codebase
9 # useful in __init__(param1, param2, etc.) to save
10 # values in self.param1, self.param2... just call
11 # update_locals(self, locals())
9 def update_locals(obj, dct): 12 def update_locals(obj, dct):
10 if 'self' in dct: 13 if 'self' in dct:
11 del dct['self'] 14 del dct['self']
12 obj.__dict__.update(dct) 15 obj.__dict__.update(dct)
13 16
14 def produit_croise_jobs(val_dict): 17 # from a dictionary of possible values for hyperparameters, e.g.
18 # hp_values = {'learning_rate':[0.1, 0.01], 'num_layers': [1,2]}
19 # create a list of other dictionaries representing all the possible
20 # combinations, thus in this example creating:
21 # [{'learning_rate': 0.1, 'num_layers': 1}, ...]
22 # (similarly for combinations (0.1, 2), (0.01, 1), (0.01, 2))
23 def produit_cartesien_jobs(val_dict):
15 job_list = [DD()] 24 job_list = [DD()]
16 all_keys = val_dict.keys() 25 all_keys = val_dict.keys()
17 26
18 for key in all_keys: 27 for key in all_keys:
19 possible_values = val_dict[key] 28 possible_values = val_dict[key]
25 new_job_list.append(to_insert) 34 new_job_list.append(to_insert)
26 job_list = new_job_list 35 job_list = new_job_list
27 36
28 return job_list 37 return job_list
29 38
30 def test_produit_croise_jobs(): 39 def test_produit_cartesien_jobs():
31 vals = {'a': [1,2], 'b': [3,4,5]} 40 vals = {'a': [1,2], 'b': [3,4,5]}
32 print produit_croise_jobs(vals) 41 print produit_cartesien_jobs(vals)
33 42
34 43
35 # taken from http://stackoverflow.com/questions/276052/how-to-get-current-cpu-and-ram-usage-in-python 44 # taken from http://stackoverflow.com/questions/276052/how-to-get-current-cpu-and-ram-usage-in-python
36 """Simple module for getting amount of memory used by a specified user's 45 """Simple module for getting amount of memory used by a specified user's
37 processes on a UNIX system. 46 processes on a UNIX system.