Spaces:
Running
Running
import sys | |
from typing import Any, Callable, Dict, Optional, Tuple, Type, Union, overload | |
from numpy import ( | |
bool_, | |
dtype, | |
float32, | |
float64, | |
int8, | |
int16, | |
int32, | |
int64, | |
int_, | |
ndarray, | |
uint, | |
uint8, | |
uint16, | |
uint32, | |
uint64, | |
) | |
from numpy.random.bit_generator import BitGenerator | |
from numpy.typing import ( | |
ArrayLike, | |
_ArrayLikeFloat_co, | |
_ArrayLikeInt_co, | |
_DoubleCodes, | |
_DTypeLikeBool, | |
_DTypeLikeInt, | |
_DTypeLikeUInt, | |
_Float32Codes, | |
_Float64Codes, | |
_Int8Codes, | |
_Int16Codes, | |
_Int32Codes, | |
_Int64Codes, | |
_IntCodes, | |
_ShapeLike, | |
_SingleCodes, | |
_SupportsDType, | |
_UInt8Codes, | |
_UInt16Codes, | |
_UInt32Codes, | |
_UInt64Codes, | |
_UIntCodes, | |
) | |
if sys.version_info >= (3, 8): | |
from typing import Literal | |
else: | |
from typing_extensions import Literal | |
_DTypeLikeFloat32 = Union[ | |
dtype[float32], | |
_SupportsDType[dtype[float32]], | |
Type[float32], | |
_Float32Codes, | |
_SingleCodes, | |
] | |
_DTypeLikeFloat64 = Union[ | |
dtype[float64], | |
_SupportsDType[dtype[float64]], | |
Type[float], | |
Type[float64], | |
_Float64Codes, | |
_DoubleCodes, | |
] | |
class RandomState: | |
_bit_generator: BitGenerator | |
def __init__(self, seed: Union[None, _ArrayLikeInt_co, BitGenerator] = ...) -> None: ... | |
def __repr__(self) -> str: ... | |
def __str__(self) -> str: ... | |
def __getstate__(self) -> Dict[str, Any]: ... | |
def __setstate__(self, state: Dict[str, Any]) -> None: ... | |
def __reduce__(self) -> Tuple[Callable[[str], RandomState], Tuple[str], Dict[str, Any]]: ... | |
def seed(self, seed: Optional[_ArrayLikeFloat_co] = ...) -> None: ... | |
def get_state(self, legacy: Literal[False] = ...) -> Dict[str, Any]: ... | |
def get_state( | |
self, legacy: Literal[True] = ... | |
) -> Union[Dict[str, Any], Tuple[str, ndarray[Any, dtype[uint32]], int, int, float]]: ... | |
def set_state( | |
self, state: Union[Dict[str, Any], Tuple[str, ndarray[Any, dtype[uint32]], int, int, float]] | |
) -> None: ... | |
def random_sample(self, size: None = ...) -> float: ... # type: ignore[misc] | |
def random_sample(self, size: _ShapeLike = ...) -> ndarray[Any, dtype[float64]]: ... | |
def random(self, size: None = ...) -> float: ... # type: ignore[misc] | |
def random(self, size: _ShapeLike = ...) -> ndarray[Any, dtype[float64]]: ... | |
def beta(self, a: float, b: float, size: None = ...) -> float: ... # type: ignore[misc] | |
def beta( | |
self, a: _ArrayLikeFloat_co, b: _ArrayLikeFloat_co, size: Optional[_ShapeLike] = ... | |
) -> ndarray[Any, dtype[float64]]: ... | |
def exponential(self, scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc] | |
def exponential( | |
self, scale: _ArrayLikeFloat_co = ..., size: Optional[_ShapeLike] = ... | |
) -> ndarray[Any, dtype[float64]]: ... | |
def standard_exponential(self, size: None = ...) -> float: ... # type: ignore[misc] | |
def standard_exponential(self, size: _ShapeLike = ...) -> ndarray[Any, dtype[float64]]: ... | |
def tomaxint(self, size: None = ...) -> int: ... # type: ignore[misc] | |
def tomaxint(self, size: _ShapeLike = ...) -> ndarray[Any, dtype[int_]]: ... | |
def randint( # type: ignore[misc] | |
self, | |
low: int, | |
high: Optional[int] = ..., | |
) -> int: ... | |
def randint( # type: ignore[misc] | |
self, | |
low: int, | |
high: Optional[int] = ..., | |
size: None = ..., | |
dtype: _DTypeLikeBool = ..., | |
) -> bool: ... | |
def randint( # type: ignore[misc] | |
self, | |
low: int, | |
high: Optional[int] = ..., | |
size: None = ..., | |
dtype: Union[_DTypeLikeInt, _DTypeLikeUInt] = ..., | |
) -> int: ... | |
def randint( # type: ignore[misc] | |
self, | |
low: _ArrayLikeInt_co, | |
high: Optional[_ArrayLikeInt_co] = ..., | |
size: Optional[_ShapeLike] = ..., | |
) -> ndarray[Any, dtype[int_]]: ... | |
def randint( # type: ignore[misc] | |
self, | |
low: _ArrayLikeInt_co, | |
high: Optional[_ArrayLikeInt_co] = ..., | |
size: Optional[_ShapeLike] = ..., | |
dtype: _DTypeLikeBool = ..., | |
) -> ndarray[Any, dtype[bool_]]: ... | |
def randint( # type: ignore[misc] | |
self, | |
low: _ArrayLikeInt_co, | |
high: Optional[_ArrayLikeInt_co] = ..., | |
size: Optional[_ShapeLike] = ..., | |
dtype: Union[dtype[int8], Type[int8], _Int8Codes, _SupportsDType[dtype[int8]]] = ..., | |
) -> ndarray[Any, dtype[int8]]: ... | |
def randint( # type: ignore[misc] | |
self, | |
low: _ArrayLikeInt_co, | |
high: Optional[_ArrayLikeInt_co] = ..., | |
size: Optional[_ShapeLike] = ..., | |
dtype: Union[dtype[int16], Type[int16], _Int16Codes, _SupportsDType[dtype[int16]]] = ..., | |
) -> ndarray[Any, dtype[int16]]: ... | |
def randint( # type: ignore[misc] | |
self, | |
low: _ArrayLikeInt_co, | |
high: Optional[_ArrayLikeInt_co] = ..., | |
size: Optional[_ShapeLike] = ..., | |
dtype: Union[dtype[int32], Type[int32], _Int32Codes, _SupportsDType[dtype[int32]]] = ..., | |
) -> ndarray[Any, dtype[Union[int32]]]: ... | |
def randint( # type: ignore[misc] | |
self, | |
low: _ArrayLikeInt_co, | |
high: Optional[_ArrayLikeInt_co] = ..., | |
size: Optional[_ShapeLike] = ..., | |
dtype: Optional[ | |
Union[dtype[int64], Type[int64], _Int64Codes, _SupportsDType[dtype[int64]]] | |
] = ..., | |
) -> ndarray[Any, dtype[int64]]: ... | |
def randint( # type: ignore[misc] | |
self, | |
low: _ArrayLikeInt_co, | |
high: Optional[_ArrayLikeInt_co] = ..., | |
size: Optional[_ShapeLike] = ..., | |
dtype: Union[dtype[uint8], Type[uint8], _UInt8Codes, _SupportsDType[dtype[uint8]]] = ..., | |
) -> ndarray[Any, dtype[uint8]]: ... | |
def randint( # type: ignore[misc] | |
self, | |
low: _ArrayLikeInt_co, | |
high: Optional[_ArrayLikeInt_co] = ..., | |
size: Optional[_ShapeLike] = ..., | |
dtype: Union[ | |
dtype[uint16], Type[uint16], _UInt16Codes, _SupportsDType[dtype[uint16]] | |
] = ..., | |
) -> ndarray[Any, dtype[Union[uint16]]]: ... | |
def randint( # type: ignore[misc] | |
self, | |
low: _ArrayLikeInt_co, | |
high: Optional[_ArrayLikeInt_co] = ..., | |
size: Optional[_ShapeLike] = ..., | |
dtype: Union[ | |
dtype[uint32], Type[uint32], _UInt32Codes, _SupportsDType[dtype[uint32]] | |
] = ..., | |
) -> ndarray[Any, dtype[uint32]]: ... | |
def randint( # type: ignore[misc] | |
self, | |
low: _ArrayLikeInt_co, | |
high: Optional[_ArrayLikeInt_co] = ..., | |
size: Optional[_ShapeLike] = ..., | |
dtype: Union[ | |
dtype[uint64], Type[uint64], _UInt64Codes, _SupportsDType[dtype[uint64]] | |
] = ..., | |
) -> ndarray[Any, dtype[uint64]]: ... | |
def randint( # type: ignore[misc] | |
self, | |
low: _ArrayLikeInt_co, | |
high: Optional[_ArrayLikeInt_co] = ..., | |
size: Optional[_ShapeLike] = ..., | |
dtype: Union[ | |
dtype[int_], Type[int], Type[int_], _IntCodes, _SupportsDType[dtype[int_]] | |
] = ..., | |
) -> ndarray[Any, dtype[int_]]: ... | |
def randint( # type: ignore[misc] | |
self, | |
low: _ArrayLikeInt_co, | |
high: Optional[_ArrayLikeInt_co] = ..., | |
size: Optional[_ShapeLike] = ..., | |
dtype: Union[dtype[uint], Type[uint], _UIntCodes, _SupportsDType[dtype[uint]]] = ..., | |
) -> ndarray[Any, dtype[uint]]: ... | |
def bytes(self, length: int) -> bytes: ... | |
def choice( | |
self, | |
a: int, | |
size: None = ..., | |
replace: bool = ..., | |
p: Optional[_ArrayLikeFloat_co] = ..., | |
) -> int: ... | |
def choice( | |
self, | |
a: int, | |
size: _ShapeLike = ..., | |
replace: bool = ..., | |
p: Optional[_ArrayLikeFloat_co] = ..., | |
) -> ndarray[Any, dtype[int_]]: ... | |
def choice( | |
self, | |
a: ArrayLike, | |
size: None = ..., | |
replace: bool = ..., | |
p: Optional[_ArrayLikeFloat_co] = ..., | |
) -> Any: ... | |
def choice( | |
self, | |
a: ArrayLike, | |
size: _ShapeLike = ..., | |
replace: bool = ..., | |
p: Optional[_ArrayLikeFloat_co] = ..., | |
) -> ndarray[Any, Any]: ... | |
def uniform(self, low: float = ..., high: float = ..., size: None = ...) -> float: ... # type: ignore[misc] | |
def uniform( | |
self, | |
low: _ArrayLikeFloat_co = ..., | |
high: _ArrayLikeFloat_co = ..., | |
size: Optional[_ShapeLike] = ..., | |
) -> ndarray[Any, dtype[float64]]: ... | |
def rand(self) -> float: ... | |
def rand(self, *args: int) -> ndarray[Any, dtype[float64]]: ... | |
def randn(self) -> float: ... | |
def randn(self, *args: int) -> ndarray[Any, dtype[float64]]: ... | |
def random_integers(self, low: int, high: Optional[int] = ..., size: None = ...) -> int: ... # type: ignore[misc] | |
def random_integers( | |
self, | |
low: _ArrayLikeInt_co, | |
high: Optional[_ArrayLikeInt_co] = ..., | |
size: Optional[_ShapeLike] = ..., | |
) -> ndarray[Any, dtype[int_]]: ... | |
def standard_normal(self, size: None = ...) -> float: ... # type: ignore[misc] | |
def standard_normal( # type: ignore[misc] | |
self, size: _ShapeLike = ... | |
) -> ndarray[Any, dtype[float64]]: ... | |
def normal(self, loc: float = ..., scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc] | |
def normal( | |
self, | |
loc: _ArrayLikeFloat_co = ..., | |
scale: _ArrayLikeFloat_co = ..., | |
size: Optional[_ShapeLike] = ..., | |
) -> ndarray[Any, dtype[float64]]: ... | |
def standard_gamma( # type: ignore[misc] | |
self, | |
shape: float, | |
size: None = ..., | |
) -> float: ... | |
def standard_gamma( | |
self, | |
shape: _ArrayLikeFloat_co, | |
size: Optional[_ShapeLike] = ..., | |
) -> ndarray[Any, dtype[float64]]: ... | |
def gamma(self, shape: float, scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc] | |
def gamma( | |
self, | |
shape: _ArrayLikeFloat_co, | |
scale: _ArrayLikeFloat_co = ..., | |
size: Optional[_ShapeLike] = ..., | |
) -> ndarray[Any, dtype[float64]]: ... | |
def f(self, dfnum: float, dfden: float, size: None = ...) -> float: ... # type: ignore[misc] | |
def f( | |
self, dfnum: _ArrayLikeFloat_co, dfden: _ArrayLikeFloat_co, size: Optional[_ShapeLike] = ... | |
) -> ndarray[Any, dtype[float64]]: ... | |
def noncentral_f(self, dfnum: float, dfden: float, nonc: float, size: None = ...) -> float: ... # type: ignore[misc] | |
def noncentral_f( | |
self, | |
dfnum: _ArrayLikeFloat_co, | |
dfden: _ArrayLikeFloat_co, | |
nonc: _ArrayLikeFloat_co, | |
size: Optional[_ShapeLike] = ..., | |
) -> ndarray[Any, dtype[float64]]: ... | |
def chisquare(self, df: float, size: None = ...) -> float: ... # type: ignore[misc] | |
def chisquare( | |
self, df: _ArrayLikeFloat_co, size: Optional[_ShapeLike] = ... | |
) -> ndarray[Any, dtype[float64]]: ... | |
def noncentral_chisquare(self, df: float, nonc: float, size: None = ...) -> float: ... # type: ignore[misc] | |
def noncentral_chisquare( | |
self, df: _ArrayLikeFloat_co, nonc: _ArrayLikeFloat_co, size: Optional[_ShapeLike] = ... | |
) -> ndarray[Any, dtype[float64]]: ... | |
def standard_t(self, df: float, size: None = ...) -> float: ... # type: ignore[misc] | |
def standard_t( | |
self, df: _ArrayLikeFloat_co, size: None = ... | |
) -> ndarray[Any, dtype[float64]]: ... | |
def standard_t( | |
self, df: _ArrayLikeFloat_co, size: _ShapeLike = ... | |
) -> ndarray[Any, dtype[float64]]: ... | |
def vonmises(self, mu: float, kappa: float, size: None = ...) -> float: ... # type: ignore[misc] | |
def vonmises( | |
self, mu: _ArrayLikeFloat_co, kappa: _ArrayLikeFloat_co, size: Optional[_ShapeLike] = ... | |
) -> ndarray[Any, dtype[float64]]: ... | |
def pareto(self, a: float, size: None = ...) -> float: ... # type: ignore[misc] | |
def pareto( | |
self, a: _ArrayLikeFloat_co, size: Optional[_ShapeLike] = ... | |
) -> ndarray[Any, dtype[float64]]: ... | |
def weibull(self, a: float, size: None = ...) -> float: ... # type: ignore[misc] | |
def weibull( | |
self, a: _ArrayLikeFloat_co, size: Optional[_ShapeLike] = ... | |
) -> ndarray[Any, dtype[float64]]: ... | |
def power(self, a: float, size: None = ...) -> float: ... # type: ignore[misc] | |
def power( | |
self, a: _ArrayLikeFloat_co, size: Optional[_ShapeLike] = ... | |
) -> ndarray[Any, dtype[float64]]: ... | |
def standard_cauchy(self, size: None = ...) -> float: ... # type: ignore[misc] | |
def standard_cauchy(self, size: _ShapeLike = ...) -> ndarray[Any, dtype[float64]]: ... | |
def laplace(self, loc: float = ..., scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc] | |
def laplace( | |
self, | |
loc: _ArrayLikeFloat_co = ..., | |
scale: _ArrayLikeFloat_co = ..., | |
size: Optional[_ShapeLike] = ..., | |
) -> ndarray[Any, dtype[float64]]: ... | |
def gumbel(self, loc: float = ..., scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc] | |
def gumbel( | |
self, | |
loc: _ArrayLikeFloat_co = ..., | |
scale: _ArrayLikeFloat_co = ..., | |
size: Optional[_ShapeLike] = ..., | |
) -> ndarray[Any, dtype[float64]]: ... | |
def logistic(self, loc: float = ..., scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc] | |
def logistic( | |
self, | |
loc: _ArrayLikeFloat_co = ..., | |
scale: _ArrayLikeFloat_co = ..., | |
size: Optional[_ShapeLike] = ..., | |
) -> ndarray[Any, dtype[float64]]: ... | |
def lognormal(self, mean: float = ..., sigma: float = ..., size: None = ...) -> float: ... # type: ignore[misc] | |
def lognormal( | |
self, | |
mean: _ArrayLikeFloat_co = ..., | |
sigma: _ArrayLikeFloat_co = ..., | |
size: Optional[_ShapeLike] = ..., | |
) -> ndarray[Any, dtype[float64]]: ... | |
def rayleigh(self, scale: float = ..., size: None = ...) -> float: ... # type: ignore[misc] | |
def rayleigh( | |
self, scale: _ArrayLikeFloat_co = ..., size: Optional[_ShapeLike] = ... | |
) -> ndarray[Any, dtype[float64]]: ... | |
def wald(self, mean: float, scale: float, size: None = ...) -> float: ... # type: ignore[misc] | |
def wald( | |
self, mean: _ArrayLikeFloat_co, scale: _ArrayLikeFloat_co, size: Optional[_ShapeLike] = ... | |
) -> ndarray[Any, dtype[float64]]: ... | |
def triangular(self, left: float, mode: float, right: float, size: None = ...) -> float: ... # type: ignore[misc] | |
def triangular( | |
self, | |
left: _ArrayLikeFloat_co, | |
mode: _ArrayLikeFloat_co, | |
right: _ArrayLikeFloat_co, | |
size: Optional[_ShapeLike] = ..., | |
) -> ndarray[Any, dtype[float64]]: ... | |
def binomial(self, n: int, p: float, size: None = ...) -> int: ... # type: ignore[misc] | |
def binomial( | |
self, n: _ArrayLikeInt_co, p: _ArrayLikeFloat_co, size: Optional[_ShapeLike] = ... | |
) -> ndarray[Any, dtype[int_]]: ... | |
def negative_binomial(self, n: float, p: float, size: None = ...) -> int: ... # type: ignore[misc] | |
def negative_binomial( | |
self, n: _ArrayLikeFloat_co, p: _ArrayLikeFloat_co, size: Optional[_ShapeLike] = ... | |
) -> ndarray[Any, dtype[int_]]: ... | |
def poisson(self, lam: float = ..., size: None = ...) -> int: ... # type: ignore[misc] | |
def poisson( | |
self, lam: _ArrayLikeFloat_co = ..., size: Optional[_ShapeLike] = ... | |
) -> ndarray[Any, dtype[int_]]: ... | |
def zipf(self, a: float, size: None = ...) -> int: ... # type: ignore[misc] | |
def zipf( | |
self, a: _ArrayLikeFloat_co, size: Optional[_ShapeLike] = ... | |
) -> ndarray[Any, dtype[int_]]: ... | |
def geometric(self, p: float, size: None = ...) -> int: ... # type: ignore[misc] | |
def geometric( | |
self, p: _ArrayLikeFloat_co, size: Optional[_ShapeLike] = ... | |
) -> ndarray[Any, dtype[int_]]: ... | |
def hypergeometric(self, ngood: int, nbad: int, nsample: int, size: None = ...) -> int: ... # type: ignore[misc] | |
def hypergeometric( | |
self, | |
ngood: _ArrayLikeInt_co, | |
nbad: _ArrayLikeInt_co, | |
nsample: _ArrayLikeInt_co, | |
size: Optional[_ShapeLike] = ..., | |
) -> ndarray[Any, dtype[int_]]: ... | |
def logseries(self, p: float, size: None = ...) -> int: ... # type: ignore[misc] | |
def logseries( | |
self, p: _ArrayLikeFloat_co, size: Optional[_ShapeLike] = ... | |
) -> ndarray[Any, dtype[int_]]: ... | |
def multivariate_normal( | |
self, | |
mean: _ArrayLikeFloat_co, | |
cov: _ArrayLikeFloat_co, | |
size: Optional[_ShapeLike] = ..., | |
check_valid: Literal["warn", "raise", "ignore"] = ..., | |
tol: float = ..., | |
) -> ndarray[Any, dtype[float64]]: ... | |
def multinomial( | |
self, n: _ArrayLikeInt_co, pvals: _ArrayLikeFloat_co, size: Optional[_ShapeLike] = ... | |
) -> ndarray[Any, dtype[int_]]: ... | |
def dirichlet( | |
self, alpha: _ArrayLikeFloat_co, size: Optional[_ShapeLike] = ... | |
) -> ndarray[Any, dtype[float64]]: ... | |
def shuffle(self, x: ArrayLike) -> None: ... | |
def permutation(self, x: int) -> ndarray[Any, dtype[int_]]: ... | |
def permutation(self, x: ArrayLike) -> ndarray[Any, Any]: ... | |
_rand: RandomState | |
beta = _rand.beta | |
binomial = _rand.binomial | |
bytes = _rand.bytes | |
chisquare = _rand.chisquare | |
choice = _rand.choice | |
dirichlet = _rand.dirichlet | |
exponential = _rand.exponential | |
f = _rand.f | |
gamma = _rand.gamma | |
get_state = _rand.get_state | |
geometric = _rand.geometric | |
gumbel = _rand.gumbel | |
hypergeometric = _rand.hypergeometric | |
laplace = _rand.laplace | |
logistic = _rand.logistic | |
lognormal = _rand.lognormal | |
logseries = _rand.logseries | |
multinomial = _rand.multinomial | |
multivariate_normal = _rand.multivariate_normal | |
negative_binomial = _rand.negative_binomial | |
noncentral_chisquare = _rand.noncentral_chisquare | |
noncentral_f = _rand.noncentral_f | |
normal = _rand.normal | |
pareto = _rand.pareto | |
permutation = _rand.permutation | |
poisson = _rand.poisson | |
power = _rand.power | |
rand = _rand.rand | |
randint = _rand.randint | |
randn = _rand.randn | |
random = _rand.random | |
random_integers = _rand.random_integers | |
random_sample = _rand.random_sample | |
rayleigh = _rand.rayleigh | |
seed = _rand.seed | |
set_state = _rand.set_state | |
shuffle = _rand.shuffle | |
standard_cauchy = _rand.standard_cauchy | |
standard_exponential = _rand.standard_exponential | |
standard_gamma = _rand.standard_gamma | |
standard_normal = _rand.standard_normal | |
standard_t = _rand.standard_t | |
triangular = _rand.triangular | |
uniform = _rand.uniform | |
vonmises = _rand.vonmises | |
wald = _rand.wald | |
weibull = _rand.weibull | |
zipf = _rand.zipf | |
# Two legacy that are trivial wrappers around random_sample | |
sample = _rand.random_sample | |
ranf = _rand.random_sample | |