Description
Describe the feature or idea you want to propose
It might be beneficial to include an implementation of TS2Vec (Towards Universal Representation of Time Series) in the library. TS2Vec is a popular and efficient contrastive learning approach for time series representation. It could be implemented as a transformer similar to Rocket or TSFresh. The original author's code is available here (MIT licence). I would be happy to add the implementation if this is something the maintainers/developers of aeon agree should be included and if it aligns with future development.
Describe your proposed solution
I believe the implementation could be similar to Rocket. At first, it could support only encoding_window='full_series'
, so the returned array would always have the shape n_instances x output_dim
, primarily useful for classification.
Example:
trf = TS2Vec(output_dim=320)
trf.fit(X_train)
X_train = trf.transform(X_train)
X_test = trf.transform(X_test)
Describe alternatives you've considered, if relevant
No response
Additional context
Classification accuracy of TS2Vec compared to 2 other randomly selected TSC models
TS2Vec | Catch22 | MultiRocket | dataset |
---|---|---|---|
0.84 | 0.85 | 0.9 | ACSF1 |
0.565217 | 0.734015 | 0.828645 | Adiac |
0.788571 | 0.748571 | 0.874286 | ArrowHead |
0.986667 | 0.913333 | 1 | BME |
0.766667 | 0.6 | 0.766667 | Beef |
0.8 | 0.75 | 0.85 | BeetleFly |
0.8 | 0.9 | 0.9 | BirdChicken |
1 | 0.943333 | 0.995556 | CBF |
0.833333 | 0.766667 | 0.933333 | Car |
0.982507 | 0.900875 | 0.976676 | Chinatown |
0.590104 | 0.603906 | 0.7875 | ChlorineConcentration |
0.83913 | 0.792754 | 0.95 | CinCECGTorso |
1 | 1 | 1 | Coffee |
0.636 | 0.732 | 0.804 | Computers |
0.766667 | 0.582051 | 0.797436 | CricketX |
0.75641 | 0.55641 | 0.851282 | CricketY |
0.776923 | 0.635897 | 0.828205 | CricketZ |
0.691131 | 0.70625 | 0.78 | Crop |
0.977124 | 0.895425 | 0.964052 | DiatomSizeReduction |
0.741007 | 0.705036 | 0.76259 | DistalPhalanxOutlineAgeGroup |
0.735507 | 0.800725 | 0.804348 | DistalPhalanxOutlineCorrect |
0.683453 | 0.661871 | 0.690647 | DistalPhalanxTW |
0.91 | 0.82 | 0.92 | ECG200 |
0.942667 | 0.937333 | 0.946444 | ECG5000 |
1 | 0.778165 | 1 | ECGFiveDays |
0.577348 | 0.546961 | 0.640884 | EOGHorizontalSignal |
0.505525 | 0.505525 | 0.535912 | EOGVerticalSignal |
0.748201 | 0.748201 | 0.726619 | Earthquakes |
0.694462 | 0.73233 | 0.729737 | ElectricDevices |
0.384 | 0.364 | 0.626 | EthanolLevel |
0.833728 | 0.761538 | 0.799408 | FaceAll |
0.965909 | 0.602273 | 0.931818 | FaceFour |
0.943902 | 0.698049 | 0.96 | FacesUCR |
0.714286 | 0.593407 | 0.859341 | FiftyWords |
0.942857 | 0.771429 | 0.988571 | Fish |
0.928788 | 0.917424 | 0.952273 | FordA |
0.780247 | 0.750617 | 0.832099 | FordB |
0.994386 | 0.997895 | 0.999649 | FreezerRegularTrain |
0.960702 | 0.960351 | 0.994737 | FreezerSmallTrain |
0.98 | 0.96 | 1 | GunPoint |
0.996835 | 0.974684 | 1 | GunPointAgeSpan |
1 | 0.993671 | 1 | GunPointMaleVersusFemale |
1 | 1 | 1 | GunPointOldVersusYoung |
0.790476 | 0.609524 | 0.733333 | Ham |
0.483766 | 0.470779 | 0.512987 | Haptics |
0.59375 | 0.5625 | 0.71875 | Herring |
0.387273 | 0.418182 | 0.474545 | InlineSkate |
1 | 1 | 1 | InsectEPGRegularTrain |
1 | 1 | 1 | InsectEPGSmallTrain |
0.632828 | 0.564646 | 0.669192 | InsectWingbeatSound |
0.962099 | 0.878523 | 0.969874 | ItalyPowerDemand |
0.872 | 0.826667 | 0.872 | LargeKitchenAppliances |
0.868852 | 0.688525 | 0.721311 | Lightning2 |
0.835616 | 0.671233 | 0.835616 | Lightning7 |
0.941151 | 0.904478 | 0.928785 | Mallat |
0.933333 | 0.85 | 0.933333 | Meat |
0.739474 | 0.748684 | 0.801316 | MedicalImages |
0.62987 | 0.61039 | 0.564935 | MiddlePhalanxOutlineAgeGroup |
0.817869 | 0.769759 | 0.838488 | MiddlePhalanxOutlineCorrect |
0.564935 | 0.545455 | 0.532468 | MiddlePhalanxTW |
0.90433 | 0.920825 | 0.980619 | MixedShapesRegularTrain |
0.863093 | 0.857732 | 0.964536 | MixedShapesSmallTrain |
0.866613 | 0.879393 | 0.944888 | MoteStrain |
0.876845 | 0.844275 | 0.959796 | NonInvasiveFetalECGThorax1 |
0.889567 | 0.874809 | 0.967939 | NonInvasiveFetalECGThorax2 |
0.768595 | 0.690083 | 0.966942 | OSULeaf |
0.833333 | 0.766667 | 0.933333 | OliveOil |
0.778555 | 0.79021 | 0.851981 | PhalangesOutlinesCorrect |
0.290084 | 0.304325 | 0.357595 | Phoneme |
1 | 1 | 1 | Plane |
0.955556 | 0.95 | 0.983333 | PowerCons |
0.853659 | 0.839024 | 0.853659 | ProximalPhalanxOutlineAgeGroup |
0.883162 | 0.831615 | 0.924399 | ProximalPhalanxOutlineCorrect |
0.795122 | 0.765854 | 0.795122 | ProximalPhalanxTW |
0.578667 | 0.498667 | 0.52 | RefrigerationDevices |
0.421333 | 0.501333 | 0.536 | ScreenType |
0.93 | 0.933333 | 0.958333 | SemgHandGenderCh2 |
0.795556 | 0.808889 | 0.773333 | SemgHandMovementCh2 |
0.895556 | 0.857778 | 0.926667 | SemgHandSubjectCh2 |
0.988889 | 0.977778 | 1 | ShapeletSim |
0.866667 | 0.785 | 0.926667 | ShapesAll |
0.728 | 0.8 | 0.832 | SmallKitchenAppliances |
0.986667 | 0.893333 | 0.986667 | SmoothSubspace |
0.875208 | 0.831947 | 0.886855 | SonyAIBORobotSurface1 |
0.887723 | 0.919203 | 0.940189 | SonyAIBORobotSurface2 |
0.963453 | 0.968067 | 0.981302 | StarLightCurves |
0.972973 | 0.92973 | 0.972973 | Strawberry |
0.9248 | 0.896 | 0.9808 | SwedishLeaf |
0.967839 | 0.965829 | 0.98191 | Symbols |
0.993333 | 0.983333 | 0.996667 | SyntheticControl |
0.916667 | 0.894737 | 0.951754 | ToeSegmentation1 |
0.892308 | 0.776923 | 0.915385 | ToeSegmentation2 |
1 | 1 | 1 | Trace |
0.988586 | 0.806848 | 0.998244 | TwoLeadECG |
0.9995 | 0.844 | 1 | TwoPatterns |
0.993056 | 0.861111 | 0.993056 | UMD |
0.907314 | 0.824121 | 0.980179 | UWaveGestureLibraryAll |
0.771915 | 0.758236 | 0.867672 | UWaveGestureLibraryX |
0.686767 | 0.705472 | 0.807091 | UWaveGestureLibraryY |
0.739252 | 0.703238 | 0.814908 | UWaveGestureLibraryZ |
0.996269 | 0.998053 | 0.999513 | Wafer |
0.814815 | 0.462963 | 0.851852 | Wine |
0.681818 | 0.540752 | 0.775862 | WordSynonyms |
0.662338 | 0.753247 | 0.766234 | Worms |
0.714286 | 0.844156 | 0.766234 | WormsTwoClass |
0.846 | 0.779333 | 0.92 | Yoga |