提交 4dc613eb authored 作者: Frederic Bastien's avatar Frederic Bastien

docstring update, make default as RandomStream and add an assert.

上级 b95fdb1c
...@@ -1446,7 +1446,7 @@ class MRG_RandomStreams(object): ...@@ -1446,7 +1446,7 @@ class MRG_RandomStreams(object):
raise NotImplementedError(("MRG_RandomStreams.multinomial only" raise NotImplementedError(("MRG_RandomStreams.multinomial only"
" implemented for pvals.ndim = 2")) " implemented for pvals.ndim = 2"))
def choice(self, size=1, a=None, replace=True, p=None, ndim=None, def choice(self, size=1, a=2, replace=True, p=None, ndim=None,
dtype='int64', nstreams=None): dtype='int64', nstreams=None):
""" """
Sample `size` times from a multinomial distribution defined by Sample `size` times from a multinomial distribution defined by
...@@ -1456,10 +1456,13 @@ class MRG_RandomStreams(object): ...@@ -1456,10 +1456,13 @@ class MRG_RandomStreams(object):
Parameters Parameters
---------- ----------
size: integer or integer tensor (default 1) size: integer or integer tensor (default 1)
The number of samples. It should be between 1 and `p.shape[1]-1` The number of samples. It should be between 1 and `p.shape[1]-1`.
a: None a: None (default 2)
For now, a should be None. This function will sample For now, a should be None. This function will sample
values between 0 and `p.shape[1]-1`. values between 0 and `p.shape[1]-1`. When a != None will be
implemented, if `a` is a scalar, the samples are drawn from the
range 0,...,a-1. We default to 2 as to have the same interface as
RandomStream.
replace: bool (default True) replace: bool (default True)
Whether the sample is with or without replacement. Whether the sample is with or without replacement.
Only replace=False is implemented for now. Only replace=False is implemented for now.
...@@ -1473,7 +1476,7 @@ class MRG_RandomStreams(object): ...@@ -1473,7 +1476,7 @@ class MRG_RandomStreams(object):
Notes Notes
----- -----
-`size` and `ndim` are only there keep the same signature as other -`ndim` are only there keep the same signature as other
uniform, binomial, normal, etc. uniform, binomial, normal, etc.
-Does not do any value checking on pvals, i.e. there is no -Does not do any value checking on pvals, i.e. there is no
...@@ -1518,6 +1521,7 @@ class MRG_RandomStreams(object): ...@@ -1518,6 +1521,7 @@ class MRG_RandomStreams(object):
warnings.warn('MRG_RandomStreams.multinomial_wo_replacement() is ' warnings.warn('MRG_RandomStreams.multinomial_wo_replacement() is '
'deprecated and will be removed in the next release of ' 'deprecated and will be removed in the next release of '
'Theano. Please use MRG_RandomStreams.choice() instead.') 'Theano. Please use MRG_RandomStreams.choice() instead.')
assert size is None
return self.choice(size=n, a=None, replace=False, p=pvals, return self.choice(size=n, a=None, replace=False, p=pvals,
dtype=dtype, nstreams=nstreams, ndim=ndim) dtype=dtype, nstreams=nstreams, ndim=ndim)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论