metasyn.distribution.uniform
Uniform distributions and fitters.
Classes
|
Base class for all time/date/datetime uniform distributions. |
|
Base class for date/time/datetime uniform distributions. |
|
Uniform distribution for floating point type. |
|
Fitter for continuous uniform distribution. |
|
Uniform DateTime distribution. |
|
Fitter for datetime uniform distribution. |
|
Uniform date distribution. |
|
Fitter for date uniform distribution. |
|
Uniform discrete distribution. |
|
Fitter for discrete uniform distribution. |
|
Uniform time distribution. |
|
Fitter for time uniform distribution. |
- class metasyn.distribution.uniform.BaseDTUniformDistribution(lower, upper, precision='microseconds')
Bases:
BaseDistributionBase class for all time/date/datetime uniform distributions.
- Parameters:
lower (Any)
upper (Any)
precision (str)
- round(time_obj)
Round down any time object with the precision.
- Parameters:
time_obj (
Any) – Object to round down.- Returns:
Time/date/datetime object rounded down to the measured precision.
- Return type:
obj
- draw()
Draw a random element from the fitted distribution.
- Return type:
datetime
- abstractmethod fromisoformat(dt_obj)
Convert string to iso format.
- Parameters:
dt_obj (str)
- property minimum_delta: timedelta
Get the minimum time delta.
- information_criterion(values)
Get the BIC value for a particular set of values.
- Parameters:
values (array_like) – Values to determine the BIC value of.
- class metasyn.distribution.uniform.BaseDTUniformFitter(privacy)
Bases:
BaseFitterBase class for date/time/datetime uniform distributions.
- Parameters:
privacy (BasePrivacy)
- class metasyn.distribution.uniform.ContinuousUniformDistribution(lower, upper)
Bases:
ScipyDistributionUniform distribution for floating point type.
This class implements the uniform distribution between a minimum and maximum.
- Parameters:
lower (float) – Lower bound for uniform distribution.
upper (float) – Upper bound for uniform distribution.
Examples
>>> UniformDistribution(lower=-3.0, upper=10.0)
- name
core.uniform
- unique
False
- version
1.0
- var_type
continuous
- classmethod default_distribution(var_type=None)
Get a distribution with default parameters.
- Return type:
BaseDistribution
- name: str = 'core.uniform'
The identifier for the implemented distribution
- var_type: Union[str, Sequence[str]] = 'continuous'
The variable type of the distribution
- class metasyn.distribution.uniform.ContinuousUniformFitter(privacy)
Bases:
BaseFitterFitter for continuous uniform distribution.
- Parameters:
privacy (BasePrivacy)
- dist_class
<class ‘metasyn.distribution.uniform.ContinuousUniformDistribution’>
- version
1.0
- var_type
continuous
- privacy
none
- distribution
alias of
ContinuousUniformDistribution
- class metasyn.distribution.uniform.DateTimeUniformDistribution(lower, upper, precision='microseconds')
Bases:
BaseDTUniformDistributionUniform DateTime distribution.
Datetime objects will be uniformly distributed between a start and end date time.
- Parameters:
lower (str or datetime.datetime) – Earliest possible datetime to be generated from this distribution. String formatted in ISO format, see examples below or use datetime objects from the python standard library datetime.
upper (str or datetime.datetime) – Latest possible datetime to be generated from this distribution. String formatted in ISO format, see examples below or use datetime objects from the python standard library datetime.
precision (str) – Most precise measure of datetime that the distribution will take into account. For example, if precision == “seconds”, then the microseconds will always be set to 0. Possible values: [“microseconds”, “seconds”, “minutes”, “hours”, “days”].
Examples
>>> DateTimeUniformDistribution(lower="2022-07-15T10:39", upper="2022-08-15T10:39", precision="minutes")
- name
core.uniform
- unique
False
- version
1.0
- var_type
datetime
- fromisoformat(dt_obj)
Convert string to iso format.
- Return type:
datetime- Parameters:
dt_obj (str)
- classmethod default_distribution(var_type=None)
Get a distribution with default parameters.
- Return type:
BaseDistribution
- name: str = 'core.uniform'
The identifier for the implemented distribution
- var_type: Union[str, Sequence[str]] = 'datetime'
The variable type of the distribution
- class metasyn.distribution.uniform.DateTimeUniformFitter(privacy)
Bases:
BaseDTUniformFitterFitter for datetime uniform distribution.
- Parameters:
privacy (BasePrivacy)
- dist_class
<class ‘metasyn.distribution.uniform.DateTimeUniformDistribution’>
- version
1.0
- var_type
datetime
- privacy
none
- distribution
alias of
DateTimeUniformDistribution
- class metasyn.distribution.uniform.DateUniformDistribution(lower, upper)
Bases:
BaseDTUniformDistributionUniform date distribution.
Date objects will be uniformly distributed between a start and end date.
- Parameters:
lower (str or datetime.date) – Earliest possible date to be generated from this distribution. String formatted in ISO format, see examples below or use date objects from the python standard library datetime.
upper (str or datetime.date) – Latest possible date to be generated from this distribution. String formatted in ISO format, see examples below or use date objects from the python standard library datetime.
Examples
>>> DateUniformDistribution(lower="10:39:12", upper="10:39:45", precision="seconds")
- name
core.uniform
- unique
False
- version
1.0
- var_type
date
- fromisoformat(dt_obj)
Convert string to iso format.
- Return type:
date- Parameters:
dt_obj (str)
- round(time_obj)
Round down any time object with the precision.
- Parameters:
time_obj – Object to round down.
- Returns:
Time/date/datetime object rounded down to the measured precision.
- Return type:
obj
- classmethod default_distribution(var_type=None)
Get a distribution with default parameters.
- Return type:
BaseDistribution
- name: str = 'core.uniform'
The identifier for the implemented distribution
- var_type: Union[str, Sequence[str]] = 'date'
The variable type of the distribution
- class metasyn.distribution.uniform.DateUniformFitter(privacy)
Bases:
BaseDTUniformFitterFitter for date uniform distribution.
- Parameters:
privacy (BasePrivacy)
- dist_class
<class ‘metasyn.distribution.uniform.DateUniformDistribution’>
- version
1.0
- var_type
date
- privacy
none
- distribution
alias of
DateUniformDistribution
- class metasyn.distribution.uniform.DiscreteUniformDistribution(lower, upper)
Bases:
ScipyDistributionUniform discrete distribution.
It differs from the floating point uniform distribution by being a discrete distribution instead.
- Parameters:
lower (int) – Lower bound (inclusive) of the uniform distribution.
upper (int) – Upper bound (exclusive) of the uniform distribution.
Examples
>>> DiscreteUniformDistribution(lower=3, upper=20)
- name
core.uniform
- unique
False
- version
1.0
- var_type
discrete
- classmethod default_distribution(var_type=None)
Get a distribution with default parameters.
- Return type:
BaseDistribution
- name: str = 'core.uniform'
The identifier for the implemented distribution
- var_type: Union[str, Sequence[str]] = 'discrete'
The variable type of the distribution
- class metasyn.distribution.uniform.DiscreteUniformFitter(privacy)
Bases:
BaseFitterFitter for discrete uniform distribution.
- Parameters:
privacy (BasePrivacy)
- dist_class
<class ‘metasyn.distribution.uniform.DiscreteUniformDistribution’>
- version
1.0
- var_type
discrete
- privacy
none
- distribution
alias of
DiscreteUniformDistribution
- class metasyn.distribution.uniform.TimeUniformDistribution(lower, upper, precision='microseconds')
Bases:
BaseDTUniformDistributionUniform time distribution.
Time objects will be uniformly distributed between a start and end time.
- Parameters:
lower (str or datetime.time) – Earliest possible time to be generated from this distribution. String formatted in ISO format, see examples below or use time objects from the python standard library datetime.
upper (str or datetime.time) – Latest possible time to be generated from this distribution. String formatted in ISO format, see examples below or use time objects from the python standard library datetime.
precision (str) – Most precise measure of time that the distribution will take into account. For example, if precision == “seconds”, then the microseconds will always be set to 0. Possible values: [“microseconds”, “seconds”, “minutes”, “hours”].
Examples
>>> TimeUniformDistribution(lower="10:39:12", upper="10:39:45", precision="seconds")
- name
core.uniform
- unique
False
- version
1.0
- var_type
time
- fromisoformat(dt_obj)
Convert string to iso format.
- Return type:
time- Parameters:
dt_obj (str)
- classmethod default_distribution(var_type=None)
Get a distribution with default parameters.
- Return type:
BaseDistribution
- draw()
Draw a random element from the fitted distribution.
- name: str = 'core.uniform'
The identifier for the implemented distribution
- var_type: Union[str, Sequence[str]] = 'time'
The variable type of the distribution
- class metasyn.distribution.uniform.TimeUniformFitter(privacy)
Bases:
BaseDTUniformFitterFitter for time uniform distribution.
- Parameters:
privacy (BasePrivacy)
- dist_class
<class ‘metasyn.distribution.uniform.TimeUniformDistribution’>
- version
1.0
- var_type
time
- privacy
none
- distribution
alias of
TimeUniformDistribution