nmheim / torsk

An echo state network (ESN) for video prediction
10 stars 5 forks source link

Suggestion: Make parameters a dict #15

Closed jamesavery closed 5 years ago

jamesavery commented 5 years ago

It's a bit awkward to address every parameter by name, as is needed when represented as fields in an object. For example, updating parameter values on the command line is much easier, if I could do

def update_params(params,args):
    for i in range(1,len(args),2):
        [key,value] = args[i:i+2];
        params[key] = eval(value)

Then the default values can sit in the json file, but it's quick to supply alternate values without having to change the json or source code.

nmheim commented 5 years ago

you can also access the parameters as a dictionary with params.dict like this:

def update_params(params,args):
    for i in range(1,len(args),2):
        [key,value] = args[i:i+2];
        params.dict[key] = eval(value)
jamesavery commented 5 years ago

Cool, thanks! :)