autopycoin.models.QuantileModel#

class autopycoin.models.QuantileModel(*args, **kwargs)[source]#

Overloads tensorflow Model class to integrate a quantiles attribute.

During the compiling phase, the model checks the existence of the attribute quantiles in each loss function. If the test is positive then the model defines several attributes based on quantiles found in the loss functions. The model propagates the attributes associated to quantiles to the sublayers. Be carefull, if the check is positive the model is no more built.

During the first call, all compiled losses and metrics are build and a second check is perfomed to ensure that Each output is not associated with different quantiles values otherwise it raises a ValueError.

When subclassing this model, a pre/post-processing methods can be defined. Also a post_processing are already defined in order to transpose the quantiles dimensions.

See autopycoin.layers.QuantileLayer for more information for how to acces quantiles dimension in building phase.

Attributes
has_quantilesbool

Return True if quantiles exists else False.

quantileslist[List[float]] or None

Return quantiles attribute.

n_quantileslist[int] or int

Return the number of quantiles.

compile(optimizer='rmsprop', loss=None, metrics=None, loss_weights=None, weighted_metrics=None, run_eagerly=None, steps_per_execution=None, **kwargs)[source]#

Compile method from tensorflow.

When compiling with losses defining a quantiles attribute it propagates this attribute to the submodels and sublayers.

losses_wrapper(loss: keras.losses.LossFunctionWrapper) Union[Callable, keras.losses.LossFunctionWrapper][source]#

Add or remove the quantile dimension to y_pred and y_true respectively.

metrics_wrapper(metric: Union[None, str, keras.metrics.Metric, List[Union[str, keras.metrics.Metric]]]) Union[Callable, keras.losses.LossFunctionWrapper][source]#

Add or remove the quantile dimension to y_pred and y_true respectively.