#11290·sktime

[ENH] use logging instead of print for verbose output in HIVE-COTE classifiers (and elsewhere)

Author: subinita01Created Sep 24, 2026Updated Sep 29, 2026

Describe the bug

Several estimators report progress with plain print() calls, switched on by a verbose parameter. The output always goes to stdout and bypasses the logging module, so it cannot be filtered, redirected or silenced with standard logging handlers.

For example, in HIVECOTEV2._fit (_hivecote_v2.py):

if self.verbose > 0:
    print("STC ", datetime.now().strftime("%H:%M:%S %d/%m/%Y"))

HIVECOTEV1 does the same (11 calls), as do ElasticEnsemble, ProximityForest, the shapelet transform and some deep learning / foundation-model wrappers.

This causes three problems:

  • users cannot send, filter or silence this output with standard logging handlers
  • output always goes to stdout, which clutters logs in pipelines, notebooks and benchmarking runs
  • output control is inconsistent across the codebase, since other modules (e.g. utils/parallel.py, transformations/compose/_logger.py) already use logging

To Reproduce

import logging
from sktime.classification.hybrid import HIVECOTEV2
from sktime.datasets import load_unit_test

X_train, y_train = load_unit_test(split="train", return_X_y=True)

logging.basicConfig(level=logging.DEBUG)  # attach a root handler at the lowest level

clf = HIVECOTEV2(verbose=1)  # [TODO: add small-parameter settings so this runs quickly]
clf.fit(X_train, y_train)

Progress messages are written to stdout via print(). The logging handler receives nothing, so it cannot filter or redirect them.

Expected behavior Progress messages should go through logging, so users can control them with standard handlers and levels.

Proposed first step, limited to the two HIVE-COTE classifiers, which are small and self-contained:

  • add a module-level logger = logging.getLogger(__name__)
  • replace the print(...) calls with logger.info(...) (or debug)
  • keep the current behavior of verbose: with verbose > 0, users should still see the progress messages by default, so nothing breaks
  • update the verbose docstring, which currently says "Level of output printed to the console"
  • add a test (via caplog/capsys) checking that output is still produced when verbose=1

If this works, the same pattern can be applied to the other estimators in follow-up PRs.

Additional context Alternatives considered:

  1. Replace print with logger.info directly. This is the simplest option, but it quietly changes behavior: Python's default logger only shows WARNING and above, so verbose=1 would print nothing unless the user configures logging.
  2. Log unconditionally and deprecate verbose. This is cleaner in the long run, but it changes the public API and needs a deprecation cycle.
  3. Add a shared helper in sktime.utils that respects verbose and sends output through logging. This gives consistent behavior across estimators, but it is a larger design decision.

Which approach would the maintainers prefer? I'm happy to implement the HIVE-COTE part once there's agreement.

Classification modules that use print() for this, outside of tests/doctests:

  • classification/hybrid/_hivecote_v1.py
  • classification/hybrid/_hivecote_v2.py
  • classification/distance_based/_elastic_ensemble.py
  • classification/distance_based/_proximity_forest.py
  • classification/deep_learning/_pytorch.py
  • classification/deep_learning/base/_base_torch.py
  • classification/foundation_models/momentfm.py