/Plug-and-Play-Collaboration-Between-Specialized-Tsetlin-Machines

Plug-and-play collaboration between specialized Tsetlin machines

Primary LanguagePythonMIT LicenseMIT

TMComposites: Plug-and-Play Collaboration Between Specialized Tsetlin Machines

This project introduces plug-and-play collaboration between Tsetlin machines (TMs), forming a TM Composite.

  • The collaboration relies on a TM's ability to specialize during learning and to assess its competence during inference.
  • When teaming up, the most confident TMs make the decisions, relieving the uncertain ones. In this manner, the TM Composite becomes more competent than its members, benefitting from their specializations.
  • The members can be combined in any way, at any time, without fine-tuning (plug-and-play).
  • The project implements four TM specializations as a demonstration:
    • Histogram of Gradients;
    • Adaptive Thresholding w/10x10 convolution;
    • Color Thermometers w/3x3 convolution;
    • Color Thermometers w/4x4 convolution.

The resulting TM Composite increases accuracy on Fashion-MNIST by two percentage points, CIFAR-10 by twelve points, and CIFAR-100 by nine points, yielding new state-of-the-art results for TMs.

Architecture

The plug-and-play architecture is shown below.

In the normal case, a TM outputs the class with the largest class sum (see Tsetlin machine):

.

When collaborating in a team, however, each TM team member outputs its class sums , with the class sum signifying the confidence of TM in class :

.

In the ensuing normalization step, the class sums of each TM are divided by the difference between the largest and smallest class sums in the data : .

The normalized class sums, in turn, are added together, forming the class sums of the team as a whole. The maximum value of these decides the class output in the final step.

Results

Does the Tsetlin Machine Know When it Does Not Know?

Using Adaptive Thresholding on CIFAR-100 as an example, the above figure relates the accuracy of the TM to its confidence. Along the x-axis, we rank the 10000 test images from CIFAR-100 from lowest to highest class sum (confidence). The y-axis shows the test accuracy for the x-axis confidence level and upwards. When confidence is low, the TM operates at low accuracy. As confidence increases, accuracy increases as well, up to 100% accuracy at the highest confidence levels.

Is the Tsetlin Machine a Generalist or a Specialist?

We next investigate a selection of individual images at the lower and higher ends of the confidence spectrum. The images demonstrate that the Adaptive Thresholding TM has specialized in recognizing larger pixel structures, operating at high confidence and accuracy. For images that are mainly characterized by color texture, on the other hand, it suffers from low confidence and accuracy.

Can Specialist Tsetlin Machines Successfully Collaborate?

Now consider the confidence and accuracy of the Color Thermometers TM in the figure above. Notice how it specializes to get high confidence and accuracy in recognizing color texture. The weakness of the Adaptive Thresholding TM seems to be the strength of the Color Thermometers TM, and vice versa.

We are now ready to deploy our plug-and-play architecture for TM collaboration. The above table shows the accuracy of various team compositions for Fashion-MNIST, CIFAR-10, and CIFAR-100. Observe how adding team members improves accuracy. Indeed, the full team increased accuracy on Fashion-MNIST by two percentage points, CIFAR-10 by twelve points, and CIFAR-100 by nine points, yielding new state-of-the-art results for TMs.

Considering accuracy epoch-by-epoch for CIFAR-10, the team performance is superior already from the first epoch and stays ahead throughout the learning process.

Further Research

The plug-and-play collaboration between TMs opens several research paths ahead:

  • What other specializations (image processing techniques) can we add to the team?
  • Can we design a light optimization layer that boosts the collaboration accuracy, e.g., by weighting the specialists based on their performance?
  • Are there other ways to normalize and integrate the perspective of each TM?
  • Can we find a way to fine-tune the TM specialists to enhance collaboration further?
  • What is the best way to organize a library of composable pre-trained Tsetlin machines?
  • How can we compose the most efficient team with a given size?
  • Does this approach extend to speech?

Paper

TMComposites: Plug-and-Play Collaboration Between Specialized Tsetlin Machines. Ole-Christoffer Granmo, arXiv:2309.04801, 2023.

Licence

Copyright (c) 2023 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.