├── .gitignore ├── LICENSE ├── README.md ├── classifiers ├── lite.py └── litemv.py ├── images ├── LITE.png ├── all-mcm.png ├── cdd.png ├── litetime1v1-mcm.png ├── results_lite.png ├── results_litetime.png └── summary_with_flops.png ├── main.py ├── results.csv ├── results_ensemble_study.csv ├── results_multivariate.csv └── utils └── utils.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm.fming.dev/#use-with-ide 110 | .pdm.toml 111 | 112 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 113 | __pypackages__/ 114 | 115 | # Celery stuff 116 | celerybeat-schedule 117 | celerybeat.pid 118 | 119 | # SageMath parsed files 120 | *.sage.py 121 | 122 | # Environments 123 | .env 124 | .venv 125 | env/ 126 | venv/ 127 | ENV/ 128 | env.bak/ 129 | venv.bak/ 130 | 131 | # Spyder project settings 132 | .spyderproject 133 | .spyproject 134 | 135 | # Rope project settings 136 | .ropeproject 137 | 138 | # mkdocs documentation 139 | /site 140 | 141 | # mypy 142 | .mypy_cache/ 143 | .dmypy.json 144 | dmypy.json 145 | 146 | # Pyre type checker 147 | .pyre/ 148 | 149 | # pytype static type analyzer 150 | .pytype/ 151 | 152 | # Cython debug symbols 153 | cython_debug/ 154 | 155 | # PyCharm 156 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 157 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 158 | # and can be added to the global gitignore or merged into this file. For a more nuclear 159 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 160 | #.idea/ 161 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > ⚠️ **Alert:** If you are using this code with **Keras v3**, make sure you are using **Keras ≥ 3.6.0**. 2 | > Earlier versions of Keras v3 do not honor `trainable=False`, which will result in **training hand-crafted filters** in **LITE** and **LITEMV** unexpectedly. 3 | 4 | 5 | # LITE: Light Inception with boosTing tEchniques for Time Series Classification 6 | 7 | This is the source code of our paper "[LITE: Light Inception with boosTing tEchniques for Time Series Classification](https://germain-forestier.info/publis/dsaa2023.pdf)" accepted at the 10th IEEE International Conference on Data Science and Advanced Analytics ([DSAA 2023](https://conferences.sigappfr.org/dsaa2023/)) in the Learning from Temporal Data ([LearnTeD](https://dsaa2023.inesctec.pt/)) special session track.
8 | This is the source code for the extended version of the DSAA 2023 paper, "[Look into the LITE in deep learning for time series classification](https://link.springer.com/article/10.1007/s41060-024-00708-5)" published in the [International Journal of Data Science and Analytics](https://link.springer.com/journal/41060) in their special issue on [Learning from Temporal Data](https://link.springer.com/collections/dibidcifjj). 9 | This work was done by [Ali Ismail-Fawaz](https://hadifawaz1999.github.io/), [Maxime Devanne](https://maxime-devanne.com/), [Stefano Berretti](www.micc.unifi.it/berretti/), [Jonathan Weber](https://www.jonathan-weber.eu/) and [Germain Forestier](https://germain-forestier.info/). 10 | 11 | ## The LITE architecture 12 | 13 | The same LITE architecture is then used to form an ensemble of five LITE models, names LITETime. 14 |

15 | lite 16 |

17 | 18 | ## Usage of the code 19 | 20 | To use this code, running the ```main.py``` file with the following options in the parsed as arguments: 21 | 22 | ``` 23 | --dataset : to choose the dataset from the UCR Archive (default=Coffee) 24 | --classifier : to choose the classifier, in this case only LITE can be chosen (default=LITE) 25 | --runs : to choose the number of runs (default=5) 26 | --output-directory : to choose the output directory name (default=results/) 27 | --track-emissions : to choose wether or not to track the training/testing time and CO2/power consumotion. 28 | ``` 29 | 30 | ### Adaptation of code 31 | 32 | The only change to be done in the code is the ```folder_path``` in the `utils/utils.py` file, this line. This directory should point to the parent directory of the UCR Archive datasets. 33 | 34 | ### Using [aeon-toolkit](https://github.com/aeon-toolkit/aeon) to Train a LITETimeClassifier on your DATA 35 | 36 | When using aeon, simply load your data and create an instance of a LITETime classifier and train it, as well as LITEMVTime classifier for multivariate time series
37 | 38 | ``` 39 | from aeon.datasets import load_classification 40 | from aeon.classification.deep_learning import LITETimeClassifier 41 | 42 | xtrain, ytrain, _ = load_classification(name="Coffee", split="train") 43 | xtest, ytest, _ = load_classification(name="Coffee", split="test") 44 | 45 | # using LITETime 46 | clf = LITETimeClassifier(n_classifiers=5) 47 | clf.fit(xtrain, ytrain) 48 | print(clf.score(xtest, ytest) 49 | 50 | # using LITEMVTime for multivariate 51 | clf = LITETimeClassifier(n_classifiers=5, use_litemv=True) 52 | clf.fit(xtrain, ytrain) 53 | print(clf.score(xtest, ytest) 54 | ``` 55 | 56 | ## Results 57 | 58 | Results can be found in the [results.csv](https://github.com/MSD-IRIMAS/LITE/blob/main/results.csv) file for [FCN](https://github.com/hfawaz/dl-4-tsc/blob/master/classifiers/fcn.py), [ResNet](https://github.com/hfawaz/dl-4-tsc/blob/master/classifiers/resnet.py), [Inception](https://github.com/hfawaz/InceptionTime), [InceptionTime](https://github.com/hfawaz/InceptionTime), [ROCKET](https://github.com/angus924/rocket), [MultiROCKET](https://github.com/ChangWeiTan/MultiRocket), LITE and LITETime. For non-ensemble methods, results are averaged over five runs, for ensemble methods, we ensemble the five runs. 59 | 60 | ### Average performance and FLOPS comparison 61 | 62 | The following figure shows the comparison between LITE and state of the art complex deep learners. The comparison consists on the average performance and the number FLOPS. 63 |

64 | flops 65 |

66 | 67 | ### LITE 1v1 with FCN, ResNet and Inception 68 | 69 | The following compares LITE with FCN, ResNet and Inception using the accuracy performance on the test set of the 128 datasts of the UCR archive. 70 | 71 |

72 | 1v1lite 73 |

74 | 75 | ### LITETime 1v1 with ROCKET and InceptionTime 76 | 77 | The following compares LITE with FCN, ResNet and Inception using the accuracy performance on the test set of the 128 datasts of the UCR archive. 78 | 79 |

80 | 1v1litetime 81 |

82 | 83 | ### LITETime MCM with SOTA 84 | 85 | The following 1v1 and multi-comparison matrix shows the performance of LITETime with respect to the SOTA models for Time Series Classification. 86 | 87 | The following compares LITE with FCN, ResNet and Inception using the accuracy performance on the test set of the 128 datasts of the UCR archive. 88 | 89 |

90 | mcm-litetime 91 |

92 | 93 | ### CD Diagram 94 | 95 | The following Critical Difference Diagram (CDD) shows the comparison following the average rank between classifiers. 96 | 97 |

98 | cdd 99 |

100 | 101 | ## Requirements 102 | 103 | ``` 104 | numpy 105 | pandas 106 | scikit-learn 107 | tensorflow>=2.16.1 108 | keras>=3.6.0 109 | matplotlib 110 | codecarbon 111 | ``` 112 | 113 | ## Citation 114 | 115 | ``` 116 | @inproceedings{Ismail-Fawaz2023LITELightInception, 117 | author = {Ismail-Fawaz, A. and Devanne, M. and Berretti, S. and Weber, J. and Forestier, G.}, 118 | title = {LITE: Light Inception with boosTing tEchniques for Time Series Classification}, 119 | booktitle = {International Conference on Data Science and Advanced Analytics (DSAA)}, 120 | year = {2023} 121 | } 122 | ``` 123 | 124 | 125 | ## Acknowledgments 126 | 127 | This work was supported by the ANR DELEGATION project (grant ANR-21-CE23-0014) of the French Agence Nationale de la Recherche. The authors would like to acknowledge the High Performance Computing Center of the University of Strasbourg for supporting this work by providing scientific support and access to computing resources. Part of the computing resources were funded by the Equipex Equip@Meso project (Programme Investissements d’Avenir) and the CPER Alsacalcul/Big Data. The authors would also like to thank the creators and providers of the UCR Archive. 128 | 129 | 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /classifiers/lite.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import pandas as pd 3 | import tensorflow as tf 4 | import matplotlib.pyplot as plt 5 | 6 | import os 7 | import time 8 | import json 9 | 10 | from sklearn.preprocessing import OneHotEncoder as OHE 11 | from sklearn.metrics import accuracy_score 12 | from codecarbon import track_emissions 13 | 14 | 15 | class LITE: 16 | def __init__( 17 | self, 18 | output_directory, 19 | length_TS, 20 | n_classes, 21 | batch_size=64, 22 | n_filters=32, 23 | kernel_size=41, 24 | n_epochs=1500, 25 | verbose=True, 26 | use_custom_filters=True, 27 | use_dilation=True, 28 | use_multiplexing=True, 29 | ): 30 | 31 | self.output_directory = output_directory 32 | 33 | self.length_TS = length_TS 34 | self.n_classes = n_classes 35 | 36 | self.verbose = verbose 37 | 38 | self.n_filters = n_filters 39 | 40 | self.use_custom_filters = use_custom_filters 41 | self.use_dilation = use_dilation 42 | self.use_multiplexing = use_multiplexing 43 | 44 | self.kernel_size = kernel_size - 1 45 | 46 | self.batch_size = batch_size 47 | self.n_epochs = n_epochs 48 | 49 | self.build_model() 50 | 51 | def hybird_layer( 52 | self, input_tensor, input_channels, kernel_sizes=[2, 4, 8, 16, 32, 64] 53 | ): 54 | 55 | conv_list = [] 56 | 57 | for kernel_size in kernel_sizes: 58 | 59 | filter_ = np.ones(shape=(kernel_size, input_channels, 1)) 60 | indices_ = np.arange(kernel_size) 61 | 62 | filter_[indices_ % 2 == 0] *= -1 63 | 64 | conv = tf.keras.layers.Conv1D( 65 | filters=1, 66 | kernel_size=kernel_size, 67 | padding="same", 68 | use_bias=False, 69 | kernel_initializer=tf.keras.initializers.Constant(filter_), 70 | trainable=False, 71 | name="hybird-increasse-" 72 | + str(self.keep_track) 73 | + "-" 74 | + str(kernel_size), 75 | )(input_tensor) 76 | 77 | conv_list.append(conv) 78 | 79 | self.keep_track += 1 80 | 81 | for kernel_size in kernel_sizes: 82 | 83 | filter_ = np.ones(shape=(kernel_size, input_channels, 1)) 84 | indices_ = np.arange(kernel_size) 85 | 86 | filter_[indices_ % 2 > 0] *= -1 87 | 88 | conv = tf.keras.layers.Conv1D( 89 | filters=1, 90 | kernel_size=kernel_size, 91 | padding="same", 92 | use_bias=False, 93 | kernel_initializer=tf.keras.initializers.Constant(filter_), 94 | trainable=False, 95 | name="hybird-decrease-" + str(self.keep_track) + "-" + str(kernel_size), 96 | )(input_tensor) 97 | conv_list.append(conv) 98 | 99 | self.keep_track += 1 100 | 101 | for kernel_size in kernel_sizes[1:]: 102 | 103 | filter_ = np.zeros( 104 | shape=(kernel_size + kernel_size // 2, input_channels, 1) 105 | ) 106 | 107 | xmash = np.linspace(start=0, stop=1, num=kernel_size // 4 + 1)[1:].reshape( 108 | (-1, 1, 1) 109 | ) 110 | 111 | filter_left = xmash**2 112 | filter_right = filter_left[::-1] 113 | 114 | filter_[0 : kernel_size // 4] = -filter_left 115 | filter_[kernel_size // 4 : kernel_size // 2] = -filter_right 116 | filter_[kernel_size // 2 : 3 * kernel_size // 4] = 2 * filter_left 117 | filter_[3 * kernel_size // 4 : kernel_size] = 2 * filter_right 118 | filter_[kernel_size : 5 * kernel_size // 4] = -filter_left 119 | filter_[5 * kernel_size // 4 :] = -filter_right 120 | 121 | conv = tf.keras.layers.Conv1D( 122 | filters=1, 123 | kernel_size=kernel_size + kernel_size // 2, 124 | padding="same", 125 | use_bias=False, 126 | kernel_initializer=tf.keras.initializers.Constant(filter_), 127 | trainable=False, 128 | name="hybird-peeks-" + str(self.keep_track) + "-" + str(kernel_size), 129 | )(input_tensor) 130 | 131 | conv_list.append(conv) 132 | 133 | self.keep_track += 1 134 | 135 | hybird_layer = tf.keras.layers.Concatenate(axis=2)(conv_list) 136 | hybird_layer = tf.keras.layers.Activation(activation="relu")(hybird_layer) 137 | 138 | return hybird_layer 139 | 140 | def _inception_module( 141 | self, 142 | input_tensor, 143 | dilation_rate, 144 | stride=1, 145 | activation="linear", 146 | use_hybird_layer=False, 147 | use_multiplexing=True, 148 | ): 149 | 150 | input_inception = input_tensor 151 | 152 | if not use_multiplexing: 153 | 154 | n_convs = 1 155 | n_filters = self.n_filters * 3 156 | 157 | else: 158 | n_convs = 3 159 | n_filters = self.n_filters 160 | 161 | kernel_size_s = [self.kernel_size // (2**i) for i in range(n_convs)] 162 | 163 | conv_list = [] 164 | 165 | for i in range(len(kernel_size_s)): 166 | conv_list.append( 167 | tf.keras.layers.Conv1D( 168 | filters=n_filters, 169 | kernel_size=kernel_size_s[i], 170 | strides=stride, 171 | padding="same", 172 | dilation_rate=dilation_rate, 173 | activation=activation, 174 | use_bias=False, 175 | )(input_inception) 176 | ) 177 | 178 | if use_hybird_layer: 179 | 180 | self.hybird = self.hybird_layer( 181 | input_tensor=input_tensor, input_channels=input_tensor.shape[-1] 182 | ) 183 | conv_list.append(self.hybird) 184 | 185 | if len(conv_list) > 1: 186 | x = tf.keras.layers.Concatenate(axis=2)(conv_list) 187 | else: 188 | x = conv_list[0] 189 | 190 | x = tf.keras.layers.BatchNormalization()(x) 191 | x = tf.keras.layers.Activation(activation="relu")(x) 192 | 193 | return x 194 | 195 | def _fcn_module( 196 | self, 197 | input_tensor, 198 | kernel_size, 199 | dilation_rate, 200 | n_filters, 201 | stride=1, 202 | activation="relu", 203 | ): 204 | 205 | x = tf.keras.layers.SeparableConv1D( 206 | filters=n_filters, 207 | kernel_size=kernel_size, 208 | padding="same", 209 | strides=stride, 210 | dilation_rate=dilation_rate, 211 | use_bias=False, 212 | )(input_tensor) 213 | 214 | x = tf.keras.layers.BatchNormalization()(x) 215 | x = tf.keras.layers.Activation(activation=activation)(x) 216 | 217 | return x 218 | 219 | def build_model(self): 220 | 221 | self.keep_track = 0 222 | 223 | input_shape = (self.length_TS,) 224 | 225 | input_layer = tf.keras.layers.Input(input_shape) 226 | reshape_layer = tf.keras.layers.Reshape(target_shape=(self.length_TS, 1))( 227 | input_layer 228 | ) 229 | 230 | inception = self._inception_module( 231 | input_tensor=reshape_layer, 232 | dilation_rate=1, 233 | use_hybird_layer=self.use_custom_filters, 234 | ) 235 | 236 | self.kernel_size //= 2 237 | 238 | input_tensor = inception 239 | 240 | dilation_rate = 1 241 | 242 | for i in range(2): 243 | 244 | if self.use_dilation: 245 | dilation_rate = 2 ** (i + 1) 246 | 247 | x = self._fcn_module( 248 | input_tensor=input_tensor, 249 | kernel_size=self.kernel_size // (2**i), 250 | n_filters=self.n_filters, 251 | dilation_rate=dilation_rate, 252 | ) 253 | 254 | input_tensor = x 255 | 256 | gap = tf.keras.layers.GlobalAveragePooling1D()(x) 257 | 258 | output_layer = tf.keras.layers.Dense( 259 | units=self.n_classes, activation="softmax" 260 | )(gap) 261 | 262 | self.model = tf.keras.models.Model(inputs=input_layer, outputs=output_layer) 263 | 264 | reduce_lr = tf.keras.callbacks.ReduceLROnPlateau( 265 | monitor="loss", factor=0.5, patience=50, min_lr=1e-4 266 | ) 267 | model_checkpoint = tf.keras.callbacks.ModelCheckpoint( 268 | filepath=self.output_directory + "best_model.keras", 269 | monitor="loss", 270 | save_best_only=True, 271 | ) 272 | self.callbacks = [reduce_lr, model_checkpoint] 273 | 274 | self.model.compile( 275 | loss="categorical_crossentropy", optimizer="Adam", metrics=["accuracy"] 276 | ) 277 | 278 | def fit(self, xtrain, ytrain, xval=None, yval=None, plot_test=False): 279 | 280 | ytrain = np.expand_dims(ytrain, axis=1) 281 | ohe = OHE(sparse=False) 282 | ytrain = ohe.fit_transform(ytrain) 283 | 284 | if plot_test: 285 | 286 | yval = np.expand_dims(yval, axis=1) 287 | ohe = OHE(sparse=False) 288 | yval = ohe.fit_transform(yval) 289 | 290 | if plot_test: 291 | 292 | hist = self.model.fit( 293 | xtrain, 294 | ytrain, 295 | batch_size=self.batch_size, 296 | epochs=self.n_epochs, 297 | verbose=self.verbose, 298 | validation_data=(xval, yval), 299 | callbacks=self.callbacks, 300 | ) 301 | else: 302 | 303 | hist = self.model.fit( 304 | xtrain, 305 | ytrain, 306 | batch_size=self.batch_size, 307 | epochs=self.n_epochs, 308 | verbose=self.verbose, 309 | callbacks=self.callbacks, 310 | ) 311 | 312 | plt.figure(figsize=(20, 10)) 313 | 314 | plt.plot(hist.history["loss"], lw=3, color="blue", label="Training Loss") 315 | 316 | if plot_test: 317 | plt.plot( 318 | hist.history["val_loss"], lw=3, color="red", label="Validation Loss" 319 | ) 320 | 321 | plt.legend() 322 | plt.savefig(self.output_directory + "loss.pdf") 323 | plt.cla() 324 | 325 | plt.plot( 326 | hist.history["accuracy"], lw=3, color="blue", label="Training Accuracy" 327 | ) 328 | 329 | if plot_test: 330 | plt.plot( 331 | hist.history["val_accuracy"], 332 | lw=3, 333 | color="red", 334 | label="Validation Accuracy", 335 | ) 336 | 337 | plt.legend() 338 | plt.savefig(self.output_directory + "accuracy.pdf") 339 | 340 | plt.cla() 341 | plt.clf() 342 | 343 | tf.keras.backend.clear_session() 344 | 345 | def fit_and_track_emissions( 346 | self, xtrain, ytrain, xval=None, yval=None, plot_test=False 347 | ): 348 | @track_emissions(project_name="LITE", output_dir=self.output_directory) 349 | def _fit(xtrain, ytrain, xval, yval, plot_test): 350 | 351 | ytrain = np.expand_dims(ytrain, axis=1) 352 | ohe = OHE(sparse=False) 353 | ytrain = ohe.fit_transform(ytrain) 354 | 355 | if plot_test: 356 | 357 | yval = np.expand_dims(yval, axis=1) 358 | ohe = OHE(sparse=False) 359 | yval = ohe.fit_transform(yval) 360 | 361 | start_time = time.time() 362 | 363 | if plot_test: 364 | 365 | hist = self.model.fit( 366 | xtrain, 367 | ytrain, 368 | batch_size=self.batch_size, 369 | epochs=self.n_epochs, 370 | verbose=self.verbose, 371 | validation_data=(xval, yval), 372 | callbacks=self.callbacks, 373 | ) 374 | else: 375 | 376 | hist = self.model.fit( 377 | xtrain, 378 | ytrain, 379 | batch_size=self.batch_size, 380 | epochs=self.n_epochs, 381 | verbose=self.verbose, 382 | callbacks=self.callbacks, 383 | ) 384 | 385 | self.train_duration = time.time() - start_time 386 | 387 | plt.figure(figsize=(20, 10)) 388 | 389 | plt.plot(hist.history["loss"], lw=3, color="blue", label="Training Loss") 390 | 391 | if plot_test: 392 | plt.plot( 393 | hist.history["val_loss"], lw=3, color="red", label="Validation Loss" 394 | ) 395 | 396 | plt.legend() 397 | plt.savefig(self.output_directory + "loss.pdf") 398 | plt.cla() 399 | 400 | plt.plot( 401 | hist.history["accuracy"], lw=3, color="blue", label="Training Accuracy" 402 | ) 403 | 404 | if plot_test: 405 | plt.plot( 406 | hist.history["val_accuracy"], 407 | lw=3, 408 | color="red", 409 | label="Validation Accuracy", 410 | ) 411 | 412 | plt.legend() 413 | plt.savefig(self.output_directory + "accuracy.pdf") 414 | 415 | plt.cla() 416 | plt.clf() 417 | 418 | tf.keras.backend.clear_session() 419 | 420 | _fit(xtrain=xtrain, ytrain=ytrain, xval=xval, yval=yval, plot_test=plot_test) 421 | 422 | emissions = pd.read_csv(self.output_directory + "emissions.csv") 423 | 424 | co2 = emissions["emissions"][0] 425 | energy = emissions["energy_consumed"][0] 426 | country_name = str(emissions["country_name"][0]) 427 | region = str(emissions["region"][0]) 428 | 429 | os.remove(self.output_directory + "emissions.csv") 430 | 431 | tf.keras.backend.clear_session() 432 | 433 | dict_emissions = { 434 | "co2": co2, 435 | "energy": energy, 436 | "country_name": country_name, 437 | "region": region, 438 | "duration": self.train_duration, 439 | } 440 | 441 | with open(self.output_directory + "dict_emissions.json", "w") as fjson: 442 | json.dump(dict_emissions, fjson) 443 | 444 | return dict_emissions 445 | 446 | def predict(self, xtest, ytest): 447 | 448 | model = tf.keras.models.load_model( 449 | self.output_directory + "best_model.keras", compile=False 450 | ) 451 | 452 | start_time = time.time() 453 | ypred = model.predict(xtest) 454 | duration = time.time() - start_time 455 | 456 | ypred_argmax = np.argmax(ypred, axis=1) 457 | 458 | return ( 459 | np.asarray(ypred), 460 | accuracy_score(y_true=ytest, y_pred=ypred_argmax, normalize=True), 461 | duration, 462 | ) 463 | -------------------------------------------------------------------------------- /classifiers/litemv.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import pandas as pd 3 | import tensorflow as tf 4 | import matplotlib.pyplot as plt 5 | 6 | import os 7 | import time 8 | import json 9 | 10 | from sklearn.preprocessing import OneHotEncoder as OHE 11 | from sklearn.metrics import accuracy_score 12 | from codecarbon import track_emissions 13 | 14 | 15 | class LITEMV: 16 | def __init__( 17 | self, 18 | output_directory, 19 | length_TS, 20 | n_classes, 21 | batch_size=64, 22 | n_filters=32, 23 | kernel_size=41, 24 | n_epochs=1500, 25 | verbose=True, 26 | use_custom_filters=True, 27 | use_dilation=True, 28 | use_multiplexing=True, 29 | ): 30 | 31 | self.output_directory = output_directory 32 | 33 | self.length_TS = length_TS 34 | self.n_classes = n_classes 35 | 36 | self.verbose = verbose 37 | 38 | self.n_filters = n_filters 39 | 40 | self.use_custom_filters = use_custom_filters 41 | self.use_dilation = use_dilation 42 | self.use_multiplexing = use_multiplexing 43 | 44 | self.kernel_size = kernel_size - 1 45 | 46 | self.batch_size = batch_size 47 | self.n_epochs = n_epochs 48 | 49 | self.build_model() 50 | 51 | def hybird_layer( 52 | self, input_tensor, input_channels, kernel_sizes=[2, 4, 8, 16, 32, 64] 53 | ): 54 | 55 | conv_list = [] 56 | 57 | for kernel_size in kernel_sizes: 58 | 59 | filter_ = np.ones(shape=(kernel_size, input_channels, 1)) 60 | indices_ = np.arange(kernel_size) 61 | 62 | filter_[indices_ % 2 == 0] *= -1 63 | 64 | conv = tf.keras.layers.DepthwiseConv1D( 65 | kernel_size=kernel_size, 66 | padding="same", 67 | use_bias=False, 68 | depthwise_initializer=tf.keras.initializers.Constant( 69 | filter_.tolist() 70 | ), 71 | trainable=False, 72 | name="hybird-increasse-" 73 | + str(self.keep_track) 74 | + "-" 75 | + str(kernel_size), 76 | )(input_tensor) 77 | 78 | conv_list.append(conv) 79 | 80 | self.keep_track += 1 81 | 82 | for kernel_size in kernel_sizes: 83 | 84 | filter_ = np.ones(shape=(kernel_size, input_channels, 1)) 85 | indices_ = np.arange(kernel_size) 86 | 87 | filter_[indices_ % 2 > 0] *= -1 88 | 89 | conv = tf.keras.layers.DepthwiseConv1D( 90 | kernel_size=kernel_size, 91 | padding="same", 92 | use_bias=False, 93 | depthwise_initializer=tf.keras.initializers.Constant( 94 | filter_.tolist() 95 | ), 96 | trainable=False, 97 | name="hybird-decrease-" + str(self.keep_track) + "-" + str(kernel_size), 98 | )(input_tensor) 99 | conv_list.append(conv) 100 | 101 | self.keep_track += 1 102 | 103 | for kernel_size in kernel_sizes[1:]: 104 | 105 | filter_ = np.zeros( 106 | shape=(kernel_size + kernel_size // 2, input_channels, 1) 107 | ) 108 | 109 | xmash = np.linspace(start=0, stop=1, num=kernel_size // 4 + 1)[1:].reshape( 110 | (-1, 1, 1) 111 | ) 112 | 113 | filter_left = xmash**2 114 | filter_right = filter_left[::-1] 115 | 116 | filter_[0 : kernel_size // 4] = -filter_left 117 | filter_[kernel_size // 4 : kernel_size // 2] = -filter_right 118 | filter_[kernel_size // 2 : 3 * kernel_size // 4] = 2 * filter_left 119 | filter_[3 * kernel_size // 4 : kernel_size] = 2 * filter_right 120 | filter_[kernel_size : 5 * kernel_size // 4] = -filter_left 121 | filter_[5 * kernel_size // 4 :] = -filter_right 122 | 123 | conv = tf.keras.layers.DepthwiseConv1D( 124 | kernel_size=kernel_size + kernel_size // 2, 125 | padding="same", 126 | use_bias=False, 127 | depthwise_initializer=tf.keras.initializers.Constant( 128 | filter_.tolist() 129 | ), 130 | trainable=False, 131 | name="hybird-peeks-" + str(self.keep_track) + "-" + str(kernel_size), 132 | )(input_tensor) 133 | 134 | conv_list.append(conv) 135 | 136 | self.keep_track += 1 137 | 138 | hybird_layer = tf.keras.layers.Concatenate(axis=2)(conv_list) 139 | hybird_layer = tf.keras.layers.Activation(activation="relu")(hybird_layer) 140 | 141 | return hybird_layer 142 | 143 | def _inception_module( 144 | self, 145 | input_tensor, 146 | dilation_rate, 147 | stride=1, 148 | activation="linear", 149 | use_hybird_layer=False, 150 | use_multiplexing=True, 151 | ): 152 | 153 | input_inception = input_tensor 154 | 155 | if not use_multiplexing: 156 | 157 | n_convs = 1 158 | n_filters = self.n_filters * 3 159 | 160 | else: 161 | n_convs = 3 162 | n_filters = self.n_filters 163 | 164 | kernel_size_s = [self.kernel_size // (2**i) for i in range(n_convs)] 165 | 166 | conv_list = [] 167 | 168 | for i in range(len(kernel_size_s)): 169 | conv_list.append( 170 | tf.keras.layers.SeparableConv1D( 171 | filters=n_filters, 172 | kernel_size=kernel_size_s[i], 173 | strides=stride, 174 | padding="same", 175 | dilation_rate=dilation_rate, 176 | activation=activation, 177 | use_bias=False, 178 | )(input_inception) 179 | ) 180 | 181 | if use_hybird_layer: 182 | 183 | self.hybird = self.hybird_layer( 184 | input_tensor=input_tensor, input_channels=input_tensor.shape[-1] 185 | ) 186 | conv_list.append(self.hybird) 187 | 188 | if len(conv_list) > 1: 189 | x = tf.keras.layers.Concatenate(axis=2)(conv_list) 190 | else: 191 | x = conv_list[0] 192 | 193 | x = tf.keras.layers.BatchNormalization()(x) 194 | x = tf.keras.layers.Activation(activation="relu")(x) 195 | 196 | return x 197 | 198 | def _fcn_module( 199 | self, 200 | input_tensor, 201 | kernel_size, 202 | dilation_rate, 203 | n_filters, 204 | stride=1, 205 | activation="relu", 206 | ): 207 | 208 | x = tf.keras.layers.SeparableConv1D( 209 | filters=n_filters, 210 | kernel_size=kernel_size, 211 | padding="same", 212 | strides=stride, 213 | dilation_rate=dilation_rate, 214 | use_bias=False, 215 | )(input_tensor) 216 | 217 | x = tf.keras.layers.BatchNormalization()(x) 218 | x = tf.keras.layers.Activation(activation=activation)(x) 219 | 220 | return x 221 | 222 | def build_model(self): 223 | 224 | self.keep_track = 0 225 | 226 | input_shape = (self.length_TS,) 227 | 228 | input_layer = tf.keras.layers.Input(input_shape) 229 | reshape_layer = tf.keras.layers.Reshape(target_shape=(self.length_TS, 1))( 230 | input_layer 231 | ) 232 | 233 | inception = self._inception_module( 234 | input_tensor=reshape_layer, 235 | dilation_rate=1, 236 | use_hybird_layer=self.use_custom_filters, 237 | ) 238 | 239 | self.kernel_size //= 2 240 | 241 | input_tensor = inception 242 | 243 | dilation_rate = 1 244 | 245 | for i in range(2): 246 | 247 | if self.use_dilation: 248 | dilation_rate = 2 ** (i + 1) 249 | 250 | x = self._fcn_module( 251 | input_tensor=input_tensor, 252 | kernel_size=self.kernel_size // (2**i), 253 | n_filters=self.n_filters, 254 | dilation_rate=dilation_rate, 255 | ) 256 | 257 | input_tensor = x 258 | 259 | gap = tf.keras.layers.GlobalAveragePooling1D()(x) 260 | 261 | output_layer = tf.keras.layers.Dense( 262 | units=self.n_classes, activation="softmax" 263 | )(gap) 264 | 265 | self.model = tf.keras.models.Model(inputs=input_layer, outputs=output_layer) 266 | 267 | reduce_lr = tf.keras.callbacks.ReduceLROnPlateau( 268 | monitor="loss", factor=0.5, patience=50, min_lr=1e-4 269 | ) 270 | model_checkpoint = tf.keras.callbacks.ModelCheckpoint( 271 | filepath=self.output_directory + "best_model.keras", 272 | monitor="loss", 273 | save_best_only=True, 274 | ) 275 | self.callbacks = [reduce_lr, model_checkpoint] 276 | 277 | self.model.compile( 278 | loss="categorical_crossentropy", optimizer="Adam", metrics=["accuracy"] 279 | ) 280 | 281 | def fit(self, xtrain, ytrain, xval=None, yval=None, plot_test=False): 282 | 283 | ytrain = np.expand_dims(ytrain, axis=1) 284 | ohe = OHE(sparse=False) 285 | ytrain = ohe.fit_transform(ytrain) 286 | 287 | if plot_test: 288 | 289 | yval = np.expand_dims(yval, axis=1) 290 | ohe = OHE(sparse=False) 291 | yval = ohe.fit_transform(yval) 292 | 293 | if plot_test: 294 | 295 | hist = self.model.fit( 296 | xtrain, 297 | ytrain, 298 | batch_size=self.batch_size, 299 | epochs=self.n_epochs, 300 | verbose=self.verbose, 301 | validation_data=(xval, yval), 302 | callbacks=self.callbacks, 303 | ) 304 | else: 305 | 306 | hist = self.model.fit( 307 | xtrain, 308 | ytrain, 309 | batch_size=self.batch_size, 310 | epochs=self.n_epochs, 311 | verbose=self.verbose, 312 | callbacks=self.callbacks, 313 | ) 314 | 315 | plt.figure(figsize=(20, 10)) 316 | 317 | plt.plot(hist.history["loss"], lw=3, color="blue", label="Training Loss") 318 | 319 | if plot_test: 320 | plt.plot( 321 | hist.history["val_loss"], lw=3, color="red", label="Validation Loss" 322 | ) 323 | 324 | plt.legend() 325 | plt.savefig(self.output_directory + "loss.pdf") 326 | plt.cla() 327 | 328 | plt.plot( 329 | hist.history["accuracy"], lw=3, color="blue", label="Training Accuracy" 330 | ) 331 | 332 | if plot_test: 333 | plt.plot( 334 | hist.history["val_accuracy"], 335 | lw=3, 336 | color="red", 337 | label="Validation Accuracy", 338 | ) 339 | 340 | plt.legend() 341 | plt.savefig(self.output_directory + "accuracy.pdf") 342 | 343 | plt.cla() 344 | plt.clf() 345 | 346 | tf.keras.backend.clear_session() 347 | 348 | def fit_and_track_emissions( 349 | self, xtrain, ytrain, xval=None, yval=None, plot_test=False 350 | ): 351 | @track_emissions(project_name="LITE", output_dir=self.output_directory) 352 | def _fit(xtrain, ytrain, xval, yval, plot_test): 353 | 354 | ytrain = np.expand_dims(ytrain, axis=1) 355 | ohe = OHE(sparse=False) 356 | ytrain = ohe.fit_transform(ytrain) 357 | 358 | if plot_test: 359 | 360 | yval = np.expand_dims(yval, axis=1) 361 | ohe = OHE(sparse=False) 362 | yval = ohe.fit_transform(yval) 363 | 364 | start_time = time.time() 365 | 366 | if plot_test: 367 | 368 | hist = self.model.fit( 369 | xtrain, 370 | ytrain, 371 | batch_size=self.batch_size, 372 | epochs=self.n_epochs, 373 | verbose=self.verbose, 374 | validation_data=(xval, yval), 375 | callbacks=self.callbacks, 376 | ) 377 | else: 378 | 379 | hist = self.model.fit( 380 | xtrain, 381 | ytrain, 382 | batch_size=self.batch_size, 383 | epochs=self.n_epochs, 384 | verbose=self.verbose, 385 | callbacks=self.callbacks, 386 | ) 387 | 388 | self.train_duration = time.time() - start_time 389 | 390 | plt.figure(figsize=(20, 10)) 391 | 392 | plt.plot(hist.history["loss"], lw=3, color="blue", label="Training Loss") 393 | 394 | if plot_test: 395 | plt.plot( 396 | hist.history["val_loss"], lw=3, color="red", label="Validation Loss" 397 | ) 398 | 399 | plt.legend() 400 | plt.savefig(self.output_directory + "loss.pdf") 401 | plt.cla() 402 | 403 | plt.plot( 404 | hist.history["accuracy"], lw=3, color="blue", label="Training Accuracy" 405 | ) 406 | 407 | if plot_test: 408 | plt.plot( 409 | hist.history["val_accuracy"], 410 | lw=3, 411 | color="red", 412 | label="Validation Accuracy", 413 | ) 414 | 415 | plt.legend() 416 | plt.savefig(self.output_directory + "accuracy.pdf") 417 | 418 | plt.cla() 419 | plt.clf() 420 | 421 | tf.keras.backend.clear_session() 422 | 423 | _fit(xtrain=xtrain, ytrain=ytrain, xval=xval, yval=yval, plot_test=plot_test) 424 | 425 | emissions = pd.read_csv(self.output_directory + "emissions.csv") 426 | 427 | co2 = emissions["emissions"][0] 428 | energy = emissions["energy_consumed"][0] 429 | country_name = str(emissions["country_name"][0]) 430 | region = str(emissions["region"][0]) 431 | 432 | os.remove(self.output_directory + "emissions.csv") 433 | 434 | tf.keras.backend.clear_session() 435 | 436 | dict_emissions = { 437 | "co2": co2, 438 | "energy": energy, 439 | "country_name": country_name, 440 | "region": region, 441 | "duration": self.train_duration, 442 | } 443 | 444 | with open(self.output_directory + "dict_emissions.json", "w") as fjson: 445 | json.dump(dict_emissions, fjson) 446 | 447 | return dict_emissions 448 | 449 | def predict(self, xtest, ytest): 450 | 451 | model = tf.keras.models.load_model( 452 | self.output_directory + "best_model.keras", compile=False 453 | ) 454 | 455 | start_time = time.time() 456 | ypred = model.predict(xtest) 457 | duration = time.time() - start_time 458 | 459 | ypred_argmax = np.argmax(ypred, axis=1) 460 | 461 | return ( 462 | np.asarray(ypred), 463 | accuracy_score(y_true=ytest, y_pred=ypred_argmax, normalize=True), 464 | duration, 465 | ) 466 | -------------------------------------------------------------------------------- /images/LITE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MSD-IRIMAS/LITE/ba4f3d5dd8938196708a2f5996ac0ac490dc3de2/images/LITE.png -------------------------------------------------------------------------------- /images/all-mcm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MSD-IRIMAS/LITE/ba4f3d5dd8938196708a2f5996ac0ac490dc3de2/images/all-mcm.png -------------------------------------------------------------------------------- /images/cdd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MSD-IRIMAS/LITE/ba4f3d5dd8938196708a2f5996ac0ac490dc3de2/images/cdd.png -------------------------------------------------------------------------------- /images/litetime1v1-mcm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MSD-IRIMAS/LITE/ba4f3d5dd8938196708a2f5996ac0ac490dc3de2/images/litetime1v1-mcm.png -------------------------------------------------------------------------------- /images/results_lite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MSD-IRIMAS/LITE/ba4f3d5dd8938196708a2f5996ac0ac490dc3de2/images/results_lite.png -------------------------------------------------------------------------------- /images/results_litetime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MSD-IRIMAS/LITE/ba4f3d5dd8938196708a2f5996ac0ac490dc3de2/images/results_litetime.png -------------------------------------------------------------------------------- /images/summary_with_flops.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MSD-IRIMAS/LITE/ba4f3d5dd8938196708a2f5996ac0ac490dc3de2/images/summary_with_flops.png -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from utils.utils import load_data, znormalisation, encode_labels, create_directory 2 | import sys 3 | import os 4 | import pandas as pd 5 | import numpy as np 6 | import json 7 | import argparse 8 | from distutils.util import strtobool 9 | 10 | from classifiers.lite import LITE 11 | from classifiers.litemv import LITEMV 12 | 13 | from sklearn.metrics import accuracy_score 14 | 15 | 16 | def get_args(): 17 | parser = argparse.ArgumentParser( 18 | description="Choose to apply which classifier on which dataset with number of runs." 19 | ) 20 | 21 | parser.add_argument( 22 | "--dataset", 23 | help="which dataset to run the experiment on.", 24 | type=str, 25 | default="Coffee", 26 | ) 27 | 28 | parser.add_argument( 29 | "--classifier", 30 | help="which classifier to use", 31 | type=str, 32 | choices=["LITE","LITEMV"], 33 | default="LITE", 34 | ) 35 | 36 | parser.add_argument("--runs", help="number of runs to do", type=int, default=5) 37 | 38 | parser.add_argument( 39 | "--output-directory", 40 | help="output directory parent", 41 | type=str, 42 | default="results/", 43 | ) 44 | 45 | parser.add_argument( 46 | "--track-emissions", type=lambda x: bool(strtobool(x)), default=True 47 | ) 48 | 49 | args = parser.parse_args() 50 | 51 | return args 52 | 53 | 54 | if __name__ == "__main__": 55 | args = get_args() 56 | 57 | output_directory_parent = args.output_directory 58 | create_directory(output_directory_parent) 59 | output_directory_parent = output_directory_parent + args.classifier + "/" 60 | create_directory(output_directory_parent) 61 | 62 | xtrain, ytrain, xtest, ytest = load_data(file_name=args.dataset) 63 | 64 | length_TS = int(xtrain.shape[1]) 65 | 66 | xtrain = znormalisation(xtrain) 67 | xtrain = np.expand_dims(xtrain, axis=2) 68 | 69 | xtest = znormalisation(xtest) 70 | xtest = np.expand_dims(xtest, axis=2) 71 | 72 | ytrain = encode_labels(ytrain) 73 | ytest = encode_labels(ytest) 74 | 75 | if os.path.exists(output_directory_parent + "results_ucr.csv"): 76 | df = pd.read_csv(output_directory_parent + "results_ucr.csv") 77 | 78 | file_names = list(df["dataset"]) 79 | if args.dataset in file_names: 80 | exit() 81 | else: 82 | if args.track_emissions: 83 | df = pd.DataFrame( 84 | columns=[ 85 | "dataset", 86 | args.classifier + "-mean", 87 | args.classifier + "-std", 88 | args.classifier + "Time", 89 | "Training Time-mean", 90 | "Testing Time-mean", 91 | "CO2 Consumption-mean", 92 | "Energy Consumption-mean", 93 | "Country", 94 | "Region", 95 | ] 96 | ) 97 | else: 98 | df = pd.DataFrame( 99 | columns=[ 100 | "dataset", 101 | args.classifier + "-mean", 102 | args.classifier + "-std", 103 | args.classifier + "Time", 104 | ] 105 | ) 106 | 107 | ypred = np.zeros(shape=(len(ytest), len(np.unique(ytest)))) 108 | 109 | Scores = [] 110 | 111 | if args.track_emissions: 112 | training_time = [] 113 | testing_time = [] 114 | 115 | co2_consumption = [] 116 | energy_consumption = [] 117 | 118 | for _run in range(args.runs): 119 | output_directory = output_directory_parent + "run_" + str(_run) + "/" 120 | create_directory(output_directory) 121 | output_directory = output_directory + args.dataset + "/" 122 | create_directory(output_directory) 123 | 124 | if args.classifier == "LITE": 125 | clf = LITE( 126 | output_directory=output_directory, 127 | length_TS=length_TS, 128 | n_classes=len(np.unique(ytrain)), 129 | ) 130 | elif args.classifier == "LITEMV": 131 | clf = LITEMV( 132 | output_directory=output_directory, 133 | length_TS=length_TS, 134 | n_classes=len(np.unique(ytrain)), 135 | ) 136 | else: 137 | raise ValueError("Choose an existing classifier.") 138 | 139 | if not os.path.exists(output_directory + "loss.pdf"): 140 | if args.track_emissions: 141 | dict_emissions = clf.fit_and_track_emissions( 142 | xtrain=xtrain, ytrain=ytrain, xval=xtest, yval=ytest, plot_test=True 143 | ) 144 | else: 145 | clf.fit( 146 | xtrain=xtrain, ytrain=ytrain, xval=xtest, yval=ytest, plot_test=True 147 | ) 148 | 149 | else: 150 | if args.track_emissions: 151 | with open(output_directory + "dict_emissions.json") as json_file: 152 | dict_emissions = json.load(json_file) 153 | 154 | if args.track_emissions: 155 | co2_consumption.append(dict_emissions["co2"]) 156 | energy_consumption.append(dict_emissions["energy"]) 157 | 158 | training_time.append(dict_emissions["duration"]) 159 | 160 | y_pred, acc, duration_test = clf.predict(xtest=xtest, ytest=ytest) 161 | 162 | testing_time.append(duration_test) 163 | 164 | else: 165 | y_pred, acc, _ = clf.predict(xtest=xtest, ytest=ytest) 166 | 167 | ypred = ypred + y_pred 168 | 169 | Scores.append(acc) 170 | 171 | ypred = ypred / (args.runs * 1.0) 172 | ypred = np.argmax(ypred, axis=1) 173 | 174 | acc_Time = accuracy_score(y_true=ytest, y_pred=ypred, normalize=True) 175 | 176 | if args.track_emissions: 177 | df.loc[len(df)] = { 178 | "dataset": args.dataset, 179 | args.classifier + "-mean": np.mean(Scores), 180 | args.classifier + "-std": np.std(Scores), 181 | args.classifier + "Time": acc_Time, 182 | "Training Time-mean": np.mean(training_time), 183 | "Testing Time-mean": np.mean(testing_time), 184 | "CO2 Consumption-mean": np.mean(co2_consumption), 185 | "Energy Consumption-mean": np.mean(energy_consumption), 186 | "Country": str(dict_emissions["country_name"]), 187 | "Region": str(dict_emissions["region"]), 188 | } 189 | else: 190 | df.loc[len(df)] = { 191 | "dataset": args.dataset, 192 | args.classifier + "-mean": np.mean(Scores), 193 | args.classifier + "-std": np.std(Scores), 194 | args.classifier + "Time": acc_Time, 195 | } 196 | 197 | df.to_csv(output_directory_parent + "results_ucr.csv", index=False) 198 | -------------------------------------------------------------------------------- /results.csv: -------------------------------------------------------------------------------- 1 | dataset,FCN,ResNet,Inception,InceptionTime,LITE,LITETime,ROCKET,MultiROCKET 2 | ACSF1,0.896,0.916,0.898,0.94,0.898,0.91,0.886,0.92 3 | Adiac,0.844501278772378,0.833248081841432,0.821994884910486,0.846547314578005,0.810230179028133,0.833759590792839,0.78337596,0.833759590792839 4 | AllGestureWiimoteX,0.71,0.740571428571429,0.772857142857143,0.787142857142857,0.742285714285714,0.765714285714286,0.79,0.727142857142857 5 | AllGestureWiimoteY,0.782,0.793714285714285,0.808857142857143,0.822857142857143,0.771714285714286,0.788571428571429,0.77271429,0.772857142857143 6 | AllGestureWiimoteZ,0.687142857142857,0.725714285714286,0.776285714285714,0.792857142857143,0.731714285714286,0.752857142857143,0.76614286,0.752857142857143 7 | ArrowHead,0.84,0.837714285714286,0.845714285714286,0.851428571428571,0.821714285714286,0.84,0.81428571,0.868571428571428 8 | BME,0.844,0.998666666666666,0.994666666666667,0.993333333333333,0.98,0.993333333333333,1,1 9 | Beef,0.66,0.753333333333333,0.706666666666667,0.7,0.72,0.766666666666667,0.83333333,0.766666666666667 10 | BeetleFly,0.9,0.85,0.83,0.85,0.87,0.9,0.9,0.85 11 | BirdChicken,0.93,0.88,0.95,0.95,0.89,0.9,0.9,0.9 12 | CBF,0.993777777777778,0.995777777777778,0.998888888888889,0.998888888888889,0.997555555555556,0.998888888888889,1,0.996666666666667 13 | Car,0.906666666666667,0.916666666666667,0.903333333333333,0.916666666666667,0.923333333333333,0.933333333333333,0.84666667,0.916666666666667 14 | Chinatown,0.979591836734694,0.978425655976676,0.979591836734694,0.982507288629738,0.980174927113703,0.982507288629738,0.98250729,0.979591836734694 15 | ChlorineConcentration,0.804010416666667,0.852760416666667,0.8690625,0.873177083333333,0.84265625,0.8484375,0.81453125,0.784114583333333 16 | CinCECGTorso,0.822898550724637,0.837826086956521,0.725652173913043,0.85,0.782463768115942,0.873188405797101,0.83615942,0.951449275362319 17 | Coffee,1,1,1,1,1,1,1,1 18 | Computers,0.8176,0.8056,0.7856,0.792,0.7952,0.812,0.7612,0.784 19 | CricketX,0.791794871794872,0.798974358974359,0.838461538461539,0.851282051282051,0.808717948717949,0.830769230769231,0.81948718,0.807692307692308 20 | CricketY,0.782051282051282,0.810256410256411,0.842051282051282,0.858974358974359,0.832820512820513,0.876923076923077,0.85230769,0.843589743589744 21 | CricketZ,0.80051282051282,0.808717948717949,0.847692307692308,0.853846153846154,0.843589743589744,0.861538461538462,0.85589744,0.835897435897436 22 | Crop,0.739535714285714,0.742928571428571,0.752404761904762,0.770119047619048,0.715226190476191,0.757321428571429,0.75134524,0.774761904761905 23 | DiatomSizeReduction,0.358823529411765,0.300653594771242,0.941830065359477,0.944444444444444,0.952941176470588,0.96078431372549,0.96993464,0.96078431372549 24 | DistalPhalanxOutlineAgeGroup,0.712230215827338,0.717985611510791,0.736690647482014,0.741007194244604,0.723741007194244,0.712230215827338,0.75899281,0.76978417266187 25 | DistalPhalanxOutlineCorrect,0.760144927536232,0.770289855072464,0.779710144927536,0.793478260869565,0.752173913043478,0.760869565217391,0.76956522,0.800724637681159 26 | DistalPhalanxTW,0.693525179856115,0.663309352517985,0.660431654676259,0.676258992805755,0.683453237410072,0.712230215827338,0.71870504,0.690647482014388 27 | DodgerLoopDay,0.3975,0.15,0.545,0.5875,0.54,0.575,0.5725,0.6 28 | DodgerLoopGame,0.765217391304348,0.710144927536232,0.846376811594203,0.86231884057971,0.802898550724638,0.818840579710145,0.87318841,0.833333333333333 29 | DodgerLoopWeekend,0.911594202898551,0.952173913043478,0.968115942028986,0.971014492753623,0.968115942028986,0.971014492753623,0.97463768,0.978260869565217 30 | ECG200,0.88,0.874,0.926,0.93,0.896,0.92,0.906,0.92 31 | ECG5000,0.940533333333333,0.935066666666667,0.937911111111111,0.94,0.940088888888889,0.942666666666667,0.94715556,0.946444444444444 32 | ECGFiveDays,0.98815331010453,0.966318234610917,0.998606271777004,1,0.997677119628339,0.997677119628339,1,1 33 | EOGHorizontalSignal,0.573480662983425,0.599447513812154,0.585082872928177,0.591160220994475,0.599447513812155,0.635359116022099,0.63895028,0.657458563535912 34 | EOGVerticalSignal,0.45414364640884,0.445303867403315,0.465193370165746,0.455801104972376,0.390055248618784,0.411602209944751,0.54143646,0.535911602209945 35 | Earthquakes,0.717985611510791,0.712230215827338,0.729496402877698,0.748201438848921,0.710791366906475,0.733812949640288,0.74820144,0.748201438848921 36 | ElectricDevices,0.707456879782129,0.727869277655298,0.706082220204902,0.720918168849695,0.678926209311373,0.70250291790948,0.72941253,0.735442873816626 37 | EthanolLevel,0.6796,0.7584,0.812,0.822,0.6988,0.74,0.5828,0.638 38 | FaceAll,0.93810650887574,0.866745562130177,0.790769230769231,0.792899408284024,0.791360946745562,0.792899408284024,0.94650888,0.799408284023669 39 | FaceFour,0.927272727272727,0.954545454545455,0.961363636363636,0.965909090909091,0.952272727272727,0.954545454545455,0.97727273,0.931818181818182 40 | FacesUCR,0.944292682926829,0.954243902439024,0.966146341463414,0.969756097560976,0.954536585365854,0.961951219512195,0.96141463,0.961463414634146 41 | FiftyWords,0.651428571428571,0.74021978021978,0.82021978021978,0.837362637362637,0.767472527472527,0.806593406593407,0.83032967,0.859340659340659 42 | Fish,0.961142857142857,0.980571428571428,0.977142857142857,0.971428571428571,0.980571428571428,0.977142857142857,0.97942857,0.988571428571428 43 | FordA,0.916515151515151,0.936969696969697,0.955757575757576,0.961363636363636,0.953636363636364,0.958333333333333,0.94439394,0.957575757575757 44 | FordB,0.779506172839506,0.813086419753086,0.848888888888889,0.860493827160494,0.844197530864198,0.853086419753086,0.80506173,0.838271604938272 45 | FreezerRegularTrain,0.996561403508772,0.998456140350877,0.996210526315789,0.996491228070175,0.998035087719298,0.997894736842105,0.99761404,0.999649122807018 46 | FreezerSmallTrain,0.697263157894737,0.832210526315789,0.855649122807017,0.856491228070175,0.953122807017544,0.961052631578947,0.94957895,0.995438596491228 47 | Fungi,0.013978494623656,0.17741935483871,1,1,0.997849462365591,1,1,1 48 | GestureMidAirD1,0.7,0.698461538461539,0.713846153846154,0.746153846153846,0.74,0.753846153846154,0.71692308,0.753846153846154 49 | GestureMidAirD2,0.627692307692308,0.667692307692308,0.7,0.715384615384615,0.673846153846154,0.707692307692308,0.66076923,0.707692307692308 50 | GestureMidAirD3,0.326153846153846,0.34,0.369230769230769,0.369230769230769,0.384615384615385,0.423076923076923,0.41461538,0.515384615384615 51 | GesturePebbleZ1,0.87906976744186,0.901162790697674,0.923255813953488,0.924418604651163,0.911627906976744,0.918604651162791,0.90581395,0.918604651162791 52 | GesturePebbleZ2,0.784810126582279,0.777215189873418,0.881012658227848,0.886075949367089,0.879746835443038,0.89873417721519,0.83037975,0.860759493670886 53 | GunPoint,0.997333333333333,0.990666666666666,0.998666666666666,1,0.997333333333333,1,1,1 54 | GunPointAgeSpan,0.991772151898734,0.996835443037975,0.988607594936709,0.987341772151899,0.991772151898734,0.990506329113924,0.99683544,1 55 | GunPointMaleVersusFemale,0.99620253164557,0.992405063291139,0.994303797468354,0.993670886075949,0.990506329113924,0.990506329113924,0.99841772,1 56 | GunPointOldVersusYoung,0.987936507936508,0.989206349206349,0.968888888888889,0.974603174603175,0.971428571428571,0.977777777777778,0.99111111,1 57 | Ham,0.714285714285714,0.758095238095238,0.714285714285714,0.714285714285714,0.721904761904762,0.714285714285714,0.72571429,0.723809523809524 58 | HandOutlines,0.811351351351351,0.913513513513513,0.945405405405406,0.956756756756757,0.937297297297297,0.954054054054054,0.94243243,0.951351351351351 59 | Haptics,0.474025974025974,0.50974025974026,0.545454545454545,0.564935064935065,0.52987012987013,0.564935064935065,0.52402597,0.542207792207792 60 | Herring,0.65,0.6,0.684375,0.6875,0.690625,0.765625,0.6921875,0.6875 61 | HouseTwenty,0.981512605042017,0.983193277310924,0.979831932773109,0.983193277310924,0.981512605042017,0.983193277310924,0.96386555,0.991596638655462 62 | InlineSkate,0.323272727272727,0.377090909090909,0.480727272727273,0.505454545454546,0.543272727272727,0.550909090909091,0.45690909,0.470909090909091 63 | InsectEPGRegularTrain,0.998393574297189,0.997590361445783,0.996787148594377,0.995983935742972,0.995180722891566,0.995983935742972,1,1 64 | InsectEPGSmallTrain,0.29718875502008,0.371887550200803,0.94136546184739,0.943775100401606,0.955020080321285,0.963855421686747,0.97911647,1 65 | InsectWingbeatSound,0.392525252525252,0.499292929292929,0.629090909090909,0.631818181818182,0.61040404040404,0.633333333333333,0.65681818,0.672727272727273 66 | ItalyPowerDemand,0.96268221574344,0.961516034985423,0.965986394557823,0.965014577259475,0.968513119533528,0.966958211856171,0.96958212,0.967930029154519 67 | LargeKitchenAppliances,0.899733333333333,0.901333333333333,0.9008,0.898666666666667,0.8816,0.890666666666667,0.90053333,0.882666666666667 68 | Lightning2,0.734426229508197,0.780327868852459,0.790163934426229,0.786885245901639,0.754098360655738,0.754098360655738,0.75901639,0.672131147540984 69 | Lightning7,0.827397260273973,0.827397260273973,0.813698630136986,0.821917808219178,0.827397260273973,0.835616438356164,0.82328767,0.849315068493151 70 | Mallat,0.970319829424307,0.9736460554371,0.955991471215352,0.962046908315565,0.947633262260128,0.95863539445629,0.95594883,0.927078891257996 71 | Meat,0.783333333333333,0.99,0.93,0.95,0.913333333333333,0.933333333333333,0.94833333,0.916666666666667 72 | MedicalImages,0.782631578947368,0.769736842105263,0.791578947368421,0.8,0.752631578947368,0.785526315789474,0.79947368,0.807894736842105 73 | MelbournePedestrian,0.914309143091431,0.909225092250923,0.905371053710537,0.910209102091021,0.898564985649856,0.90569905699057,0.90438704,0.962689626896269 74 | MiddlePhalanxOutlineAgeGroup,0.535064935064935,0.545454545454545,0.522077922077922,0.538961038961039,0.524675324675325,0.512987012987013,0.59025974,0.636363636363636 75 | MiddlePhalanxOutlineCorrect,0.791752577319588,0.826116838487973,0.821305841924399,0.828178694158076,0.82680412371134,0.848797250859107,0.83848797,0.859106529209622 76 | MiddlePhalanxTW,0.5,0.494805194805195,0.503896103896104,0.532467532467532,0.507792207792208,0.5,0.56038961,0.538961038961039 77 | MixedShapesRegularTrain,0.957938144329897,0.972865979381443,0.964371134020618,0.969896907216495,0.976824742268041,0.980618556701031,0.97105155,0.979381443298969 78 | MixedShapesSmallTrain,0.894268041237113,0.916536082474227,0.910103092783505,0.91298969072165,0.938639175257732,0.943917525773196,0.9382268,0.961649484536082 79 | MoteStrain,0.934345047923323,0.923961661341853,0.894888178913738,0.896166134185303,0.875718849840256,0.88258785942492,0.91461661,0.941693290734824 80 | NonInvasiveFetalECGThorax1,0.953791348600509,0.941374045801527,0.956335877862595,0.959287531806616,0.952162849872773,0.959796437659033,0.9529771,0.958778625954198 81 | NonInvasiveFetalECGThorax2,0.952773536895674,0.943613231552163,0.957455470737914,0.961832061068702,0.953791348600509,0.960814249363868,0.96905852,0.968447837150127 82 | OSULeaf,0.967768595041322,0.980165289256198,0.929752066115702,0.933884297520661,0.956198347107438,0.954545454545455,0.94090909,0.954545454545455 83 | OliveOil,0.506666666666667,0.846666666666667,0.846666666666667,0.866666666666667,0.693333333333333,0.8,0.91666667,0.966666666666667 84 | PLAID,0.903538175046555,0.940409683426443,0.937057728119181,0.942271880819367,0.906517690875233,0.919925512104283,0.90260708,0.934823091247672 85 | PhalangesOutlinesCorrect,0.821678321678322,0.845221445221445,0.834731934731935,0.858974358974359,0.821678321678322,0.84032634032634,0.83426573,0.834498834498834 86 | Phoneme,0.32542194092827,0.333438818565401,0.329008438818565,0.340189873417721,0.309388185654008,0.337025316455696,0.27985232,0.347573839662447 87 | PickupGestureWiimoteZ,0.744,0.704,0.748,0.76,0.756,0.78,0.83,0.84 88 | PigAirwayPressure,0.192307692307692,0.405769230769231,0.513461538461538,0.543269230769231,0.347115384615385,0.471153846153846,0.09519231,0.596153846153846 89 | PigArtPressure,0.9875,0.991346153846154,0.992307692307692,0.995192307692308,0.993269230769231,0.995192307692308,0.95384615,0.951923076923077 90 | PigCVP,0.803846153846154,0.918269230769231,0.948076923076923,0.961538461538462,0.935576923076923,0.947115384615385,0.93413462,0.870192307692308 91 | Plane,1,1,1,1,1,1,1,1 92 | PowerCons,0.872222222222222,0.878888888888889,0.95,0.955555555555556,0.944444444444444,0.961111111111111,0.94,0.994444444444444 93 | ProximalPhalanxOutlineAgeGroup,0.830243902439024,0.846829268292683,0.833170731707317,0.839024390243902,0.837073170731707,0.853658536585366,0.85560976,0.853658536585366 94 | ProximalPhalanxOutlineCorrect,0.898969072164948,0.919587628865979,0.91340206185567,0.927835051546392,0.905154639175258,0.917525773195876,0.89896907,0.917525773195876 95 | ProximalPhalanxTW,0.769756097560976,0.772682926829268,0.769756097560976,0.785365853658537,0.781463414634146,0.804878048780488,0.81658537,0.819512195121951 96 | RefrigerationDevices,0.5104,0.530133333333333,0.513066666666667,0.514666666666667,0.496533333333333,0.496,0.53733333,0.528 97 | Rock,0.632,0.552,0.78,0.82,0.828,0.86,0.9,0.86 98 | ScreenType,0.620266666666667,0.615466666666667,0.584533333333333,0.589333333333333,0.565866666666667,0.589333333333333,0.48533333,0.56 99 | SemgHandGenderCh2,0.831333333333333,0.823666666666667,0.815333333333333,0.816666666666667,0.843666666666667,0.868333333333333,0.92683333,0.951666666666667 100 | SemgHandMovementCh2,0.478222222222222,0.439111111111111,0.406666666666667,0.444444444444444,0.478666666666667,0.511111111111111,0.64511111,0.768888888888889 101 | SemgHandSubjectCh2,0.741777777777778,0.738666666666667,0.784888888888889,0.811111111111111,0.767555555555555,0.802222222222222,0.88111111,0.917777777777778 102 | ShakeGestureWiimoteZ,0.884,0.88,0.888,0.9,0.928,0.96,0.898,0.94 103 | ShapeletSim,0.747777777777778,0.782222222222222,0.952222222222222,0.988888888888889,0.737777777777778,0.75,1,1 104 | ShapesAll,0.892333333333333,0.926333333333333,0.92,0.925,0.899666666666667,0.913333333333333,0.90683333,0.921666666666667 105 | SmallKitchenAppliances,0.776,0.781333333333334,0.757866666666667,0.776,0.757866666666667,0.770666666666667,0.8184,0.821333333333333 106 | SmoothSubspace,0.969333333333333,0.98,0.98,0.98,0.984,0.986666666666667,0.97866667,0.98 107 | SonyAIBORobotSurface1,0.965058236272879,0.960732113144759,0.866555740432612,0.866888519134775,0.841597337770383,0.835274542429285,0.92246256,0.886855241264559 108 | SonyAIBORobotSurface2,0.977334732423924,0.975445960125918,0.954039874081847,0.959076600209864,0.939559286463798,0.941238195173137,0.91259182,0.940188877229801 109 | StarLightCurves,0.966270033997086,0.972292374939291,0.977634774162215,0.979844584749879,0.97442933462846,0.976687712481787,0.98096163,0.981665857212239 110 | Strawberry,0.96972972972973,0.98,0.982702702702703,0.983783783783784,0.978378378378378,0.983783783783784,0.98135135,0.981081081081081 111 | SwedishLeaf,0.96704,0.96256,0.96608,0.9696,0.95584,0.9616,0.964,0.9792 112 | Symbols,0.964422110552764,0.893065326633166,0.981105527638191,0.981909547738693,0.98070351758794,0.982914572864322,0.97427136,0.982914572864322 113 | SyntheticControl,0.987333333333333,0.996666666666667,0.995333333333333,0.996666666666667,0.998666666666666,1,0.99966667,0.993333333333333 114 | ToeSegmentation1,0.959649122807017,0.957017543859649,0.964912280701754,0.973684210526316,0.969298245614035,0.978070175438596,0.96842105,0.956140350877193 115 | ToeSegmentation2,0.887692307692308,0.893846153846154,0.947692307692308,0.953846153846154,0.927692307692308,0.938461538461538,0.92384615,0.907692307692308 116 | Trace,1,1,1,1,1,1,1,1 117 | TwoLeadECG,0.99964881474978,1,0.995961369622476,0.995610184372256,0.997892888498683,0.998244073748903,0.99912204,0.998244073748903 118 | TwoPatterns,0.86945,0.99995,1,1,1,1,1,1 119 | UMD,0.986111111111111,0.990277777777778,0.983333333333333,0.986111111111111,0.954166666666667,0.965277777777778,0.99236111,0.993055555555556 120 | UWaveGestureLibraryAll,0.814461194863205,0.860804020100503,0.946231155778894,0.951982132886656,0.890954773869347,0.912339475153546,0.97537688,0.979899497487437 121 | UWaveGestureLibraryX,0.750753768844221,0.781239530988275,0.812227805695142,0.821887213847013,0.809268565047459,0.829424902289224,0.85474595,0.869625907314349 122 | UWaveGestureLibraryY,0.643439419318816,0.665829145728643,0.754383026242323,0.766890005583473,0.723841429369068,0.761585706309324,0.77398102,0.797319932998325 123 | UWaveGestureLibraryZ,0.726465661641541,0.748632049134562,0.75499720826354,0.761027359017309,0.756169737576773,0.780848687883864,0.79190396,0.815466219988833 124 | Wafer,0.997242050616483,0.99805321219987,0.998734587929916,0.99870214146658,0.999026606099935,0.999026606099935,0.99823167,0.999513303049968 125 | Wine,0.625925925925926,0.722222222222222,0.666666666666667,0.666666666666667,0.640740740740741,0.666666666666667,0.81296296,0.888888888888889 126 | WordSynonyms,0.564263322884013,0.616614420062696,0.729153605015674,0.760188087774295,0.678683385579937,0.717868338557994,0.75344828,0.775862068965517 127 | Worms,0.776623376623377,0.761038961038961,0.768831168831169,0.792207792207792,0.81038961038961,0.818181818181818,0.74025974,0.753246753246753 128 | WormsTwoClass,0.732467532467533,0.748051948051948,0.758441558441558,0.779220779220779,0.784415584415584,0.766233766233766,0.7974026,0.792207792207792 129 | Yoga,0.8424,0.866733333333333,0.8998,0.907666666666667,0.906733333333333,0.917666666666667,0.91036667,0.919 130 | -------------------------------------------------------------------------------- /results_ensemble_study.csv: -------------------------------------------------------------------------------- 1 | dataset,LITETime-1,LITETime-2,LITETime-3,LITETime-4,LITETime-5,LITETime-6,LITETime-7,LITETime-8,LITETime-9,LITETime-10 2 | ACSF1,0.892,0.904888888888889,0.907666666666667,0.908714285714286,0.908690476190476,0.908,0.907333333333333,0.906888888888889,0.908,0.91 3 | Adiac,0.823017902813299,0.834441602728048,0.837063086104007,0.837766410912191,0.837352332237243,0.836682499086591,0.835954816709292,0.834953111679454,0.834526854219949,0.836317135549872 4 | ArrowHead,0.828571428571429,0.826285714285714,0.830190476190476,0.830503401360544,0.833061224489796,0.833251700680272,0.835238095238095,0.83631746031746,0.836571428571429,0.84 5 | BME,0.976,0.980296296296296,0.983,0.983301587301587,0.98441798941799,0.984730158730159,0.985055555555556,0.985333333333333,0.986,0.986666666666667 6 | Beef,0.746666666666667,0.744444444444444,0.747222222222222,0.748095238095238,0.749206349206349,0.749365079365079,0.749444444444444,0.751111111111111,0.753333333333333,0.766666666666667 7 | BeetleFly,0.84,0.848888888888889,0.852916666666667,0.86,0.864285714285714,0.872380952380953,0.878333333333333,0.885555555555555,0.89,0.9 8 | BirdChicken,0.89,0.894444444444444,0.894166666666667,0.896428571428572,0.898611111111111,0.9,0.9,0.9,0.9,0.9 9 | CBF,0.998222222222222,0.998592592592593,0.998712962962963,0.998767195767196,0.998840388007054,0.998883597883598,0.998888888888889,0.998888888888889,0.998888888888889,0.998888888888889 10 | Car,0.931666666666666,0.938148148148148,0.938472222222222,0.938095238095238,0.937632275132275,0.936111111111111,0.935138888888889,0.934074074074074,0.933333333333333,0.933333333333333 11 | Chinatown,0.980758017492711,0.98153547133139,0.981632653061224,0.981591003748438,0.981454486556527,0.981507705122865,0.981559766763848,0.98166504697117,0.981632653061224,0.982507288629738 12 | ChlorineConcentration,0.845078125,0.850266203703704,0.851358506944444,0.852201140873016,0.852582465277778,0.852805059523809,0.853005642361111,0.853090277777778,0.853098958333333,0.853385416666667 13 | CinCECGTorso,0.810507246376811,0.847971014492754,0.873623188405797,0.876066252587992,0.877188290775247,0.877850241545893,0.878043478260869,0.878421900161031,0.878478260869565,0.878985507246377 14 | Coffee,1,1,1,1,1,1,1,1,1,1 15 | Computers,0.8044,0.808088888888889,0.811866666666667,0.811961904761905,0.814809523809524,0.816438095238095,0.818733333333333,0.821333333333333,0.8236,0.828 16 | CricketX,0.815641025641026,0.828945868945869,0.833803418803419,0.837240537240537,0.839183964183964,0.840659340659341,0.841645299145299,0.841652421652422,0.840769230769231,0.841025641025641 17 | CricketY,0.82,0.833789173789174,0.84,0.842539682539683,0.844444444444444,0.844493284493285,0.846153846153846,0.846267806267806,0.846153846153846,0.848717948717949 18 | CricketZ,0.838974358974359,0.856296296296296,0.863183760683761,0.866483516483517,0.869108669108669,0.871306471306471,0.872884615384616,0.875441595441595,0.875128205128205,0.879487179487179 19 | Crop,0.716619047619048,0.736526455026455,0.747502976190476,0.754,0.757611252834467,0.760420351473923,0.762164186507937,0.764029100529101,0.764505952380952,0.765714285714286 20 | DiatomSizeReduction,0.952287581699346,0.950108932461873,0.94983660130719,0.950513538748833,0.949540927482104,0.948443821973234,0.948393246187364,0.947857661583152,0.945751633986928,0.944444444444444 21 | DistalPhalanxOutlineAgeGroup,0.71294964028777,0.713029576338929,0.718405275779377,0.717848578280233,0.718568002740665,0.717882836587873,0.717925659472422,0.715747402078337,0.713669064748201,0.712230215827338 22 | DistalPhalanxOutlineCorrect,0.759057971014493,0.760708534621578,0.765670289855072,0.764216701173223,0.76626121463078,0.766494133885438,0.767149758454106,0.769645732689211,0.770289855072464,0.77536231884058 23 | DistalPhalanxTW,0.676978417266187,0.685531574740208,0.689208633093525,0.690887290167866,0.689733927143999,0.690339157245632,0.689328537170264,0.686011191047162,0.683453237410072,0.683453237410072 24 | ECG200,0.894,0.891555555555555,0.893583333333333,0.891333333333333,0.892857142857143,0.892095238095238,0.89275,0.891555555555556,0.894,0.89 25 | ECG5000,0.940488888888889,0.941975308641975,0.942418518518518,0.942642328042328,0.942893298059965,0.942930158730159,0.943122222222222,0.943106172839506,0.943333333333333,0.943111111111111 26 | ECGFiveDays,0.996631823461092,0.996593108788231,0.996438250096786,0.996266799402688,0.99611470604502,0.995912836679387,0.995770421989934,0.995663956639566,0.995586527293844,0.995354239256678 27 | EOGHorizontalSignal,0.581491712707182,0.595395948434622,0.601381215469613,0.602394106813996,0.604906603525388,0.604959221257564,0.606123388581952,0.606629834254144,0.609668508287293,0.607734806629834 28 | EOGVerticalSignal,0.39585635359116,0.413382443216698,0.419313996316759,0.422428308339911,0.424614136630711,0.425585372270455,0.426565377532228,0.425782688766114,0.424861878453039,0.422651933701657 29 | Earthquakes,0.715107913669065,0.728057553956835,0.725179856115108,0.723878040424803,0.723192874272011,0.723775265501884,0.722182254196643,0.721502797761791,0.720863309352518,0.712230215827338 30 | ElectricDevices,0.684139540915575,0.697540310379112,0.701812345999222,0.70511452408742,0.706071824830741,0.70734386868481,0.707543336359313,0.708459776077465,0.707897808325768,0.708987161198288 31 | EthanolLevel,0.7444,0.764888888888889,0.7718,0.775028571428572,0.77684126984127,0.778180952380952,0.77865,0.780533333333333,0.7792,0.784 32 | FaceAll,0.819704142011834,0.821998685075608,0.819462524654832,0.819568892645816,0.819287123133277,0.819588616511693,0.819763313609468,0.820302432610125,0.820650887573964,0.82189349112426 33 | FaceFour,0.95,0.954040404040404,0.954356060606061,0.954545454545455,0.954545454545455,0.954545454545455,0.954545454545455,0.954545454545454,0.954545454545455,0.954545454545455 34 | FacesUCR,0.954390243902439,0.959772357723577,0.961776422764228,0.962831591173054,0.963739837398374,0.964497096399536,0.965219512195122,0.965929539295393,0.966585365853658,0.966341463414634 35 | FiftyWords,0.766153846153846,0.789108669108669,0.797857142857143,0.80276295133438,0.805468341182627,0.80661433804291,0.807527472527473,0.807326007326007,0.805934065934066,0.802197802197802 36 | Fish,0.978285714285714,0.981333333333333,0.981523809523809,0.981931972789115,0.982267573696145,0.982530612244898,0.98252380952381,0.98247619047619,0.982285714285714,0.982857142857143 37 | FordA,0.953030303030303,0.957373737373737,0.957556818181818,0.959069264069264,0.959102934102934,0.959992784992785,0.960164141414141,0.96037037037037,0.960606060606061,0.960606060606061 38 | FordB,0.841975308641975,0.847379972565158,0.848713991769547,0.849094650205761,0.849955908289242,0.850217519106408,0.851471193415638,0.8519890260631,0.853703703703704,0.853086419753086 39 | FreezerRegularTrain,0.998070175438597,0.998081871345029,0.998149122807018,0.998172096908939,0.998195488721804,0.998225563909775,0.998230994152047,0.998222222222222,0.998245614035088,0.998245614035088 40 | FreezerSmallTrain,0.942140350877193,0.945684210526315,0.947114035087719,0.947736006683375,0.948106377053746,0.9483776106934,0.948698830409357,0.949091617933723,0.949087719298245,0.949122807017544 41 | Fungi,0.999462365591398,1,1,1,1,1,1,1,1,1 42 | GunPoint,1,1,1,1,1,1,1,1,1,1 43 | GunPointAgeSpan,0.992088607594937,0.990717299578059,0.990717299578059,0.99038577456299,0.990280289330922,0.990385774562989,0.990506329113924,0.990506329113924,0.990506329113924,0.990506329113924 44 | GunPointMaleVersusFemale,0.991772151898734,0.992264416315049,0.992536919831224,0.992570825798674,0.992791842475387,0.993022905364678,0.993222573839663,0.993459915611814,0.99367088607595,0.993670886075949 45 | GunPointOldVersusYoung,0.973015873015873,0.975661375661375,0.974761904761905,0.975691609977324,0.975497606449987,0.975540438397581,0.97537037037037,0.975167548500882,0.974920634920635,0.974603174603175 46 | Ham,0.725714285714286,0.733968253968254,0.735634920634921,0.732517006802721,0.731254724111867,0.728616780045352,0.727539682539682,0.726772486772487,0.723809523809524,0.723809523809524 47 | HandOutlines,0.936756756756757,0.948708708708709,0.951846846846847,0.954041184041184,0.95513728013728,0.956216216216216,0.956846846846847,0.957057057057057,0.957027027027027,0.956756756756757 48 | Haptics,0.542207792207792,0.562987012987013,0.567830086580087,0.572108843537415,0.572665429808287,0.57269635126778,0.570968614718615,0.568326118326118,0.569805194805195,0.561688311688312 49 | Herring,0.6859375,0.703125,0.702734375,0.711383928571429,0.709635416666667,0.715104166666667,0.715364583333333,0.718402777777778,0.7203125,0.71875 50 | HouseTwenty,0.978991596638655,0.981325863678805,0.982633053221288,0.983113245298119,0.983193277310924,0.983193277310924,0.983193277310924,0.983193277310924,0.983193277310924,0.983193277310924 51 | InlineSkate,0.530181818181818,0.544686868686869,0.549530303030303,0.550761904761905,0.551479076479077,0.552701298701299,0.552484848484848,0.55389898989899,0.554909090909091,0.556363636363636 52 | InsectEPGRegularTrain,0.997991967871486,0.998661311914324,0.998728246318608,0.998986421877988,0.999091604513291,0.999388028303691,0.999531459170013,0.999732262382865,1,1 53 | InsectEPGSmallTrain,0.964658634538152,0.967692994199018,0.968239625167336,0.968406961178045,0.967520877159431,0.967221266016446,0.967001338688085,0.966711289602856,0.966265060240964,0.963855421686747 54 | InsectWingbeatSound,0.615606060606061,0.630639730639731,0.635900673400673,0.638992303992304,0.64119568702902,0.643213083213083,0.644431818181818,0.646217732884399,0.646717171717172,0.645959595959596 55 | ItalyPowerDemand,0.966861030126336,0.966569484936832,0.966310333657273,0.966078948586237,0.965866845604455,0.965815169605257,0.96573534175575,0.965619263578447,0.96530612244898,0.965986394557823 56 | LargeKitchenAppliances,0.879733333333333,0.881955555555556,0.882177777777778,0.881498412698413,0.880285714285714,0.879187301587302,0.878222222222222,0.876681481481481,0.876,0.874666666666667 57 | Lightning2,0.788524590163935,0.787613843351548,0.78620218579235,0.785480093676815,0.785779339058027,0.786651053864169,0.78551912568306,0.778870673952641,0.777049180327869,0.770491803278688 58 | Lightning7,0.824657534246575,0.831354642313546,0.834931506849315,0.835420743639922,0.835507719069363,0.835551206784083,0.835844748858447,0.835616438356164,0.835616438356164,0.835616438356164 59 | Mallat,0.947974413646056,0.957280265339967,0.95908315565032,0.95989034419738,0.960293769248993,0.960659965478729,0.961023454157783,0.961279317697228,0.96183368869936,0.963752665245202 60 | Meat,0.913333333333333,0.919259259259259,0.921805555555556,0.923492063492064,0.925066137566138,0.926031746031746,0.926111111111111,0.926666666666666,0.926666666666666,0.933333333333333 61 | MedicalImages,0.752763157894737,0.765526315789474,0.76952850877193,0.773364661654135,0.775652673350042,0.777230576441103,0.778848684210526,0.780701754385965,0.781052631578947,0.781578947368421 62 | MiddlePhalanxOutlineAgeGroup,0.491558441558442,0.504040404040404,0.504274891774892,0.510482374768089,0.510332921047207,0.51156462585034,0.511742424242424,0.50981240981241,0.507142857142857,0.5 63 | MiddlePhalanxOutlineCorrect,0.817525773195876,0.823825887743413,0.830297823596793,0.830355097365407,0.834696994490809,0.832826051382753,0.838373424971363,0.833982436044292,0.84020618556701,0.831615120274914 64 | MiddlePhalanxTW,0.506493506493507,0.517171717171717,0.514069264069264,0.514100185528757,0.512420119562977,0.513203463203463,0.5125,0.512987012987013,0.512987012987013,0.519480519480519 65 | MixedShapesRegularTrain,0.974886597938144,0.976843069873998,0.977680412371134,0.978548846342661,0.979001800032728,0.979314678448699,0.979563573883162,0.97973883161512,0.98,0.98020618556701 66 | MixedShapesSmallTrain,0.936453608247423,0.939298969072165,0.940226804123711,0.941050564555719,0.941502209131075,0.941765341188022,0.941910652920962,0.942176403207331,0.942350515463918,0.943092783505155 67 | MoteStrain,0.87332268370607,0.874920127795527,0.875725505857295,0.875821542674578,0.875836756427811,0.875779704853187,0.876071618743344,0.875896343627973,0.876277955271566,0.876198083067093 68 | NonInvasiveFetalECGThorax1,0.951348600508906,0.957512015832627,0.959588634435963,0.961054162122864,0.961573569207157,0.962193141887798,0.962642069550466,0.963098671190274,0.963206106870229,0.964885496183206 69 | NonInvasiveFetalECGThorax2,0.954503816793893,0.959773819621148,0.961242578456319,0.962185871804192,0.962548972090957,0.963053435114504,0.963002544529262,0.963279615493356,0.962798982188295,0.962849872773537 70 | OSULeaf,0.959504132231405,0.962167125803489,0.963326446280992,0.963951200314837,0.964105339105339,0.964502164502164,0.964462809917355,0.964738292011019,0.966115702479339,0.966942148760331 71 | OliveOil,0.746666666666667,0.754814814814815,0.785555555555556,0.79952380952381,0.809656084656085,0.82015873015873,0.825833333333333,0.828148148148148,0.83,0.833333333333333 72 | PhalangesOutlinesCorrect,0.822377622377622,0.833074333074333,0.83935508935509,0.84004329004329,0.842708217708218,0.843151293151293,0.844764957264957,0.843874643874644,0.845454545454545,0.843822843822844 73 | Phoneme,0.317246835443038,0.328539615564932,0.335337552742616,0.338919027526622,0.341778430781595,0.343216294956801,0.344615857946554,0.346284575714955,0.34662447257384,0.34915611814346 74 | PigAirwayPressure,0.404807692307692,0.444871794871795,0.467107371794872,0.47724358974359,0.483306623931624,0.487820512820513,0.491426282051282,0.494230769230769,0.498557692307692,0.495192307692308 75 | PigArtPressure,0.990384615384616,0.993162393162393,0.995072115384616,0.995169413919414,0.995192307692308,0.995192307692308,0.995192307692308,0.995192307692308,0.995192307692308,0.995192307692308 76 | PigCVP,0.942788461538461,0.948504273504274,0.952163461538462,0.953388278388279,0.954002594627595,0.953983516483516,0.954527243589744,0.954594017094017,0.955288461538462,0.956730769230769 77 | Plane,1,1,1,1,1,1,1,1,1,1 78 | PowerCons,0.957777777777778,0.966913580246914,0.970046296296296,0.973280423280423,0.974514991181658,0.97558201058201,0.976296296296296,0.976543209876543,0.977777777777778,0.977777777777778 79 | ProximalPhalanxOutlineAgeGroup,0.84390243902439,0.853333333333334,0.856178861788618,0.85602787456446,0.857026713124274,0.857862950058072,0.857479674796748,0.858428184281843,0.859024390243902,0.863414634146341 80 | ProximalPhalanxOutlineCorrect,0.901374570446735,0.909583810614738,0.913258877434135,0.912469317623957,0.91398025418644,0.91340206185567,0.913459335624284,0.91340206185567,0.910309278350515,0.910652920962199 81 | ProximalPhalanxTW,0.781951219512195,0.787967479674797,0.789471544715447,0.789756097560976,0.790321331784746,0.78931475029036,0.789349593495935,0.787533875338754,0.788292682926829,0.785365853658537 82 | RefrigerationDevices,0.4968,0.499437037037037,0.499533333333333,0.50007619047619,0.499280423280423,0.500253968253968,0.499088888888889,0.5008,0.499733333333333,0.501333333333333 83 | Rock,0.83,0.822222222222222,0.831833333333333,0.833809523809524,0.83531746031746,0.836666666666667,0.837333333333333,0.838222222222223,0.84,0.84 84 | ScreenType,0.574933333333333,0.580918518518519,0.585866666666667,0.588660317460317,0.590656084656084,0.592190476190476,0.592466666666667,0.5936,0.594133333333333,0.594666666666667 85 | SemgHandGenderCh2,0.839833333333333,0.853481481481482,0.858166666666667,0.860833333333333,0.862486772486772,0.864769841269841,0.8655,0.866814814814815,0.867666666666667,0.868333333333333 86 | SemgHandMovementCh2,0.466666666666667,0.498222222222222,0.513851851851852,0.524666666666667,0.531543209876543,0.536878306878307,0.54037037037037,0.545777777777778,0.550666666666667,0.551111111111111 87 | SemgHandSubjectCh2,0.767333333333333,0.785975308641975,0.793351851851852,0.796349206349206,0.797901234567901,0.797756613756614,0.798314814814815,0.79758024691358,0.795111111111111,0.793333333333333 88 | ShapeletSim,0.708333333333333,0.722716049382716,0.728657407407408,0.730925925925926,0.731966490299824,0.732724867724868,0.73412037037037,0.734074074074074,0.733333333333333,0.727777777777778 89 | ShapesAll,0.897,0.906518518518519,0.909611111111111,0.911063492063492,0.91260582010582,0.913595238095238,0.914069444444444,0.914740740740741,0.914833333333333,0.915 90 | SmallKitchenAppliances,0.753866666666667,0.764562962962963,0.766577777777778,0.767301587301587,0.768296296296296,0.768431746031746,0.769733333333333,0.770607407407408,0.772,0.778666666666667 91 | SmoothSubspace,0.982666666666666,0.984444444444444,0.985777777777778,0.986222222222222,0.986613756613756,0.986666666666666,0.986666666666666,0.986666666666666,0.986666666666667,0.986666666666667 92 | SonyAIBORobotSurface1,0.854575707154742,0.853170641523387,0.853840820854132,0.853846763330956,0.854336687531363,0.854623246969337,0.854728230726567,0.854908485856905,0.855074875207987,0.855241264559068 93 | SonyAIBORobotSurface2,0.941238195173137,0.94252069488166,0.942138859741168,0.941837805426473,0.941467212978231,0.940998351071803,0.940800979363413,0.940352104465431,0.939559286463798,0.939139559286464 94 | StarLightCurves,0.973530840213696,0.975557174464411,0.975880281690141,0.976242512546544,0.976497876145763,0.976583061587918,0.976742350655658,0.976790243375965,0.976979116075765,0.976687712481787 95 | Strawberry,0.978378378378378,0.981561561561561,0.980990990990991,0.981634491634492,0.981166881166881,0.981788931788932,0.981846846846847,0.982282282282282,0.982432432432432,0.983783783783784 96 | SwedishLeaf,0.95648,0.961315555555556,0.962706666666667,0.964114285714286,0.964571428571429,0.965531428571428,0.965866666666667,0.96704,0.968,0.9696 97 | Symbols,0.982110552763819,0.983115577889447,0.983659966499162,0.983680306293372,0.983831857701204,0.983914812156018,0.98393634840871,0.983897264098269,0.983718592964824,0.98391959798995 98 | SyntheticControl,0.998,0.998222222222222,0.998277777777778,0.998285714285714,0.998280423280423,0.998253968253968,0.998277777777778,0.998148148148148,0.998333333333333,0.996666666666667 99 | ToeSegmentation1,0.972368421052632,0.972904483430799,0.972916666666666,0.973245614035088,0.973666805903648,0.973851294903926,0.973830409356725,0.973976608187134,0.974122807017544,0.978070175438596 100 | ToeSegmentation2,0.937692307692308,0.932478632478633,0.931153846153846,0.929084249084249,0.927899877899878,0.926190476190476,0.924551282051282,0.924273504273504,0.923846153846154,0.923076923076923 101 | Trace,1,1,1,1,1,1,1,1,1,1 102 | TwoLeadECG,0.99640035118525,0.996605209247878,0.996758852794849,0.996693005560433,0.996742478085761,0.996684644006856,0.996612525607258,0.996605209247878,0.996312554872695,0.996488147497805 103 | TwoPatterns,0.999925,0.999961111111111,0.99995625,0.999973809523809,0.999987103174603,0.999995238095238,1,1,1,1 104 | UMD,0.966666666666667,0.968364197530864,0.968402777777778,0.969246031746032,0.968391754850088,0.968419312169312,0.968113425925926,0.968055555555556,0.967361111111111,0.965277777777778 105 | UWaveGestureLibraryAll,0.893802345058626,0.906371362987778,0.910564396054346,0.912986892132621,0.914648196892753,0.91575735821967,0.916596873255165,0.917321173770085,0.91750418760469,0.918760469011725 106 | UWaveGestureLibraryX,0.807118927973199,0.82001985234816,0.823601805322911,0.826689000558347,0.827871721925323,0.828935683709553,0.82965522054718,0.829710279794032,0.830402010050251,0.829704075935232 107 | UWaveGestureLibraryY,0.721356783919598,0.742446801910788,0.748308672994603,0.753444471032411,0.755662128987087,0.757439312966951,0.758531081332589,0.759401948011663,0.760748185371301,0.761306532663317 108 | UWaveGestureLibraryZ,0.75608598548297,0.772442459209628,0.778822352503257,0.782578235090798,0.784322848811961,0.786385631863019,0.787023078354737,0.787765990446057,0.789056393076494,0.788386376326075 109 | Wafer,0.999156391953277,0.999178022928834,0.99922804455981,0.999191928555978,0.9992203835893,0.999207379252804,0.999196950032447,0.999196048741798,0.999188838416612,0.999188838416612 110 | Wine,0.644444444444444,0.62880658436214,0.624382716049383,0.617372134038801,0.60706937095826,0.607936507936508,0.598765432098765,0.596296296296296,0.596296296296296,0.555555555555556 111 | WordSynonyms,0.692476489028213,0.710727969348659,0.719840647857889,0.724488729661143,0.726439269542718,0.727660844902224,0.728513584117032,0.72838732149077,0.72742946708464,0.727272727272727 112 | Worms,0.792207792207792,0.806637806637806,0.811147186147186,0.811997526283241,0.81266749123892,0.812121212121212,0.812554112554113,0.811544011544011,0.811688311688312,0.805194805194805 113 | WormsTwoClass,0.775324675324675,0.777200577200577,0.776190476190476,0.774891774891775,0.775458668315811,0.774891774891775,0.775974025974026,0.771717171717172,0.771428571428571,0.753246753246753 114 | Yoga,0.900866666666666,0.909518518518518,0.912602777777778,0.914346031746032,0.915587301587302,0.916298412698413,0.917019444444444,0.91737037037037,0.918233333333333,0.918333333333333 115 | AllGestureWiimoteX,0.755428571428572,0.767650793650793,0.773619047619048,0.775244897959184,0.77687641723356,0.777068027210884,0.777488095238095,0.77768253968254,0.779857142857143,0.781428571428571 116 | AllGestureWiimoteY,0.776857142857143,0.789523809523809,0.79377380952381,0.79587074829932,0.798537414965986,0.80012925170068,0.801595238095238,0.802984126984127,0.804571428571429,0.807142857142857 117 | AllGestureWiimoteZ,0.727142857142857,0.744698412698413,0.749059523809524,0.751795918367347,0.752414965986395,0.753931972789116,0.754392857142857,0.755555555555556,0.756571428571429,0.754285714285714 118 | DodgerLoopDay,0.525,0.546944444444444,0.553854166666667,0.557023809523809,0.560664682539682,0.564880952380952,0.567916666666667,0.570555555555556,0.57125,0.575 119 | DodgerLoopGame,0.78695652173913,0.80354267310789,0.805434782608696,0.807832988267771,0.808201058201058,0.809730848861284,0.809963768115942,0.810305958132045,0.813768115942029,0.811594202898551 120 | DodgerLoopWeekend,0.970289855072464,0.970209339774557,0.970471014492754,0.970807453416149,0.970956981826547,0.971014492753623,0.971014492753623,0.971014492753623,0.971014492753623,0.971014492753623 121 | MelbournePedestrian,0.899056990569906,0.905225274474967,0.907069154024874,0.909033757004237,0.909452546906421,0.910234483297214,0.910386770534372,0.910965331875541,0.911111111111111,0.911849118491185 122 | GestureMidAirD1,0.709230769230769,0.725470085470086,0.731538461538461,0.733113553113553,0.735866910866911,0.735164835164835,0.736602564102564,0.734017094017094,0.733076923076923,0.730769230769231 123 | GestureMidAirD2,0.671538461538462,0.687350427350428,0.691730769230769,0.690989010989011,0.690689865689866,0.689560439560439,0.689871794871795,0.688034188034188,0.689230769230769,0.684615384615385 124 | GestureMidAirD3,0.382307692307692,0.396752136752137,0.408461538461538,0.412637362637363,0.41559829059829,0.414065934065934,0.415705128205128,0.414017094017094,0.413846153846154,0.407692307692308 125 | GesturePebbleZ1,0.913953488372093,0.917700258397933,0.918556201550387,0.919158361018826,0.919250645994832,0.919407530454042,0.919815891472868,0.919638242894057,0.919186046511628,0.924418604651163 126 | GesturePebbleZ2,0.89620253164557,0.89803094233474,0.897943037974683,0.899065702230259,0.898256982117742,0.898282097649186,0.898417721518987,0.89774964838256,0.89873417721519,0.89873417721519 127 | PickupGestureWiimoteZ,0.758,0.775111111111111,0.777333333333333,0.779333333333333,0.779444444444444,0.779047619047619,0.779333333333333,0.78,0.78,0.78 128 | PLAID,0.902420856610801,0.908835092075315,0.910567970204842,0.912343708433094,0.912934882208625,0.913673849428039,0.913640595903166,0.913718187461204,0.91340782122905,0.908752327746741 129 | ShakeGestureWiimoteZ,0.922,0.931111111111111,0.932,0.937333333333333,0.943174603174603,0.946761904761905,0.9515,0.952444444444444,0.958,0.96 130 | -------------------------------------------------------------------------------- /results_multivariate.csv: -------------------------------------------------------------------------------- 1 | dataset,LITE,LITETime,ConvTran,InceptionTime,Disjoint-CNN,FCN,ResNet,LITEMV,LITEMVTime 2 | FaceDetection,0.593927355278093,0.62372304199773,0.6722,0.5885,0.5665,0.5037,0.5948,0.586946651532349,0.610102156640182 3 | InsectWingbeat,0.332488,0.39792,0.7132,0.6956,0.6308,0.6004,0.65,0.554592,0.61724 4 | PenDigits,0.984905660377358,0.988279016580903,0.9871,0.9797,0.9708,0.9857,0.9771,0.986106346483705,0.988564894225272 5 | SpokenArabicDigits,0.985175079581628,0.987721691678036,0.9945,0.9872,0.9859,0.9836,0.9832,0.98080945884493,0.985902683037744 6 | LSST,0.574371451743714,0.628548256285483,0.6156,0.4456,0.5559,0.5616,0.5725,0.58815896188159,0.664233576642336 7 | FingerMovements,0.456,0.44,0.56,0.56,0.54,0.53,0.54,0.538,0.56 8 | MotorImagery,0.54,0.51,0.56,0.53,0.49,0.55,0.52,0.544,0.53 9 | SelfRegulationSCP1,0.733105802047781,0.750853242320819,0.918,0.8634,0.8839,0.7816,0.8362,0.724232081911263,0.73037542662116 10 | Heartbeat,0.665365853658537,0.678048780487805,0.7853,0.6248,0.717,0.678,0.7268,0.611707317073171,0.614634146341463 11 | SelfRegulationSCP2,0.544444444444444,0.538888888888889,0.5833,0.4722,0.5166,0.4667,0.5,0.548888888888889,0.55 12 | PhonemeSpectra,0.137906352520131,0.174470623322398,0.3062,0.1586,0.2821,0.1599,0.1596,0.128660900685953,0.158067402326275 13 | EthanolConcentration,0.64106463878327,0.673003802281369,0.3612,0.3489,0.2775,0.3232,0.3155,0.656273764258555,0.692015209125475 14 | HandMovementDirection,0.259459459459459,0.216216216216216,0.4054,0.3783,0.5405,0.2973,0.2838,0.337837837837838,0.351351351351351 15 | PEMS-SF,0.816184971098266,0.826589595375723,0.8284,0.8901,0.8901,0.8324,0.7399,0.776878612716763,0.791907514450867 16 | RacketSports,0.748684210526316,0.782894736842105,0.8618,0.8223,0.8355,0.8223,0.8223,0.719736842105263,0.736842105263158 17 | Epilepsy,0.988405797101449,0.985507246376812,0.9855,0.9928,0.8898,0.9928,0.9928,0.989855072463768,0.992753623188406 18 | JapaneseVowels,0.967567567567568,0.972972972972973,0.9891,0.9702,0.9756,0.973,0.9135,0.962702702702703,0.964864864864865 19 | NATOPS,0.897777777777778,0.888888888888889,0.9444,0.9166,0.9277,0.8778,0.8944,0.892222222222222,0.9 20 | EigenWorms,0.934351145038168,0.954198473282443,0.5934,0.5267,0.5934,0.4198,0.4198,0.934351145038168,0.938931297709924 21 | UWaveGestureLibrary,0.830625,0.85,0.8906,0.9093,0.8906,0.85,0.85,0.840625,0.846875 22 | Libras,0.876666666666667,0.877777777777778,0.9277,0.8722,0.8577,0.85,0.8389,0.886666666666667,0.894444444444444 23 | ArticularyWordRecognition,0.960666666666667,0.976666666666667,0.9833,0.9866,0.9866,0.98,0.98,0.958,0.973333333333333 24 | BasicMotions,0.95,0.95,1,1,1,1,1,0.985,1 25 | DuckDuckGeese,0.22,0.24,0.62,0.36,0.5,0.36,0.24,0.2,0.18 26 | Cricket,0.977777777777778,0.972222222222222,1,0.9861,0.9772,0.9306,0.9722,0.980555555555556,0.986111111111111 27 | Handwriting,0.296,0.368235294117647,0.3752,0.3011,0.2372,0.376,0.18,0.344941176470588,0.4 28 | ERing,0.888148148148148,0.896296296296296,0.9629,0.9296,0.9111,0.9037,0.9296,0.841481481481482,0.844444444444444 29 | AtrialFibrillation,0.12,0.066666666666667,0.4,0.2,0.4,0.3333,0.3333,0.146666666666667,0.133333333333333 30 | StandWalkJump,0.546666666666667,0.6,0.3333,0.4,0.3333,0.4,0.4,0.653333333333333,0.666666666666667 31 | CharacterTrajectories,0.994428969359332,0.995125348189415,0.9922,0.9881,0.9945,0.9868,0.9945,0.994428969359331,0.995821727019499 32 | -------------------------------------------------------------------------------- /utils/utils.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import os 3 | from sklearn.preprocessing import LabelEncoder 4 | 5 | 6 | def create_directory(directory_path): 7 | 8 | if not os.path.isdir(directory_path): 9 | os.mkdir(directory_path) 10 | 11 | 12 | def load_data(file_name): 13 | 14 | folder_path = "/home/afawaz/phd/datasets/UCRArchive_2018/" 15 | folder_path += file_name + "/" 16 | 17 | train_path = folder_path + file_name + "_TRAIN.tsv" 18 | test_path = folder_path + file_name + "_TEST.tsv" 19 | 20 | if os.path.exists(test_path) <= 0: 21 | print("File not found") 22 | return None, None, None, None 23 | 24 | train = np.loadtxt(train_path, dtype=np.float64) 25 | test = np.loadtxt(test_path, dtype=np.float64) 26 | 27 | ytrain = train[:, 0] 28 | ytest = test[:, 0] 29 | 30 | xtrain = np.delete(train, 0, axis=1) 31 | xtest = np.delete(test, 0, axis=1) 32 | 33 | return xtrain, ytrain, xtest, ytest 34 | 35 | 36 | def znormalisation(x): 37 | 38 | stds = np.std(x, axis=1, keepdims=True) 39 | if len(stds[stds == 0.0]) > 0: 40 | stds[stds == 0.0] = 1.0 41 | return (x - x.mean(axis=1, keepdims=True)) / stds 42 | return (x - x.mean(axis=1, keepdims=True)) / (x.std(axis=1, keepdims=True)) 43 | 44 | 45 | def encode_labels(y): 46 | 47 | labenc = LabelEncoder() 48 | 49 | return labenc.fit_transform(y) 50 | --------------------------------------------------------------------------------