{"id":22713058,"url":"https://github.com/anr-myel/self-rocket","last_synced_at":"2025-04-13T17:35:18.985Z","repository":{"id":267260401,"uuid":"860342790","full_name":"ANR-MYEL/SelF-Rocket","owner":"ANR-MYEL","description":"Code related to the paper \"Time series classification with random convolution kernels: pooling operators and input representations matter\"","archived":false,"fork":false,"pushed_at":"2025-03-10T15:41:27.000Z","size":3038,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-27T08:22:13.310Z","etag":null,"topics":["rocket","time-series","time-series-classification"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/2409.01115v2","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ANR-MYEL.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-20T09:00:44.000Z","updated_at":"2025-03-13T11:36:21.000Z","dependencies_parsed_at":"2025-01-02T16:47:51.042Z","dependency_job_id":null,"html_url":"https://github.com/ANR-MYEL/SelF-Rocket","commit_stats":null,"previous_names":["anr-myel/self-rocket"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ANR-MYEL%2FSelF-Rocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ANR-MYEL%2FSelF-Rocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ANR-MYEL%2FSelF-Rocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ANR-MYEL%2FSelF-Rocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ANR-MYEL","download_url":"https://codeload.github.com/ANR-MYEL/SelF-Rocket/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248752877,"owners_count":21156169,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["rocket","time-series","time-series-classification"],"created_at":"2024-12-10T14:08:02.506Z","updated_at":"2025-04-13T17:35:18.969Z","avatar_url":"https://github.com/ANR-MYEL.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SelF-Rocket\n\n\nThis repository contains the code related to the paper      \n\n**Time series classification with random convolution kernels: pooling operators and input representations matter**\n\n*Preprint*: [arxiv:2409.01115](https://arxiv.org/abs/2409.01115v2)\n\n\u003e \u003cdiv align=\"justify\"\u003eThis article presents a new approach based on MiniRocket, called SelF-Rocket, for fast time series classification (TSC). Unlike existing approaches based on random convolution kernels, it dynamically selects the best couple of input representations and pooling operator during the training process. SelF-Rocket achieves state-of-the-art accuracy on the University of California Riverside (UCR) TSC benchmark datasets.\u003c/div\u003e\n\n## Reference\nPlease cite:\n```\n@misc{lo2025timeseriesclassificationrandom,\n      title={Time series classification with random convolution kernels: pooling operators and input representations matter}, \n      author={Mouhamadou Mansour Lo and Gildas Morvan and Mathieu Rossi and Fabrice Morganti and David Mercier},\n      year={2025},\n      eprint={2409.01115},\n      archivePrefix={arXiv},\n      primaryClass={cs.LG},\n      url={https://arxiv.org/abs/2409.01115}, \n}\n```\n\n## Results\n\n**Note:  Results initially presented were incorrect.**\n\nHydra + SelF-Rocket is as accurate as Hydra + MultiRocket and HIVE-COTE v2.0, despite having less features, and also has a relatively shorter classifier prediction time.\n\n### Comparison of SelF-Rocket and other SOTA methods performance (critical difference diagram and heatmap)\n\n![](img/crit_diag_sr_hit.png)\n\n![](img/heatmap_HS.png)\n\n## Reproducing the results\n\n### Data\nThe paper [Bake off redux: a review and experimental evaluation of recent time series classification algorithms](https://arxiv.org/abs/2304.13029) provide with [tsml-eval](https://tsml-eval.readthedocs.io/en/latest/publications/2023/tsc_bakeoff/tsc_bakeoff_2023.html) a folder containing all the 112 UCR datatets with their 30 resamples available [here](https://drive.google.com/file/d/1V36LSZLAK6FIYRfPx6mmE5euzogcXS83/view)\n\n### Performance of each couple IR-PO (Section 3)\n\nTo obtain Table 1 of our paper, run [mod_minirocket](./code/performance_mod_minirocket.py). It will generate a csv file with the mean performance of each IR-PO couple for all the 112 UCR datasets selected with 30 resamples.\n\n### Feature Generation (Section 4)\n\nWhile SelF-Rocket uses [MiniRocket](https://arxiv.org/abs/2012.08791) as baseline, our code is based on the original implementation of [MultiRocket](https://arxiv.org/abs/2102.00457). 9996 or 19992 features are extracted from each combinaison (IR-PO). In this implementation IR = {BASE,DIFF}, PO = {PPV,GMP,MPV,MIPV,LSPV}. The source code of the Feature Generation module is available [here](./code/features_generator.py)\n\n### Performance of SelF-Rocket (Section 5)\n\nTo obtain the data required for the critical difference diagram and the heatmap, for SelF-Rocket run    [main_ucr112_SR](./code/main_ucr112_SR.py) and for Hydra SelF-Rocket run [main_ucr112_HSR](./code/main_ucr112_HSR.py)\n\n```\nArguments:\n-df --inputDataFolder type=str : path of datasets (required)\n-fpc --num_features_pc type=int : number of features to use per mini-classifier\n-r --num_resamples type=int : number of resamples to use\n-nr --num_runs type=int : number of runs to do\n-ir --only_mix type=bool : only use the MIX representation as Input Representation\n\nExamples:\n\u003e py main_ucr112_SR.py -df \"../datasets_UCR_resamp_tsv/\" -fpc 5000 -nr 10 -ir\n\u003e py main_ucr112_HSR.py -df \"../datasets_UCR_resamp_tsv/\" -fpc 5000 -nr 10\n \n``` \nThis will generate three files : a main file containing the mean accuracy over 30 resamples for each dataset (e.g. [Mean_perf_SR](./results/Mean_perf_SR_UCR112_fpc5000_nr10.csv), [Mean_perf_HSR](./results/Mean_perf_HSR_UCR112_fpc5000_nr10.csv)), a second file containing the accuracy for each resample for all datasets (e.g. [Perf_rsmpl_SR](./results/Perf_rsmpl_SR_UCR112_fpc5000_nr10.csv), [Perf_rsmpl_HSR](./results/Perf_rsmpl_HSR_UCR112_fpc5000_nr10.csv)) and a third file containing the selected IR-PO for each resample and dataset (e.g. [IR_PO_rsmpl_SR](./results/IR_PO_rsmpl_SR_UCR112_fpc5000_nr10.csv), [IR_PO_rsmpl_HSR](./results/IR_PO_rsmpl_HSR_UCR112_fpc5000_nr10.csv)).\n\nThe mean performance (over 30 resamples) of SelF-Rocket \u0026 Hydra SelF-Rocket (f = 5000, nr = 10) on the 112 selected UCR datasets.\n\n| dataset                        | SelF-Rocket MEAN ACCURACY | Hydra SelF-Rocket MEAN ACCURACY | MiniRocket MEAN ACCURACY |\n|--------------------------------|---------------------------|---------------------------------|--------------------------|\n| ACSF1                          | 0.8313333333333333        | 0.8396666666666667              | 0.8246666666666667       |\n| Adiac                          | 0.824467178175618         | 0.8349531116794545              | 0.8015345268542199       |\n| ArrowHead                      | 0.8862857142857143        | 0.8828571428571428              | 0.8832380952380954       |\n| BME                            | 0.9926666666666665        | 0.998                           | 0.9919999999999998       |\n| Beef                           | 0.791111111111111         | 0.7766666666666667              | 0.7655555555555554       |\n| BeetleFly                      | 0.9099999999999999        | 0.9533333333333333              | 0.9099999999999999       |\n| BirdChicken                    | 0.9049999999999998        | 0.9066666666666665              | 0.9183333333333332       |\n| CBF                            | 0.9946296296296296        | 0.9949259259259259              | 0.9965185185185186       |\n| Car                            | 0.9272222222222221        | 0.9222222222222223              | 0.9205555555555556       |\n| Chinatown                      | 0.9661807580174927        | 0.9665694849368317              | 0.9687074829931972       |\n| ChlorineConcentration          | 0.7859288194444446        | 0.7746354166666667              | 0.753532986111111        |\n| CinCECGTorso                   | 0.9538888888888887        | 0.9958212560386475              | 0.8745169082125603       |\n| Coffee                         | 0.9988095238095238        | 0.9976190476190477              | 0.9988095238095238       |\n| Computers                      | 0.8436000000000002        | 0.8698666666666668              | 0.8033333333333332       |\n| CricketX                       | 0.823931623931624         | 0.8278632478632478              | 0.8241880341880342       |\n| CricketY                       | 0.8370940170940171        | 0.8457264957264955              | 0.8399999999999999       |\n| CricketZ                       | 0.8388888888888888        | 0.8443589743589742              | 0.8391452991452992       |\n| Crop                           | 0.7663511904761903        | 0.7705376984126983              | 0.7641011904761903       |\n| DiatomSizeReduction            | 0.9508714596949889        | 0.9405228758169933              | 0.9436819172113288       |\n| DistalPhalanxOutlineAgeGroup   | 0.7978417266187049        | 0.8002398081534773              | 0.7944844124700239       |\n| DistalPhalanxOutlineCorrect    | 0.8399758454106279        | 0.8379227053140096              | 0.8253623188405796       |\n| DistalPhalanxTW                | 0.6961630695443647        | 0.696642685851319               | 0.6892086330935251       |\n| ECG200                         | 0.8930000000000001        | 0.8960000000000001              | 0.8990000000000002       |\n| ECG5000                        | 0.9465629629629629        | 0.9474296296296297              | 0.9464888888888888       |\n| ECGFiveDays                    | 0.9905923344947735        | 0.9948122338366243              | 0.9905536198219127       |\n| EOGHorizontalSignal            | 0.8599447513812155        | 0.8624309392265194              | 0.8360957642725599       |\n| EOGVerticalSignal              | 0.8018416206261509        | 0.8113259668508285              | 0.7995395948434623       |\n| Earthquakes                    | 0.7441247002398081        | 0.7434052757793765              | 0.7333333333333332       |\n| ElectricDevices                | 0.891605066355423         | 0.9003587947953141              | 0.8745774434790127       |\n| EthanolLevel                   | 0.7085999999999999        | 0.7054666666666666              | 0.6635333333333334       |\n| FaceAll                        | 0.982879684418146         | 0.9835305719921105              | 0.983293885601578        |\n| FaceFour                       | 0.9397727272727271        | 0.9109848484848485              | 0.9412878787878787       |\n| FacesUCR                       | 0.9680162601626017        | 0.9655934959349594              | 0.9686016260162602       |\n| FiftyWords                     | 0.8305494505494507        | 0.8391208791208792              | 0.8284981684981686       |\n| Fish                           | 0.9782857142857144        | 0.9832380952380951              | 0.9754285714285716       |\n| FordA                          | 0.9492424242424243        | 0.9562121212121213              | 0.9449747474747474       |\n| FordB                          | 0.9235802469135802        | 0.9318106995884773              | 0.9207818930041152       |\n| FreezerRegularTrain            | 0.9990643274853802        | 0.9982573099415204              | 0.9990877192982457       |\n| FreezerSmallTrain              | 0.9887251461988303        | 0.9816140350877195              | 0.9876023391812866       |\n| GunPoint                       | 0.9948888888888888        | 0.9986666666666666              | 0.9919999999999999       |\n| GunPointAgeSpan                | 0.9932489451476791        | 0.9947257383966245              | 0.9924050632911392       |\n| GunPointMaleVersusFemale       | 0.9998945147679325        | 0.9998945147679325              | 1.0                      |\n| GunPointOldVersusYoung         | 1.0                       | 1.0                             | 1.0                      |\n| Ham                            | 0.8434920634920636        | 0.8542857142857144              | 0.8488888888888889       |\n| HandOutlines                   | 0.9403603603603603        | 0.947117117117117               | 0.9382882882882881       |\n| Haptics                        | 0.5164502164502165        | 0.5372294372294372              | 0.5452380952380953       |\n| Herring                        | 0.6088541666666667        | 0.6151041666666667              | 0.6088541666666667       |\n| HouseTwenty                    | 0.965266106442577         | 0.973389355742297               | 0.965546218487395        |\n| InlineSkate                    | 0.5087878787878787        | 0.5267878787878787              | 0.4896363636363636       |\n| InsectEPGRegularTrain          | 1.0                       | 1.0                             | 1.0                      |\n| InsectEPGSmallTrain            | 0.9929049531459169        | 0.9962516733601071              | 0.993172690763052        |\n| InsectWingbeatSound            | 0.6621717171717172        | 0.6635858585858586              | 0.6575420875420875       |\n| ItalyPowerDemand               | 0.9634272756721737        | 0.9628441852931647              | 0.9602202785876254       |\n| LargeKitchenAppliances         | 0.9294222222222223        | 0.9394666666666666              | 0.9024000000000001       |\n| Lightning2                     | 0.7426229508196722        | 0.7721311475409836              | 0.7601092896174866       |\n| Lightning7                     | 0.787671232876712         | 0.8041095890410958              | 0.7771689497716895       |\n| Mallat                         | 0.9562046908315567        | 0.9612935323383084              | 0.9551528073916135       |\n| Meat                           | 0.9916666666666667        | 0.9877777777777779              | 0.9933333333333335       |\n| MedicalImages                  | 0.8000438596491226        | 0.8057017543859649              | 0.8048245614035087       |\n| MiddlePhalanxOutlineAgeGroup   | 0.656926406926407         | 0.6703463203463204              | 0.6502164502164501       |\n| MiddlePhalanxOutlineCorrect    | 0.8484536082474228        | 0.8476517754868271              | 0.843413516609393        |\n| MiddlePhalanxTW                | 0.5493506493506495        | 0.5621212121212122              | 0.5541125541125542       |\n| MixedShapesRegularTrain        | 0.9758625429553264        | 0.9811546391752579              | 0.9693745704467354       |\n| MixedShapesSmallTrain          | 0.9488522336769757        | 0.9571408934707905              | 0.9421030927835052       |\n| MoteStrain                     | 0.909797657082002         | 0.925612353567625               | 0.9136581469648563       |\n| NonInvasiveFetalECGThorax1     | 0.960033927056828         | 0.9619677692960135              | 0.9518066157760815       |\n| NonInvasiveFetalECGThorax2     | 0.9662595419847327        | 0.9706870229007633              | 0.9635114503816793       |\n| OSULeaf                        | 0.9672176308539944        | 0.977961432506887               | 0.9568870523415979       |\n| OliveOil                       | 0.9111111111111112        | 0.9066666666666666              | 0.9155555555555556       |\n| PhalangesOutlinesCorrect       | 0.8521367521367521        | 0.8518259518259519              | 0.8457653457653458       |\n| Phoneme                        | 0.3415611814345992        | 0.35079113924050637             | 0.2908403656821379       |\n| PigAirwayPressure              | 0.9267628205128204        | 0.9102564102564101              | 0.8748397435897437       |\n| PigArtPressure                 | 0.9580128205128204        | 0.9647435897435898              | 0.9596153846153848       |\n| PigCVP                         | 0.9078525641025641        | 0.9100961538461539              | 0.9179487179487179       |\n| Plane                          | 1.0                       | 1.0                             | 1.0                      |\n| PowerCons                      | 0.9800000000000001        | 0.9722222222222222              | 0.9838888888888887       |\n| ProximalPhalanxOutlineAgeGroup | 0.8447154471544714        | 0.8479674796747968              | 0.8450406504065041       |\n| ProximalPhalanxOutlineCorrect  | 0.9088201603665522        | 0.904696449026346               | 0.8961053837342499       |\n| ProximalPhalanxTW              | 0.801788617886179         | 0.8087804878048781              | 0.8032520325203251       |\n| RefrigerationDevices           | 0.7517333333333334        | 0.7849777777777778              | 0.707822222222222        |\n| Rock                           | 0.8366666666666664        | 0.8713333333333334              | 0.8046666666666666       |\n| ScreenType                     | 0.628                     | 0.6789333333333334              | 0.5584888888888889       |\n| SemgHandGenderCh2              | 0.9523888888888891        | 0.9360555555555554              | 0.9108333333333334       |\n| SemgHandMovementCh2            | 0.7934814814814815        | 0.7388148148148148              | 0.6834074074074075       |\n| SemgHandSubjectCh2             | 0.9304444444444445        | 0.9127407407407409              | 0.8821481481481481       |\n| ShapeletSim                    | 0.9998148148148148        | 0.9938888888888887              | 0.9996296296296295       |\n| ShapesAll                      | 0.9408888888888889        | 0.9481111111111111              | 0.9349444444444444       |\n| SmallKitchenAppliances         | 0.8246222222222223        | 0.8369777777777778              | 0.8137777777777779       |\n| SmoothSubspace                 | 0.9702222222222222        | 0.9622222222222223              | 0.9586666666666667       |\n| SonyAIBORobotSurface1          | 0.9505268996117582        | 0.9490848585690514              | 0.9480865224625624       |\n| SonyAIBORobotSurface2          | 0.953690101434068         | 0.9515564882826162              | 0.9415879678209162       |\n| StarLightCurves                | 0.9816982353893476        | 0.9815525335923587              | 0.9814351627003399       |\n| Strawberry                     | 0.9805405405405409        | 0.9804504504504504              | 0.9791891891891892       |\n| SwedishLeaf                    | 0.9731733333333332        | 0.9767466666666667              | 0.9615466666666668       |\n| Symbols                        | 0.971356783919598         | 0.9740703517587941              | 0.9670686767169179       |\n| SyntheticControl               | 0.9908888888888888        | 0.990111111111111               | 0.9912222222222222       |\n| ToeSegmentation1               | 0.9403508771929825        | 0.9421052631578948              | 0.9410818713450291       |\n| ToeSegmentation2               | 0.9397435897435895        | 0.9487179487179485              | 0.9410256410256408       |\n| Trace                          | 1.0                       | 1.0                             | 1.0                      |\n| TwoLeadECG                     | 0.997161252560726         | 0.998478197249049               | 0.9973075797483174       |\n| TwoPatterns                    | 0.9997333333333333        | 0.9978083333333334              | 0.994975                 |\n| UMD                            | 0.9886574074074074        | 0.9884259259259259              | 0.9905092592592594       |\n| UWaveGestureLibraryAll         | 0.9818816303740926        | 0.9828773497115206              | 0.9749860413176996       |\n| UWaveGestureLibraryX           | 0.8629629629629628        | 0.872175693281221               | 0.8566815559277872       |\n| UWaveGestureLibraryY           | 0.7980271729015449        | 0.8073422668900055              | 0.7867857807556298       |\n| UWaveGestureLibraryZ           | 0.8064209938581798        | 0.8160524846454494              | 0.8015726782058441       |\n| Wafer                          | 0.9998431754272118        | 0.9999513303049968              | 0.9988860047588145       |\n| Wine                           | 0.928395061728395         | 0.9320987654320986              | 0.9290123456790124       |\n| WordSynonyms                   | 0.7694879832810868        | 0.777533960292581               | 0.7682863113897596       |\n| Worms                          | 0.7376623376623377        | 0.7532467532467533              | 0.7320346320346319       |\n| WormsTwoClass                  | 0.7805194805194806        | 0.7913419913419913              | 0.7913419913419912       |\n| Yoga                           | 0.9311333333333334        | 0.9389999999999998              | 0.9190666666666666       |\n\n\n## Usage of SelF-Rocket \u0026 Hydra-SelF-Rocket Classifier\n\n```python\nfrom self_rocket import SelFRocket\n\n# The shape could be (num_examples,ts_length) or (num_examples,1,ts_length)\n\nX_train, y_train = ...\nX_test, y_test = ...\n\nmodel = SelFRocket(num_runs = 10, num_features_pc = 5000, only_MIX = False)\nmodel.fit(X_train,y_train)\n\ny_pred = model.predict(X_test)\n``` \n\n```python\nfrom hydra_self_rocket import HydraSelFRocket\n\n# The shape could be (num_examples,ts_length) or (num_examples,1,ts_length)\n\nX_train, y_train = ...\nX_test, y_test = ...\n\nmodel = HydraSelFRocket(num_runs = 10, num_features_pc = 5000, only_MIX = False)\nmodel.fit(X_train,y_train)\n\ny_pred = model.predict(X_test)\n``` \n\n## Acknowledgements\n\nThis research project, supported and financed by the ANR (Agence Nationale pour la Recherche), is part of the Labcom (Laboratoire Commun) MYEL (MobilitY and Reliability of Electrical chain Lab) involving LSEE, LGI2A and CRITTM2A.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanr-myel%2Fself-rocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanr-myel%2Fself-rocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanr-myel%2Fself-rocket/lists"}