neuraltrain.models.dummy_predictor.DummyPredictor

pydantic model neuraltrain.models.dummy_predictor.DummyPredictor[source][source]

Dummy predictor that makes predictions using simple rules based on the target distribution, analogous to sklearn.dummy.DummyClassifier.

Parameters:
  • mode (tp.Literal[) – “most_frequent”, “most_frequent_multilabel”, “stratified_multilabel”, “mean”, “auto”,

  • ]

    Strategy used to derive predictions from the training targets.

    • "most_frequent": predict the most frequent class (single-label classification, constant output).

    • "most_frequent_multilabel": predict the most frequent binary value per class independently (multilabel classification, constant output per class).

    • "stratified_multilabel": sample each class label independently from a Bernoulli distribution with probability equal to the class prevalence in the training set (multilabel classification, stochastic output). Produces macro-F1 scores that reflect the class prior rather than collapsing to 0 on rare-class tasks.

    • "mean": predict the mean of the targets (regression).

    • "auto": automatically pick a mode based on the dtype and shape of the targets. Multilabel integer targets resolve to "stratified_multilabel".

  • random_state (int | None) – Seed used to initialize the torch.Generator that drives the Bernoulli sampling in stratified_multilabel mode. None (default) falls back to the global RNG state (controlled e.g. by Lightning’s seed_everything). Ignored by the other modes.

Fields:
field mode: Literal['most_frequent', 'most_frequent_multilabel', 'stratified_multilabel', 'mean', 'auto'] = 'auto'[source]
field random_state: int | None = None[source]
build(y_train: Tensor) DummyPredictorModel[source][source]