[ENH] return histogram option in IndividualBOSS
#8636
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #8580
This pull request introduces a new feature to the
IndividualBOSS
classifier in thesktime
library, allowing it to optionally store histograms of words during thefit
process. This feature is controlled by a new parameter,store_histogram
, and is accompanied by updates to the class attributes, methods, and corresponding tests.Enhancements to
IndividualBOSS
:New Parameter and Attribute:
store_histogram
parameter (default:False
) to the__init__
method to control whether histograms of words are stored duringfit
. [1] [2]histograms_
, to store the word histograms for each time series instance whenstore_histogram
is enabled. [1] [2]New Method for Histogram Creation:
_create_histograms
method to generate and store histograms based on the transformed data, using the transformer's vocabulary. This method is invoked during_fit
ifstore_histogram
isTrue
.Unit Tests:
Testing
store_histogram=True
:test_individual_boss_histograms
to verify the type and size of thehistograms_
attribute whenstore_histogram
is enabled. It ensures that the histograms are stored as a list of dictionaries with valid keys and values.Testing
store_histogram=False
:test_individual_boss_no_histograms
to confirm that thehistograms_
attribute remains an empty list whenstore_histogram
is disabled.Introduces the 'store_histogram' parameter to IndividualBOSS, allowing users to optionally store word histograms for each training instance. Updates the class to document and implement this feature, and adds tests to verify correct behavior when histograms are stored or omitted.For all contributions
How to: add yourself to the all-contributors file in the
sktime
root directory (not theCONTRIBUTORS.md
). Common badges:code
- fixing a bug, or adding code logic.doc
- writing or improving documentation or docstrings.bug
- reporting or diagnosing a bug (get this pluscode
if you also fixed the bug in the PR).maintenance
- CI, test framework, release.See here for full badge reference