cair/TsetlinMachine
The code and datasets for the Tsetlin Machine
repo name | cair/TsetlinMachine |
repo link | https://github.com/cair/TsetlinMachine |
homepage | https://arxiv.org/abs/1804.01508 |
language | Python |
size (curr.) | 265 kB |
stars (curr.) | 279 |
created | 2018-04-02 |
license | MIT License |
The Tsetlin Machine
The code and datasets for the Tsetlin Machine. Implements the Tsetlin Machine from https://arxiv.org/abs/1804.01508, including the multiclass version. The Tsetlin Machine solves complex pattern recognition problems with easy-to-interpret propositional formulas, composed by a collective of Tsetlin Automata.
Other Implementations
- Multi-threaded implementation of the Tsetlin Machine, Convolutional Tsetlin Machine, Regression Tsetlin Machine, and Weighted Tsetlin Machine, with support for continuous features and multi-granular clauses, https://github.com/cair/pyTsetlinMachineParallel, https://pypi.org/project/pyTsetlinMachineParallel/
- High-level Tsetlin Machine Python API with fast C-extensions. Implements the Tsetlin Machine, Convolutional Tsetlin Machine, Regression Tsetlin Machine, and Weighted Tsetlin Machine, with support for continuous features, multi-granular clauses, and clause indexing, https://github.com/cair/pyTsetlinMachine, https://pypi.org/project/pyTsetlinMachine/
- Fast C++ implementation of the Weighted Tsetlin Machine with MNIST-, IMDb-, and Connect-4 demos, https://github.com/adrianphoulady/weighted-tsetlin-machine-cpp
- Fast bit-operation based implementation in C with MNIST demo, https://github.com/cair/fast-tsetlin-machine-with-mnist-demo
- CUDA implementation with IMDB text classification demo, https://github.com/cair/fast-tsetlin-machine-in-cuda-with-imdb-demo
- Hardware implementations, https://github.com/JieGH/Hardware_TM_Demo
- Kivy implementation, https://github.com/DarshanaAbeyrathna/Tsetlin-Machine-Based-AI-Enabled-Mobile-App-for-Forecasting-the-Number-of-Corona-Patients
- C implementation, https://github.com/cair/TsetlinMachineC
- C++ Toolkit with Python bindings, https://github.com/WojciechMigda/TsetlinMachineToolkit
- Rust implementation, https://github.com/KhaledSharif/TsetlinMachine
- Rust implementation with fast bit-operations, including MNIST demo, https://github.com/jcriddle4/tsetlin_rust_mnist
- C++ implementation, https://github.com/222464/TsetlinMachine
- Node.js implementation, https://github.com/anon767/TsetlinMachine
- C# implementation, https://github.com/cokobware/TsetlinMachineCSharp
Tutorials
Convolutional Tsetlin Machine tutorial, https://github.com/cair/convolutional-tsetlin-machine-tutorial
Learning Behaviour
The below figure depicts average learning progress (over 50 runs) of the Tsetlin Machine on a binarized, but otherwise unenhanced version of the MNIST dataset (https://en.wikipedia.org/wiki/MNIST_database). See also https://github.com/cair/fast-tsetlin-machine-with-mnist-demo.
As seen in the figure, both test and training accuracy increase almost monotonically across the epochs. Even while accuracy on the training data approaches 99.9%, accuracy on the test data continues to increase as well, hitting 98.2% after 400 epochs. This is quite different from what occurs with backpropagation on a neural network, where accuracy on test data starts to drop at some point due to overfitting, without proper regularization mechanisms.
Noisy XOR Demo
./NoisyXORDemo.py
Accuracy on test data (no noise): 1.0
Accuracy on training data (40% noise): 0.603
Prediction: x1 = 1, x2 = 0, ... -> y = 1
Prediction: x1 = 0, x2 = 1, ... -> y = 1
Prediction: x1 = 0, x2 = 0, ... -> y = 0
Prediction: x1 = 1, x2 = 1, ... -> y = 0
Requirements
- Python 2.7.x https://www.python.org/downloads/
- Numpy http://www.numpy.org/
- Cython http://cython.org/
Other Tsetlin Machine Architectures
- The Convolutional Tsetlin Machine, https://github.com/cair/convolutional-tsetlin-machine
- The Regression Tsetlin Machine, https://github.com/cair/regression-tsetlin-machine
Acknowledgements
I thank my colleagues from the Centre for Artificial Intelligence Research (CAIR), Lei Jiao, Xuan Zhang, Geir Thore Berge, Darshana Abeyrathna, Saeed Rahimi Gorji, Sondre Glimsdal, Rupsa Saha, Bimal Bhattarai, Rohan K. Yadev, Bernt Viggo Matheussen, Morten Goodwin, Christian Omlin, Vladimir Zadorozhny (University of Pittsburgh), Jivitesh Sharma, and Ahmed Abouzeid, for their contributions to the development of the Tsetlin machine family of techniques. I would also like to thank our House of CAIR partners, Alex Yakovlev, Rishad Shafik, Adrian Wheeldon, Jie Lei, Tousif Rahman (Newcastle University), Jonny Edwards (Temporal Computing), Marco Wiering (University of Groningen), Adrian Phoulady, Anders Refsdal Olsen, Halvor Smørvik, and Erik Mathisen for their many contributions.
Tsetlin Machine Papers
@InProceedings{gorji2020indexing,
title="{Increasing the Inference and Learning Speed of Tsetlin Machines with Clause Indexing}",
author={Saeed {Gorji} and Ole Christoffer {Granmo} and Sondre {Glimsdal} and Jonathan {Edwards} and Morten {Goodwin}},
booktitle={Accepted to International Conference on Industrial, Engineering and Other Applications of Applied Intelligent Systems},
year={2020},
organization={Springer}
}
@InProceedings{abeyrathna2020integer,
title="{A Regression Tsetlin Machine with Integer Weighted Clauses for Compact Pattern Representation,}",
author={Abeyrathna, Kuruge Darshana and Granmo, Ole-Christoffer and Goodwin, Morten},
booktitle={Accepted to International Conference on Industrial, Engineering and Other Applications of Applied Intelligent Systems},
year={2020},
organization={Springer}
}
@InProceedings{phoulady2020weighted,
author={Adrian {Phoulady} and Ole-Christoffer {Granmo} and Saeed Rahimi {Gorji} and Hady Ahmady {Phoulady}},
booktitle={Proceedings of the Ninth International Workshop on Statistical Relational AI (StarAI 2020)},
title="{The Weighted Tsetlin Machine: Compressed Representations with Clause Weighting}",
year={2020}
}
@InProceedings{wheeldon2020pervasive,
author={Adrian {Wheeldon} and Rishad {Shafik} and Alex {Yakovlev} and Jonathan {Edwards} and Ibrahim {Haddadi} and Ole-Christoffer {Granmo}},
booktitle={SCONA Workshop at Design, Automation and Test in Europe (DATE 2020)},
title="{Tsetlin Machine: A New Paradigm for Pervasive AI}",
year={2020}
}
@article{abeyrathna2019nonlinear,
author={K. Darshana {Abeyrathna} and Ole-Christoffer {Granmo} and Xuan {Zhang} and Lei {Jiao} and Morten {Goodwin}},
journal={Philosophical Transactions of the Royal Society A},
title="{The Regression Tsetlin Machine - A Novel Approach to Interpretable Non-Linear Regression}",
volume={378}, issue={2164},
year={2019}
}
@InProceedings{gorji2019multigranular,
author = {Saeed Rahimi {Gorji} and Ole-Christoffer {Granmo} and Adrian {Phoulady} and Morten {Goodwin}},
title = "{A Tsetlin Machine with Multigranular Clauses}",
booktitle="Lecture Notes in Computer Science: Proceedings of the Thirty-ninth International Conference on Innovative Techniques and Applications of Artificial Intelligence (SGAI-2019)", year="2019",
volume = {11927},
publisher="Springer International Publishing"
}
@article{berge2019text,
author={Geir Thore {Berge} and Ole-Christoffer {Granmo} and Tor Oddbjørn {Tveit} and Morten {Goodwin} and Lei {Jiao} and Bernt Viggo {Matheussen}},
journal={IEEE Access},
title="{Using the Tsetlin Machine to Learn Human-Interpretable Rules for High-Accuracy Text Categorization with Medical Applications}",
volume={7},
pages={115134-115146},
year={2019},
doi={10.1109/ACCESS.2019.2935416},
ISSN={2169-3536}
}
@article{granmo2019convtsetlin,
author = {{Granmo}, Ole-Christoffer and {Glimsdal}, Sondre and {Jiao}, Lei and {Goodwin}, Morten and {Omlin}, Christian W. and {Berge}, Geir Thore},
title = "{The Convolutional Tsetlin Machine}",
journal = {arXiv preprint arXiv:1905.09688}, year = {2019}
}
@InProceedings{abeyrathna2019regressiontsetlin,
author = {{Abeyrathna}, Kuruge Darshana and {Granmo}, Ole-Christoffer and {Jiao}, Lei and {Goodwin}, Morten},
title = "{The Regression Tsetlin Machine: A Tsetlin Machine for Continuous Output Problems}",
editor="Moura Oliveira, Paulo and Novais, Paulo and Reis, Lu{\'i}s Paulo ",
booktitle="Progress in Artificial Intelligence", year="2019",
publisher="Springer International Publishing",
pages="268--280"
}
@InProceedings{abeyrathna2019continuousinput,
author = {{Abeyrathna}, Kuruge Darshana and {Granmo}, Ole-Christoffer and {Zhang}, Xuan and {Goodwin}, Morten},
title = "{A Scheme for Continuous Input to the Tsetlin Machine with Applications to Forecasting Disease Outbreaks}",
booktitle = "{Advances and Trends in Artificial Intelligence. From Theory to Practice}", year = "2019",
editor = "Wotawa, Franz and Friedrich, Gerhard and Pill, Ingo and Koitz-Hristov, Roxane and Ali, Moonis",
publisher = "Springer International Publishing",
pages = "564--578"
}
@article{granmo2018tsetlin,
author = {{Granmo}, Ole-Christoffer},
title = "{The Tsetlin Machine - A Game Theoretic Bandit Driven Approach to Optimal Pattern Recognition with Propositional Logic}",
journal = {arXiv preprint arXiv:1804.01508}, year = {2018}
}
Licence
Copyright (c) 2020 Ole-Christoffer Granmo
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.