Skip to content

Commit

Permalink
Add support for parameter with float value
Browse files Browse the repository at this point in the history
Example with param CPuct.

--input-param "{'CPuct': {'init':1.745, 'lower':0.5, 'upper':5.0}, 'MinibatchSize': {'init':256, 'lower':1, 'upper':1024}}"
  • Loading branch information
fsmosca committed Feb 16, 2021
1 parent 29a5f8f commit a844798
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lakas.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

__author__ = 'fsmosca'
__script_name__ = 'Lakas'
__version__ = 'v0.25.3'
__version__ = 'v0.26.0'
__credits__ = ['joergoster', 'musketeerchess', 'nevergrad', 'teytaud']


Expand Down Expand Up @@ -741,8 +741,12 @@ def main():
# Prepare parameters to be optimized.
arg = {}
for k, v in input_param.items():
arg.update({k: ng.p.Scalar(init=v['init'], lower=v['lower'],
upper=v['upper']).set_integer_casting()})
if isinstance(v["init"], int):
arg.update({k: ng.p.Scalar(init=v['init'], lower=v['lower'],
upper=v['upper']).set_integer_casting()})
elif isinstance(v["init"], float):
arg.update({k: ng.p.Scalar(init=v['init'], lower=v['lower'],
upper=v['upper'])})
instrum = ng.p.Instrumentation(**arg)

# deterministic_function in Nevergrad default since
Expand Down

0 comments on commit a844798

Please sign in to comment.