skpro.baselines package¶
Submodules¶
skpro.baselines.density module¶
-
class
skpro.baselines.density.
DensityBaseline
(adapter=None)[source]¶ Bases:
skpro.base.ProbabilisticEstimator
-
class
Distribution
(estimator, X, selection=slice(None, None, None), mode='elementwise')[source]¶ Bases:
skpro.base.Distribution
-
X
¶ Reference of the test features that are ought to correspond with the predictive distribution represented by the interface.
The interface methods (e.g. pdf) can use X to construct and exhibit the predictive distribution properties of the interface (e.g. construct the predicted pdf based on X)
Note that X automatically reflects the feature point for which the interface is ought to represent the distributional prediction. For given M x n features, X will thus represent an 1 x n vector that provides the bases for the predicted distribution. However, if the
vectorvalued()
decorator is applied X will represent the full M x n matrix for an efficient vectorized implementation.Getter: Returns the test features based on the current subset selection Setter: Sets the data reference Type: array
-
cdf
(x, *args, **kwargs)¶
-
lp2
¶
-
mean
(*args, **kwargs)¶ Mean prediction
Returns: Return type: The mean prediction that corresponds to self.X
-
pdf
(x, *args, **kwargs)¶
-
point
¶
-
ppf
(q, *args, **kwargs)¶ Percent point function (inverse of cdf — percentiles).
Parameters: q – Returns: Return type: float
-
replicate
(selection=None, mode=None)¶ Replicates the distribution object
Parameters: - selection (None | slice | int (optional)) – Subset point selection of the distribution copy
- mode (str (optional)) – Interface mode (‘elementwise’ or ‘batch’)
Returns: Return type: skpro.base.ProbabilisticEstimator.Distribution
-
std
¶
-
-
class
ImplementsEnhancedInterface
(name, bases, clsdict)¶ Bases:
abc.ABCMeta
Meta-class for distribution interface
Enhances the distribution interface behind the scenes with automatic caching and syntactic sugar for element-wise access of the distributions
-
mro
() → list¶ return a type’s method resolution order
-
register
(subclass)¶ Register a virtual subclass of an ABC.
Returns the subclass, to allow usage as a class decorator.
-
-
fit
(X, y)[source]¶ Fits the model
Parameters: - X (numpy array or sparse matrix of shape [n_samples,n_features]) – Training data
- y (numpy array of shape [n_samples, n_targets]) – Target values. Will be cast to X’s dtype if necessary
Returns: self
Return type: returns an instance of self.
-
get_params
(deep=True)¶ Get parameters for this estimator.
Parameters: deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators. Returns: params – Parameter names mapped to their values. Return type: mapping of string to any
-
name
()¶
-
predict
(X)¶ Predicts using the model
Parameters: X ({array-like, sparse matrix}, shape = (n_samples, n_features)) – Samples. Returns: Returns predicted distributions Return type: Distribution
interface representing n_samples predictions
-
score
(X, y, sample=True, return_std=False)¶ Returns the log-loss score
Parameters: - X (np.array) – Features
- y (np.array) – Labels
- sample (boolean, default=True) – If true, loss will be averaged across the sample
- return_std (boolean, default=False) – If true, the standard deviation of the loss sample will be returned
Returns: Log-loss score
Return type: mixed
-
set_params
(**params)¶ Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form
<component>__<parameter>
so that it’s possible to update each component of a nested object.Returns: Return type: self
-
class