Repository navigation
[BUG] Give each representation its own seed in interval forests - #3974
TonyBagnall wants to merge 1 commit into
Conversation
BaseIntervalForest passed the tree's seed to the interval selector of every series transformer, so DrCIF and STSF drew the intervals of each representation from the same random stream. RSTSF did the same with random_state. Each representation after the first now gets its own seed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thank you for contributing to
|
Reference Issues/PRs
None
What does this implement/fix? Explain your changes.
Found this out when experimenting with alternatives. This is by claude and their comments, I will work through and check before taking out of draft
Interval forests with several representations drew every representation's intervals from the same random stream:
BaseIntervalForest._fit_estimatorpassed the tree'sseedto the interval selector of each series transformer. This affectsDrCIFClassifier,DrCIFRegressorandSupervisedTimeSeriesForest, which use the base series, the periodogram and first differences.RSTSF._fitpassedrandom_state=self.random_stateto theSupervisedIntervalsof all four of its representations.Interval i of each representation therefore had the same channel, start/end choice and length draws, varying only where the representations differed in length. With
random_state=0, 65% of the intervals at the same index were identical across representations.This is a regression from #545. The original DrCIF drew the intervals of all representations in sequence from one
rng.Fix: each representation after the first gets its own seed, drawn from the tree's
rng(inRSTSF, fromcheck_random_state(self.random_state)). The first representation keeps the tree's seed, so forests with one representation (CIF, TSF, RISE,IntervalForestClassifier) give exactly the same results as before.RISTClassifierandRISTRegressoralready drew a new state per representation and are unchanged.The expected results change only for
DrCIFClassifier,RSTSFandSupervisedTimeSeriesForest, which have been regenerated.DrCIFRegressoris excluded from the expected results.Results
Default
DrCIFClassifier(200 trees) on 100 UCR datasets, using the default train/test splits, 5 seeds each, main against this branch. The 28 slowest UCR datasets were left out. Datasets with variable lengths or missing values use their_eqand_nmvversions. The scores are averaged over seeds; the comparison is over datasets.With independent intervals, the ensemble is more diverse:
The fix adds one random draw per representation per tree, so it should have no effect on fit time.
Does your contribution introduce a new dependency? If yes, which one?
No.
Any other comments?
New tests:
series_transformers=[None, None]) must sample different intervals for each copy, for both random and supervised selection. This test fails on main;RSTSFmust give each representation'sSupervisedIntervalsa different seed.Tested locally:
aeon/base,aeon/classification,aeon/regressionandaeon/transformations;test_all_estimatorsforDrCIFClassifier,RSTSFandSupervisedTimeSeriesForest, including the expected-results checks;