tea_tasting.config
#
Global configuration.
get_config(option=None)
#
Retrieve the current settings of the global configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
option |
str | None
|
The option name. |
None
|
Returns:
Type | Description |
---|---|
Any
|
The specified option value if its name is provided, or a dictionary containing all options otherwise. |
Examples:
Source code in src/tea_tasting/config.py
set_config(*, alpha=None, alternative=None, confidence_level=None, equal_var=None, n_obs=None, n_resamples=None, power=None, ratio=None, use_t=None, **kwargs)
#
Update the global configuration with specified settings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
alpha |
float | None
|
Significance level. Default is 0.05. |
None
|
alternative |
Literal['two-sided', 'greater', 'less'] | None
|
Alternative hypothesis. Default is |
None
|
confidence_level |
float | None
|
Confidence level for the confidence interval.
Default is |
None
|
equal_var |
bool | None
|
Defines whether equal variance is assumed. If |
None
|
n_obs |
int | Sequence[int] | None
|
Number of observations in the control and in the treatment together.
Default is |
None
|
n_resamples |
int | None
|
The number of resamples performed to form the bootstrap
distribution of a statistic. Default is |
None
|
power |
float | None
|
Statistical power. Default is 0.8. |
None
|
ratio |
float | int | None
|
Ratio of the number of observations in the treatment relative to the control. Default is 1. |
None
|
use_t |
bool | None
|
Defines whether to use the Student's t-distribution ( |
None
|
kwargs |
Any
|
User-defined global parameters. |
{}
|
Examples:
import tea_tasting as tt
tt.set_config(equal_var=True, use_t=False)
experiment = tt.Experiment(
sessions_per_user=tt.Mean("sessions"),
orders_per_session=tt.RatioOfMeans("orders", "sessions"),
orders_per_user=tt.Mean("orders"),
revenue_per_user=tt.Mean("revenue"),
)
experiment.metrics["orders_per_user"]
#> Mean(value='orders', covariate=None, alternative='two-sided',
#> confidence_level=0.95, equal_var=True, use_t=False)
Source code in src/tea_tasting/config.py
config_context(*, alpha=None, alternative=None, confidence_level=None, equal_var=None, n_obs=None, n_resamples=None, power=None, ratio=None, use_t=None, **kwargs)
#
A context manager that temporarily modifies the global configuration.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
alpha |
float | None
|
Significance level. Default is 0.05. |
None
|
alternative |
Literal['two-sided', 'greater', 'less'] | None
|
Alternative hypothesis. Default is |
None
|
confidence_level |
float | None
|
Confidence level for the confidence interval.
Default is |
None
|
equal_var |
bool | None
|
Defines whether equal variance is assumed. If |
None
|
n_obs |
int | Sequence[int] | None
|
Number of observations in the control and in the treatment together.
Default is |
None
|
n_resamples |
int | None
|
The number of resamples performed to form the bootstrap
distribution of a statistic. Default is |
None
|
power |
float | None
|
Statistical power. Default is 0.8. |
None
|
ratio |
float | int | None
|
Ratio of the number of observations in the treatment relative to the control. Default is 1. |
None
|
use_t |
bool | None
|
Defines whether to use the Student's t-distribution ( |
None
|
kwargs |
Any
|
User-defined global parameters. |
{}
|
Examples:
import tea_tasting as tt
with tt.config_context(equal_var=True, use_t=False):
experiment = tt.Experiment(
sessions_per_user=tt.Mean("sessions"),
orders_per_session=tt.RatioOfMeans("orders", "sessions"),
orders_per_user=tt.Mean("orders"),
revenue_per_user=tt.Mean("revenue"),
)
experiment.metrics["orders_per_user"]
#> Mean(value='orders', covariate=None, alternative='two-sided',
#> confidence_level=0.95, equal_var=True, use_t=False)