skwdro.operations_research.NewsVendor#

class skwdro.operations_research.NewsVendor(rho: float = 0.01, k: float = 5, u: float = 7, cost: str = 't-NC-1-2', l2_reg: float = 0.0, solver_reg: float = 0.01, learning_rate: float | None = None, n_zeta_samples: int = 10, solver: str = 'entropic', random_state: int = 0, n_iter: int | ~typing.Tuple[int, int] | None=None, opt_cond: OptCondTorch | None = <skwdro.solvers.optim_cond.OptCondTorch object>)[source]#

A NewsVendor Wasserstein Distributionally Robust Estimator.

The cost function is XXX Uncertainty is XXX

Parameters:
rhofloat, default=1e-2

Robustness radius

kfloat, default=5

Buying cost

ufloat, default=7

Selling cost

cost: str, default=”n-NC-1-2”

Tiret-separated code to define the transport cost: “<engine>-<cost id>-<k-norm type>-<power>” for \(c(x, y):=\|x-y\|_k^p\)

solver: str, default=’entropic’

Solver to be used: ‘entropic’, ‘entropic_torch’ (_pre or _post) or ‘dedicated’

n_zeta_samples: int, default=10

number of adversarial samples to draw

learning_rate: float | None, default=None

if not set, use a default value depending on the problem, else specifies the stepsize of the gradient descent algorithm

opt_cond: Optional[OptCondTorch]

optimality condition, see OptCondTorch

Attributes:
coef_float

parameter vector (\(w\) in the cost function formula)

Examples

>>> from skwdro.operations_research import NewsVendor
>>> import numpy as np
>>> X = np.random.exponential(scale=2.0,size=(20,1))
>>> estimator = NewsVendor()
>>> estimator.fit(X)
NewsVendor()