Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
nni
Commits
591fa1d7
Commit
591fa1d7
authored
Jul 29, 2019
by
suiguoxin
Browse files
update annotation doc; update smartparam sync
parent
9a00a14c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
+5
-4
docs/en_US/Tutorial/AnnotationSpec.md
docs/en_US/Tutorial/AnnotationSpec.md
+2
-2
src/sdk/pynni/nni/parameter_expressions.py
src/sdk/pynni/nni/parameter_expressions.py
+1
-0
src/sdk/pynni/nni/smartparam.py
src/sdk/pynni/nni/smartparam.py
+2
-2
No files found.
docs/en_US/Tutorial/AnnotationSpec.md
View file @
591fa1d7
...
...
@@ -41,11 +41,11 @@ There are 10 types to express your search space as follows:
*
`@nni.variable(nni.uniform(low, high),name=variable)`
Which means the variable value is a value uniformly between low and high.
*
`@nni.variable(nni.quniform(low, high, q),name=variable)`
Which means the variable value is a value like r
ound(uniform(low, high) / q)
*
q
Which means the variable value is a value like r
andint(floor((high-low)/q)+1)
*
q + low
*
`@nni.variable(nni.loguniform(low, high),name=variable)`
Which means the variable value is a value drawn according to exp(uniform(low, high)) so that the logarithm of the return value is uniformly distributed.
*
`@nni.variable(nni.qloguniform(low, high, q),name=variable)`
Which means the variable value is a value like
round(exp(
uniform(low, high)) / q)
*
q
Which means the variable value is a value like
floor((log
uniform(low, high)
- low
) / q)
*
q
+ low
*
`@nni.variable(nni.normal(mu, sigma),name=variable)`
Which means the variable value is a real value that's normally-distributed with mean mu and standard deviation sigma.
*
`@nni.variable(nni.qnormal(mu, sigma, q),name=variable)`
...
...
src/sdk/pynni/nni/parameter_expressions.py
View file @
591fa1d7
...
...
@@ -57,6 +57,7 @@ def quniform(low, high, q, random_state):
q: sample step
random_state: an object of numpy.random.RandomState
'''
assert
high
>
low
,
'Upper bound must be larger than lower bound'
return
randint
(
np
.
floor
((
high
-
low
)
/
q
)
+
1
,
random_state
)
*
q
+
low
...
...
src/sdk/pynni/nni/smartparam.py
View file @
591fa1d7
...
...
@@ -57,14 +57,14 @@ if trial_env_vars.NNI_PLATFORM is None:
def
quniform
(
low
,
high
,
q
,
name
=
None
):
assert
high
>
low
,
'Upper bound must be larger than lower bound'
return
r
ound
(
random
.
uniform
(
low
,
high
)
/
q
)
*
q
return
r
andint
(
np
.
floor
((
high
-
low
)
/
q
)
+
1
)
*
q
+
low
def
loguniform
(
low
,
high
,
name
=
None
):
assert
low
>
0
,
'Lower bound must be positive'
return
np
.
exp
(
random
.
uniform
(
np
.
log
(
low
),
np
.
log
(
high
)))
def
qloguniform
(
low
,
high
,
q
,
name
=
None
):
return
round
(
loguniform
(
low
,
high
)
/
q
)
*
q
return
np
.
floor
(
(
loguniform
(
low
,
high
)
-
low
)
/
q
)
*
q
+
low
def
normal
(
mu
,
sigma
,
name
=
None
):
return
random
.
gauss
(
mu
,
sigma
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment