Elamur Research

Using the Tsetlin Machine to Learn Human-Interpretable Rules for High-Accuracy Text Categorization with Medical Applications

Paper · 2018 · Geir Thore Berge, Ole-Christoffer Granmo, Tor Oddbj\orn Tveit et al.

Summary

A clinical record can mention a drug reaction without establishing that the patient has an allergy. The words alone may look much the same in a confirmed case and in a passage that rules one out. Berge and colleagues study whether a system can learn useful distinctions of this kind from labeled documents while keeping its decisions readable. Their approach to text classification uses the Tsetlin Machine to learn rules that test which terms occur together and which are absent. The rules serve directly in making predictions, giving a reader something concrete to inspect when a document is assigned a category.

The system converts a document into a set of yes-or-no statements about its vocabulary. A rule, called a clause, can require the presence of terms such as rash, reaction, and penicillin, or it can require that a particular term be absent. A matching clause casts a vote for or against the category, depending on the role assigned to it. During training, small learning units called Tsetlin automata decide which conditions each clause should contain. The paper walks through an allergy example in which a clause about reactions to Voltaren acquires an additional condition after matching a record labeled negative. The revised clause requires that the word not be absent.

The evaluations cover a modified 20 Newsgroups collection, IMDb movie reviews, and a private hospital dataset. On the newsgroup task, the Tsetlin Machine obtained a mean F-measure of 99.8, ahead of the compared systems, and shared the highest mean recall of 99.8 with a support vector machine. On IMDb it had the highest mean F-measure in the authors’ comparison, 89.1, and the highest mean precision, 90.1. The linear support vector machine had higher mean recall on that task, 89.1 against 88.2. On the clinical records, Naïve Bayes and logistic regression both had higher mean F-measures than the Tsetlin Machine, whose score was 69.3. The authors report that their GPU implementation ran 5 to 15 times faster than their CPU implementation, depending on the dataset.

The paper shows how readable conditions and competitive classification scores can coexist in the same system. The conditions still inherit the limits of the input. A document-level test for the absence of not cannot identify which statement a negation applies to, and a vote count alone leaves open how easily a person can review the full decision. The experiments establish performance under the reported benchmark settings, while the worked example shows what a reader can learn by following the rules themselves.

Deep dive: Using the Tsetlin Machine to Learn Human-Interpretable Rules for High-Accuracy Text Categorization with Medical Applications

The Tsetlin Machine learns readable rules for classifying newsgroup posts, movie reviews and clinical records using words that are present or absent. · about 39 minutes to read

The problem and its context

A class label is a decision about a document

A document classifier assigns a label to a piece of text. What counts as evidence for that label depends on the task. In a topic benchmark, a cluster of terms can indicate what the writer is discussing. A movie review can mention the same film and actors whether its judgment is favorable or unfavorable. In a clinical record, mentioning a drug and a reaction can be relevant even when the surrounding passage expresses uncertainty or denies an association. The clinical application motivates the paper because these distinctions matter to the meaning of the label and because someone reviewing a decision may need to know which evidence produced it.

The authors describe natural language as having structure at several scales. Words combine into phrases, phrases enter sentences, and sentences contribute to what a longer passage conveys. A method that assigns a document category has to choose how much of this structure to represent. Word presence is easy to record and can be informative across many documents. Its meaning as evidence can shift with surrounding terms, the sentence in which they occur, or the relationship between passages. The paper uses a simple representation as a starting point and asks how much the classifier can accomplish by learning combinations of its features.

Electronic health records make the choice especially visible. The authors describe their clinical material as containing specialized language, abbreviations, acronyms, misspellings, and material drawn from Latin, English, and the writers’ own language. A system that relies on literal vocabulary matches has to cope with these variants. At the same time, a record can contain statements written at different points in a patient’s history. Taken together, these properties make the clinical task a test of more than whether a handful of recognizable drug names occur. The category depends on what the record says about the patient, even though the classifier presented in the paper receives a much narrower representation of that record.

The earlier clinical work cited by the authors had used hand-crafted rules to help identify drug allergies. The difficulty motivating the new method is how to acquire rules from examples when the combinations worth looking for may be numerous and hard to anticipate. A reader can write a condition to look for a drug name and a reaction term. Covering the different drugs, descriptions, and expressions of uncertainty in actual records calls for many such decisions. The Tsetlin Machine assigns those choices to a training procedure and produces rules in a form that a person can read afterwards.

Large vocabularies and combinations of terms

A vocabulary gives a document classifier a list of candidate observations. Even a fairly simple input format can therefore have many dimensions. The authors point out that common words account for a great deal of repetition and that infrequent terms can still provide evidence for a class. They cite work on support vector machines in this connection and describe an extreme consequence of vocabulary variation. Documents covering the same category can have little overlap even among words of intermediate frequency. This makes feature selection a substantive choice. A smaller vocabulary can make the task cheaper, while dropping a term can remove a condition that would have been useful in a particular setting. Joachims’s work on text categorization with support vector machines.

A high-dimensional vocabulary also makes learning rules harder than reading the finished rules might suggest. Once a clause has been learned, a reader can scan its terms and see what it asks for. Finding that clause in the first place means choosing among many possible subsets. Each term can enter as a presence condition or as an absence condition, and the usefulness of including it depends on the other conditions already in the clause. For example, a reaction term is a broad cue on its own. Requiring a drug name alongside it selects a narrower group of documents. Adding a condition involving negation changes the group again. An exhaustive search through proposed clauses is an unattractive way to make these interacting choices.

The authors’ emphasis is on learning these interactions explicitly. A clause can make a pattern conditional on several observations holding together. Its output changes once all the requirements are met. By contrast, the paper’s discussion of additive approaches emphasizes the contribution of individual features. Even when both approaches use the same vocabulary, they expose different things to a reader. A list of terms associated with a category describes which observations contribute to a decision. A conjunction exposes a joint requirement and lets the reader check which part of that requirement prevents the rule from firing.

The resemblance to Boolean information retrieval helps explain the authors’ choice of representation. A person familiar with search can read a condition that asks for several terms together and excludes another term. The Tsetlin Machine uses that kind of expression for a different job. Each learned expression supplies a piece of evidence, and several pieces can contribute to the same decision. The authors also cite work on readable rule sets as evidence that logical expressions can represent complex patterns while keeping the conditions visible. Here the challenge is to learn the expressions from the documents and their labels.

Accuracy and readability in earlier approaches

The paper places the work in a period when neural approaches had improved text categorization. It discusses convolutional and recurrent networks, including networks with long short-term memory, as ways to learn from language data. It points to character-level convolution and very deep convolution as examples of the advances motivating the comparison. The authors associate these gains with more computation and greater difficulty in tracing decisions. Their interest is in retaining direct access to the decision conditions while allowing the system to learn interactions among terms. Character-Level Convolutional Networks for Text Classification and Very Deep Convolutional Networks for Text Classification.

The authors also describe why conventional methods remain relevant. They discuss Naïve Bayes, logistic regression, and support vector machines as familiar choices, alongside approaches such as decision trees and nearest neighbors. Simplicity, efficiency, and useful performance with limited data are among the reasons they give for continued use. Decision trees are particularly important to the paper’s argument about interpretability. A tree already offers a sequence of visible decisions. The contribution of the Tsetlin approach is a different organization of readable rules, with separately learned conjunctions that can support or oppose a class at the same time.

The paper treats readability as especially relevant in medicine, where practitioners are expected to justify decisions. A method that exposes the conditions it actually uses offers a different kind of access from an explanation fitted to its behavior afterwards. The authors discuss work that seeks to make neural decisions more understandable through additional analysis. They see that additional layer as a source of complexity and question whether it can deliver explanations that are both comprehensive and compact. Their own architecture makes the decision rule available directly through the conditions and the vote, leaving the separate question of how much of that rule a person can take in at once.

The computational mechanism comes from earlier work on learning automata. The paper traces the Tsetlin automaton to a solution to the multi-armed bandit problem, in which repeated feedback informs a choice among actions. The Tsetlin Machine adapts that principle to many small decisions about the contents of rules. Each automaton controls a narrow choice. A feedback scheme makes those choices respond to how the clause and the overall category decision behave. The text categorization paper applies this existing learning architecture to documents and uses clinical examples to show what its decisions about individual terms mean in practice.

The method, step by step

Give each term a truth value

The procedure begins by choosing a unit of text to classify. The experiments use documents, while the authors explain that the same representation could be applied to sentences or paragraphs. The unit matters because it defines the scope of a term match. In a document, terms can satisfy a rule even if they appear far apart. In a sentence, the same rule requires them all to occur within that sentence. The paper’s running allergy example is easiest to read as a short phrase, but the features used to make the decision describe the document.

The vocabulary is the inventory of terms that the system recognizes as features. A coordinate is assigned to each term. If the term occurs, its coordinate is true. If the term is absent, the coordinate is false. The word term can refer to a single token or to a sequence kept as one feature. The paper discusses lowercasing, removing uninformative punctuation, and tokenization as ways of preparing the vocabulary. It also discusses the n-gram, a sequence of tokens that can preserve a small portion of word order when treated as a feature.

A document becomes the following input.

X = [x₁, x₂, …, xₖ]

Here X is the ordered vector of features and k is the number of coordinates. The symbols x₁ through xₖ denote the Boolean variables for the corresponding vocabulary terms, with … standing for the intervening coordinates. Each coordinate takes value 1 for term presence or 0 for term absence. The square brackets group the coordinates into a vector. The order of coordinates is the vocabulary’s indexing order. The locations of words in the document are a separate matter and are generally lost in this conversion.

A term occurring repeatedly still has the same presence value as a term occurring once. Similarly, a document can satisfy presence conditions for rash and penicillin even when the words occur in different passages. The value of an individual feature is therefore easy to check, but its interpretation depends on the chosen unit and vocabulary. With a sequence feature, the presence value does preserve the order inside that sequence. The representation still leaves the relationship between that sequence and the rest of the document implicit.

Construct clauses and read their votes

Each variable gives rise to a pair of candidate conditions. The positive literal is true when the term appears. The negated literal is true when it is absent. In this setting, a literal means a Boolean variable in either of those forms. Excluding a literal from a clause means that the clause makes no demand about that condition. Including a negated literal means that absence is part of the demand. For example, leaving out the negated form of not allows a clause to fire whether the word appears or is absent, provided its other conditions hold.

A clause joins its selected literals by conjunction. The paper describes its patterns under the heading of conjunctive normal form. The individual units it evaluates are conjunctions, and its category decision combines their outputs by a signed sum. A conjunction functions as an AND condition. Every selected literal has to be true on the input for the clause to return a true result. In the allergy illustration, a clause that requires rash, reaction, and penicillin fires only when the document contains all the required terms.

Cⱼ(X) = x[q₁] ∧ … ∧ x[qᵣ] ∧ ¬x[qᵣ₊₁] ∧ … ∧ ¬x[qᵤ]

Here Cⱼ is the clause indexed by j, and X is the document vector. Each q with a subscript identifies a vocabulary coordinate. The notation x[q] denotes the bit at that coordinate, and the selected coordinates come from the input’s k positions. The index r marks the end of the unnegated part of the displayed clause and u marks the end of the full list of selected literals. The symbol ∧ means AND, ¬ means logical negation, and … stands for other selected literals in the relevant part of the list. Either kind of literal can be omitted from a particular clause. The output is true if all included conditions are satisfied.

A category has multiple clauses so that different patterns can contribute evidence. A clause may describe a narrow combination that recurs in one group of documents. Another may respond to observations typical of a different group. The authors assign polarity according to the clause index. Odd-indexed clauses support the category, and even-indexed clauses oppose it. Clause polarity determines how a match enters the vote. The signs on literals determine what a match requires. A clause with a negated literal can therefore support a category, and a clause made entirely of unnegated literals can oppose it.

fₛ(X) = Σⱼ odd Cⱼ(X) − Σⱼ even Cⱼ(X)

The score fₛ(X) is the signed total for the input vector. Each Σ adds the truth values returned by the indicated clauses. In the first sum, j ranges over the odd clause indices. In the second, it ranges over the even indices. Both ranges are taken from the clauses assigned to the category. A true clause contributes its value of 1 to its respective sum, and a false clause contributes 0. The minus sign subtracts the total coming from the opposing clauses.

The paper introduces the label decision through the allergy example, where the question is whether the document belongs to a target category. For that decision it gives the following rule.

y = 1 if fₛ(X) > 0, otherwise 0

Here y is the predicted label. The symbol > denotes a strict comparison. If the supporting matches outweigh the opposing matches, the output is 1, meaning that the category is assigned. A tie or a score in favor of the opposing clauses yields 0. The reported experiments use a Multi-Class Tsetlin Machine implementation. The paper’s formulas and worked example explain the signed score for a target category, without spelling out the arbitration among category scores in the multiclass implementation.

This architecture gives a reader a way to inspect the decision at several scales. At the literal level, the question is whether the document contains a term or satisfies its absence. At the clause level, the question is whether all of the conditions are satisfied. At the final decision level, a reader can examine how the matches on each side contribute to the score. Following that chain explains the classifier’s arithmetic, while judging whether the terms really express an allergy remains an interpretation of the underlying text.

How the Tsetlin Machine learns text classification rules

The steps in order.

How the Tsetlin Machine learns text classification rulesStep 1: Build a vocabulary from the corpus1. Build a vocabulary from the corpusStep 2: Encode each labeled document as presence bits2. Encode each labeled document as presence bitsStep 3: Select clause literals from automaton states3. Select clause literals from automaton statesStep 4: Evaluate clauses and count signed votes4. Evaluate clauses and count signed votesStep 5: Compare the prediction with the label5. Compare the prediction with the labelStep 6: Sample feedback and update automaton states6. Sample feedback and update automaton statesStep 7: Apply the learned clauses to new documents7. Apply the learned clauses to new documents

Use automata to choose the contents of each clause

A clause represents the outcome of many include-or-exclude decisions. The paper assigns each candidate literal in each clause its own Tsetlin automaton. The presence test for a term and the absence test for the same term have separate automata, and their counterparts in other clauses have separate states again. This arrangement allows a term to matter to one clause and be irrelevant to another. It also allows different clauses to choose different combinations while seeing the same stream of documents.

Each automaton has a finite set of ordered internal states. One portion of the set corresponds to the action Exclude, and the other corresponds to Include. The position within either portion determines how many steps of unfavorable feedback the state can move through before the action changes. A state at the boundary is easy to move across. A state near an outer end expresses a more persistent choice. In the paper’s illustration, an automaton has 100 states per action. The center is then between states 100 and 101, and crossing it changes which action is taken. Those integers describe the automaton, distinct from the truth values of the literals it controls.

The authors specify the automaton through its states, actions, feedback inputs, transition function, and output function. The following notation keeps the state set and transition function distinct.

A = (S, α, β, δ, G)

Here A denotes a Tsetlin automaton. S is its finite state set. α is the set of actions, Exclude and Include. β is the set of feedback inputs, Inaction, Penalty, and Reward. The function δ gives the next state from the current state and feedback. The function G maps the current state to the action. The parentheses group the components of the automaton’s definition.

S = {f₁, f₂, …, f₂ₙ}

Here the braces enclose the set of states, whose elements are indexed in order. f₁ is the first state and f₂ is the next one. f₂ₙ denotes the state at index 2N, where N is the number of states allocated to each action. The ellipsis covers the intermediate states. In the formulas below, t denotes the index of the automaton’s current state.

G(fₜ) = Exclude for 1 ≤ t ≤ N, and Include for N + 1 ≤ t ≤ 2N

Here G(fₜ) is the action selected in state fₜ. The inequalities use ≤ to include the endpoints in each range. The first range runs from state 1 through state N, and the second begins at N + 1 and runs through 2N. The plus sign forms the index directly above the boundary of the Exclude range.

A penalty moves Exclude toward Include and Include toward Exclude. The same motion reinforces the possibility of switching actions regardless of which half the automaton starts in.

δ(fₜ, Penalty) = fₜ₊₁ for 1 ≤ t ≤ N, and fₜ₋₁ for N + 1 ≤ t ≤ 2N

Here δ gives the next state, and Penalty denotes the unfavorable feedback input. The expression fₜ₊₁ is the state with index immediately above t, while fₜ₋₁ is the state with index immediately below t. On the Exclude side the next index increases. On the Include side it decreases. A penalty at either of the adjoining center states moves the automaton into the other action’s range.

A reward moves the automaton deeper into the range for the action it took. Once it reaches an outer endpoint, additional rewards leave it there.

δ(fₜ, Reward) = fₜ₋₁ for 1 < t ≤ N, and fₜ₊₁ for N + 1 ≤ t < 2N

Here Reward is the favorable feedback input. The symbol < makes the comparison strict at the endpoint indicated in each range. The state index decreases on the Exclude side and increases on the Include side. The rule therefore moves towards 1 when rewarding Exclude and toward 2N when rewarding Include, provided there is still room to move in that direction.

δ(fₜ, b) = fₜ for all remaining state–feedback combinations

The variable b represents the current feedback input from β. The remaining combinations include Inaction at any state and Reward when the state is already at the outer endpoint for its action. In each of these cases δ returns the current state fₜ.

The state of an automaton and the truth value of its literal play different roles. The state carries information from training and determines whether to include a condition. The truth value comes from the current document and determines whether that condition is met. An automaton can strongly favor including the condition that a drug be mentioned even when the current document does not mention the drug. In that case the condition remains in the clause, and the clause fails on that document. Feedback following that failure can move the state, sometimes without immediately changing whether the literal is included.

Train on labeled documents

Training proceeds online in the sense that the system processes a labeled example at a time and updates its states after that example. For each document, the current automaton states determine which literals the clauses contain. The system evaluates the clauses against the document’s bits and derives the category prediction from their votes. It compares the prediction with the label and samples feedback for the automata. The paper describes this as a game because each learning unit controls its own action, while the effect of that action depends on what the other units put in the clause and how the clauses vote together.

The first kind of feedback, Type I, applies to documents labeled as members of the target category. In the paper’s binary account, this covers both true positives and false negatives, so even a correctly classified positive example can lead to changes in the clauses. The authors describe two effects. One favors incorporating additional matching literals, sharpening clauses around features present in the example. An opposing effect helps clauses remain broad enough to fire on other documents in the category. If the sharpening effect acted alone, a clause could end up describing the individual training document in so much detail that it rarely fired elsewhere.

The parameter s regulates the balance between those Type I effects. The authors describe the broadening effect as weaker by a factor of s and use the parameter to control the granularity of the resulting clauses. Granularity concerns how specific a learned condition becomes. A broad clause matches many inputs and may supply evidence across a variety of documents. A specific conjunction can pick out a narrower pattern, which is useful when the extra conditions draw a meaningful distinction. The paper chooses different s settings for its datasets. The distinction between the intended role of s and the settings that happen to work in a particular experiment matters when reading the comparisons.

Type II feedback addresses false positives in the walkthrough. Suppose a document outside the category satisfies a supporting clause. A literal that is currently false on the document would block that match if included. The mechanism can penalize an automaton for excluding such a literal, moving its state towards Include. Some automata will keep the same action because their states are far enough from the boundary. An automaton close to the boundary can change the clause immediately. The document still supplies the same bits after the update. The rule applied to those bits has changed.

The authors distinguish the probability of activating a feedback type from the probabilities of the responses given to individual automata. The latter depend on the automaton’s current action, the output of its clause, and the truth value of its literal in the current document. Thus several automata evaluating the same example can receive different responses. The training account explains the roles of the two feedback types and illustrates selected transitions. Its prose is enough to follow why a particular condition might enter a clause, while a full reconstruction of the implementation would require the detailed feedback entries and the multiclass update conventions.

Limit feedback when the vote already supports the label

The authors also regulate feedback using a training target T. It limits the pressure to keep changing the clauses when the current votes already give sufficiently strong support in the desired direction. This target is distinct from the classification cutoff. Prediction uses the sign rule shown above, while T sets the range over which the feedback activation probabilities vary. A correctly classified document can still influence training when the vote in its favor has yet to reach the target.

pᵢ = (T − max(−T, min(T, fₛ(X)))) / (2T)

Here pᵢ is the activation probability for Type I feedback under the paper’s rule. T is the positive vote target, X is the document vector, and fₛ(X) is its signed clause total. The operator min takes the smaller of its arguments and caps the score at T. The operator max takes the larger of its arguments and imposes the lower bound −T. The resulting bounded score is subtracted from T, and the slash indicates division by 2T, twice the target. A score at the upper bound gives zero probability for this feedback type.

pᵢᵢ = (T + max(−T, min(T, fₛ(X)))) / (2T)

Here pᵢᵢ is the activation probability for Type II feedback under the paper’s rule. The same min and max operations bound fₛ(X) between −T and T. The plus sign adds this bounded score to T before division by 2T. A score at the lower bound gives zero probability for this feedback type. Each formula governs activation in the setting where its feedback applies. It does not by itself change the label of the document or specify the response to an individual literal.

The reason for the target is that clauses are a limited resource. If enough clauses already cover a pattern to give it strong support, repeatedly updating them on examples of that pattern would keep directing learning toward something the system already handles. The authors propose that limiting feedback under those conditions makes it easier to use the available clauses for other patterns. This is a rationale for the design. The experiments report configurations with specific targets, while the paper does not isolate the effect of the target in a separate comparison.

Follow the allergy example through its updates

In the paper’s first illustrated document, the text contains reacts, to, and Voltaren, and the label indicates the target allergy category. The authors focus on selected supporting clauses and the automata responsible for a few terms. The first clause initially requires reacts. Its automaton is well inside the Include range. By contrast, the automaton for the unnegated Voltaren condition is at state 100, on the Exclude side next to the boundary. A change of action is therefore possible after a single step toward the Include side. The term to begins at state 1, where an Exclude choice is much more persistent.

C₁(X) = x₂₉₁₂₃

Here C₁ denotes the first illustrated clause, X the document vector, and x₂₉₁₂₃ the coordinate associated with reacts. In this form the clause returns the truth value of that coordinate. The numeric subscript identifies the vocabulary feature.

After Type I feedback on the example, Voltaren enters the clause. The requirement for reacts remains, so the resulting rule is more specific. An input with reacts alone could previously satisfy this clause. After the update the document must contain the particular drug term as well.

C₁(X) = x₂₉₁₂₃ ∧ x₃₇₃₇₂

Here x₃₇₃₇₂ is the feature for Voltaren, and x₂₉₁₂₃ still stands for reacts. The operator ∧ requires both features to be true. The paper presents this update as a refinement that can make the clause more precise. The example demonstrates the narrowing of the match condition. Its effect on measured precision depends on which future documents the narrowed condition accepts and excludes.

A later positive document contains the reaction term but lacks Voltaren. It therefore fails the refined clause. The authors show another supporting clause, labeled C₂ in the walkthrough, which still requires only reacts. The diagram uses these labels to track the illustrated clauses, which the walkthrough describes as supporting clauses. The broader clause fires and receives feedback. An automaton moves from state 100 to 101, adding the term for Apocillin. The two illustrated patterns can now represent reactions involving different drugs.

C₂(X) = x₂₉₁₂₃ ∧ x₁₀₅₇

Here C₂ is the other supporting clause in the walkthrough, x₂₉₁₂₃ again represents reacts, and x₁₀₅₇ represents Apocillin. The conjunction requires both. The new clause can cover the illustrated positive document even though the Voltaren-specific clause fails there. This is how the clause collection can cover several kinds of positive examples without requiring all of their identifying terms in a single rule.

The example then introduces a negative document that contains both reacts and Voltaren. The first refined clause fires on those bits and contributes to a false positive. Type II feedback penalizes Exclude actions for conditions whose inclusion would have made that clause fail. The condition that crosses into Include is the negated literal for not. In the misleading document the word appears, so the negated literal evaluates to false. Requiring that literal blocks the match on the example.

C₁(X) = x₂₉₁₂₃ ∧ x₃₇₃₇₂ ∧ ¬x₂₅₇₈₉

Here x₂₅₇₈₉ records the presence of not in the document. Its negation ¬x₂₅₇₈₉ is true when that word is absent. The other coordinates have the same meanings as before. The resulting clause fires when the reaction term and the drug term are present and the word not is absent. The authors show that this change removes the illustrated false positive.

The example compresses the training sequence to make the state changes visible. Many automata can receive feedback from a document, and many states can move without changing the rule a reader would write down. The displayed clauses capture a few moments when a movement changes the selected literals. The authors explain that training normally continues for several epochs, with an epoch representing a pass through the training data. The final collection of clauses reflects the accumulation of those updates over documents, including examples whose evidence reinforces some conditions and weakens others.

Experiments and results

The comparison and its measures

The authors evaluate the classifier on a modified public newsgroup corpus, the public IMDb review dataset, and a private clinical dataset drawn from hospital records. The public tasks let them compare with prior text categorization work. The clinical task tests the setting that motivated their emphasis on readability. The paper reports accuracy, precision, recall, and F-measure under a macro-averaged evaluation description. Macro-averaging gives each class equal influence when combining class scores, so a common class has less opportunity to dominate the aggregate than it would in an average over individual predictions. The IMDb benchmark and its published split come from Learning Word Vectors for Sentiment Analysis.

Precision asks how frequently predictions of a category are correct. Recall asks how frequently examples belonging to that category are retrieved. A method that makes relatively few positive predictions can have good precision and miss many actual members of the category. A method that casts a wide net can recover more members while admitting more false positives. F-measure combines precision and recall and gives readers a way to compare their balance. The reported accuracy is a separate measure. This distinction matters here because method rankings change with the measure, and the comparison tables chiefly report precision, recall, and F-measure.

The authors implement the Tsetlin classifier using a Python version with compiled C/C++ extensions and a CUDA-capable C++ version. They identify the released CUDA and C source code by the name TextUnderstandingTsetlinMachine. The IMDb comparisons draw on Scikit-learn, Keras, and Tensorflow. The newsgroup and clinical experiments use Weka v3.9 for the conventional classifiers, with StarSpace included separately for the clinical comparison. Among the baselines are decision trees, logistic regression, nearest neighbors, and support vector machines. The IMDb comparison also includes several recurrent neural architectures and combinations of recurrent and convolutional layers.

The setup describes preprocessing in both the Weka and Python environments to reproduce the intended feature configuration. For Weka it names the String-ToWordVector filter, cleaning and tokenization into unigrams and quadrigrams, and the use of InfoGainAttributeEval to identify informative attributes. A unigram treats a single token as a feature, and a quadrigram preserves a sequence of four tokens as a feature. A reported vocabulary size thus counts input attributes, which can include sequences as well as individual words. The paper does not assign every preprocessing choice to every dataset in the same detail as it lists the classifier settings.

For IMDb the authors use the published 50%-50% training and test split. The paper also describes repeated cross-validation for the newsgroup and clinical experiments, saying it used 10-fold cross-validation repeated 10 times. In the same setup, it specifies 80%-20% for the newsgroups and 90%-10% for the clinical data. These statements give the intended division as reported. The exact relationship between the 10-fold description and the newsgroup holdout proportion remains unclear. The figures below use the means in the paper’s comparison tables.

Modified 20 Newsgroups

The newsgroup experiment uses 16,000 documents derived from the “19,997” version of 20 Newsgroups. The authors group the original subcategories into 4 broad classes covering computers, recreation, science, and politics. The grouping defines the prediction task. A system can receive credit for identifying the broad topic without distinguishing among the original subcategories inside it. Results from this experiment therefore describe the modified collection and its labels.

The main run uses 8006 selected features and 1600 clauses. The automata use a setting of 100 states, the granularity parameter s is 8.0, and the feedback target T is 25. Training runs for 100 epochs per fold. The paper takes the reported result from the final epoch, a choice it also makes for the main IMDb comparison. These settings describe the configuration underlying the headline comparison. The authors separately report runs using all available features and a larger number of clauses.

Mean macro-averaged F-measure on modified 20 Newsgroups

The Tsetlin Machine has the highest reported mean, with the support vector machine close behind.

Mean macro-averaged F-measure on modified 20 NewsgroupskNN: 80.9kNN80.9Naïve Bayes: 91.6Naïve Bayes91.6Random forest: 94.9Random forest94.9MLP: 97.1MLP97.1Decision tree: 99.2Decision tree99.2Logistic regression: 99.4Logistic regression99.4SVM: 99.7SVM99.7Tsetlin Machine (this paper): 99.8Tsetlin Machine (this paper)99.8
The numbers
System or settingF-measure %
kNN80.9
Naïve Bayes91.6
Random forest94.9
MLP97.1
Decision tree99.2
Logistic regression99.4
SVM99.7
Tsetlin Machine (this paper)99.8

The Tsetlin Machine’s newsgroup precision, recall, and F-measure are each reported as 99.8±0.2. The support vector machine has recall of 99.8±0.2 as well, with precision and F-measure both at 99.7±0.2. Logistic regression also scores close to the leaders, with an F-measure of 99.4±0.2. The decision tree reaches 99.6±0.2 precision and 98.9±0.4 recall. The paper’s strongest newsgroup result is thus a narrow lead over several methods that already classify the broad topics very well, alongside a tie with the support vector machine on mean recall.

The results also show why the balance of the two component measures deserves attention. Naïve Bayes has mean recall of 98±0.6 and mean precision of 86.1±1.5 on the modified collection. The nearest-neighbor baseline has recall of 96.4±1.0 and precision of 69.8±2.3. A high recall alone would make both look much closer to the leading systems. Their F-measures reflect the lower precision and give a fuller picture of the comparative results. The Tsetlin Machine’s reported precision and recall are both high in this setting.

The paper also mentions earlier convolutional experiments on a collection it describes as roughly the same, with accuracy scores in the range 94.8-95.5%. That is a comparison to published figures on a closely related setup. The authors’ direct newsgroup comparison is the shared table of classification measures, which gives a firmer basis for identifying the leading mean within this study. The published convolutional range and the newsgroup F-measure shown above measure different quantities.

IMDb movie reviews

The IMDb experiment concerns sentiment expressed in movie reviews. Its training and test sets come from the published 50%-50% split. The authors configure the Tsetlin Machine with 5,000 selected features, 10,000 clauses, and a setting of 500 states. They choose an s of 27.0 and a feedback target T of 20, and train for 200 epochs. The results table uses final-epoch performance and reports mean scores from 100 independent runs with 95% confidence intervals. This makes the headline measurements summaries of repeated runs on the stated benchmark setup.

Mean macro-averaged F-measure on the IMDb test split

The Tsetlin Machine leads the direct comparison, with linear SVM and the convolutional LSTM among its closest competitors.

Mean macro-averaged F-measure on the IMDb test splitDecision tree: 69.7Decision tree69.7MLP: 83.0MLP83.0LSTM: 85.6LSTM85.6Multinomial Naïve Bayes: 86.0Multinomial Naïve Bayes86.0Logistic regression: 87.1Logistic regression87.1Bi-LSTM CNN: 87.9Bi-LSTM CNN87.9LSTM CNN: 88.1LSTM CNN88.1Linear SVM: 88.5Linear SVM88.5Tsetlin Machine (this paper): 89.1Tsetlin Machine (this paper)89.1
The numbers
System or settingF-measure %
Decision tree69.7
MLP83.0
LSTM85.6
Multinomial Naïve Bayes86.0
Logistic regression87.1
Bi-LSTM CNN87.9
LSTM CNN88.1
Linear SVM88.5
Tsetlin Machine (this paper)89.1

The Tsetlin Machine has mean IMDb precision of 90.1±1.0, recall of 88.2±1.5, and F-measure of 89.1±0.4. It leads the authors’ comparison on mean precision and F-measure. Linear SVM leads on mean recall with 89.1±0.0, compared with its own mean precision of 88.0±0.0. The LSTM CNN reaches precision of 89.5±1.1 and recall of 86.8±1.9. These rankings show why the paper’s general claim of strong results needs to be read metric by metric. The Tsetlin Machine’s lead in mean F-measure coexists with the SVM’s higher recall.

Among the recurrent baselines, the LSTM CNN has F-measure of 88.1±0.5, while the bidirectional LSTM with convolution has 87.9±0.9. The plain LSTM has F-measure of 85.6±3.0, and the bidirectional LSTM has 85.5±2.8. These are comparisons among implemented systems as a whole. Each includes its own training choices, and the reported results summarize how those choices performed in the authors’ setup. The recurrent comparisons also illustrate the authors’ reason for reporting repeated-run estimates rather than relying on a particularly favorable outcome from a single run.

The paper reports Tsetlin macro-averaged accuracy of 89.2± 0.2 on IMDb. It separately identifies 89.7% as the highest accuracy it observed over epochs and folds. The surrounding setup specifies the published train and test split, so the word “folds” leaves that part of the peak-search description unclear. The distinction between the mean and the peak is explicit. A peak answers how high a run or checkpoint reached among the possibilities considered. The final-epoch mean is the figure that corresponds to the main repeated-run evaluation.

Published IMDb results also place that direct comparison in context. The paper cites 91.22% accuracy for NBSVM-bi, which uses a support vector machine with Naïve Bayes features. It cites 94.09% for adversarial training and 95.68% for a mixed objective with word embeddings. These results come from the respective published approaches. They establish that the benchmark had reported accuracy scores above the result achieved by the paper’s basic representation, while the authors’ controlled table answers how their implementation compares with the baselines they ran. Baselines and Bigrams and Adversarial Training Methods for Semi-Supervised Text Classification.

Clinical records

The clinical experiment uses authentic health records from a hospital and centers on allergy classification. The data are private. For the final results the Tsetlin Machine uses 38,876 features, 500 clauses, a setting of 100 states, an s of 3.0, and a feedback target of 25. Training runs for 100 epochs per fold, and the setup specifies a 90%-10% split. The dataset brings the evaluation back to the question of whether the learned rules can support useful classification in the presence of the writing variation and ambiguous mentions discussed in the introduction.

Mean macro-averaged F-measure on the clinical dataset

Naïve Bayes leads, with logistic regression and the Tsetlin Machine close behind.

Mean macro-averaged F-measure on the clinical datasetkNN: 47.1kNN47.1Decision tree: 57.9Decision tree57.9Random forest: 58.9Random forest58.9StarSpace: 59.3StarSpace59.3SVM: 63.7SVM63.7MLP: 67.2MLP67.2Tsetlin Machine (this paper): 69.3Tsetlin Machine (this paper)69.3Logistic regression: 69.6Logistic regression69.6Naïve Bayes: 69.9Naïve Bayes69.9
The numbers
System or settingF-measure %
kNN47.1
Decision tree57.9
Random forest58.9
StarSpace59.3
SVM63.7
MLP67.2
Tsetlin Machine (this paper)69.3
Logistic regression69.6
Naïve Bayes69.9

The clinical Tsetlin result is precision of 70.3±10.8, recall of 70.2±11.6, and F-measure of 69.3±8.1. Naïve Bayes has the strongest mean F-measure, 69.9±6.6, and the highest mean recall, 76.2±9.1. Logistic regression has the highest mean precision, 73.4±9.1, and its F-measure is 69.6±7.2. The multilayer perceptron shares the Tsetlin Machine’s mean precision of 70.3, with a reported ±17.6, and has a lower mean F-measure of 67.2±10.9.

The table shows a different pattern from the public experiments. The Tsetlin Machine is competitive with the leading methods on mean F-measure, while the lead belongs to simpler baselines. The authors suggest that the structure of Naïve Bayes and logistic regression may have helped them avoid fitting the training examples too closely. They also suggest that the Tsetlin Machine may have some of the advantages seen with limited data. These are explanations offered for the observed ranking. The experiment compares classifiers on the available data and does not vary the amount of training data to test those explanations.

The authors draw attention to the large variability in the clinical results. Their general evaluation description refers to 95% confidence intervals, whereas the clinical discussion describes the large accompanying values as standard deviations. The scores above preserve the table’s notation. The clinical ranking is clearest when stated as a ranking of reported means. The paper gives too little detail about the uncertainty calculation and comparative testing to establish a reliable advantage for the small gaps among the leading means.

What the runtime comparison measures

The authors also run a GPU implementation of the Tsetlin Machine for the experiments. According to their report, it runs 5 to 15 times as fast as the CPU implementation, depending on the dataset. The comparison concerns the authors’ implementations of the same method. It fits the design motivation because each automaton manages a small state and much of the literal-level work can be distributed. The paper’s reported speedup is an aggregate range, so the benchmarks do not provide a breakdown here of how much was gained on the clinical task, the newsgroups, or IMDb individually.

The experimental description gives a server environment, names the compiled CPU and GPU-capable implementations, and says that total clinical runtime is reported in hours. The clinical results table gives the classification scores without individual runtime values. The speedup range is therefore the quantitative timing result that can be compared directly from the account. It addresses the practical cost of implementing the Tsetlin procedure on different hardware, while the classification tables address the quality of the predictions.

What the ablations show

Removing feature selection while expanding the clause collection

The paper’s clearest configuration comparison uses the modified 20 Newsgroups task. The main experiment selects 8006 features. To see how the method behaves without that screening, the authors retain all 25,840 available features. They try configurations with 5168 and 10,336 clauses and say that the remaining settings are kept the same. Both configurations achieve reported average accuracy of 99.8%. This is evidence that the classifier can work with the larger vocabulary on this task when given the expanded clause collections used in the comparison.

The practical question is whether feature selection is essential to making this particular task tractable for the classifier. The result shows that the authors could omit it under the reported settings and still obtain high average accuracy. That is a meaningful contrast because feature selection ordinarily determines which terms and sequences the clauses can test. Keeping the full input gives the automata more candidate conditions and leaves the learning procedure to handle many features that would otherwise have been discarded.

The comparison changes clause count alongside vocabulary size. Each additional clause supplies another set of decisions over the candidate literals, so expanding the collection changes the system’s capacity as well as its likely computational demands. The two runs demonstrate a viable combination of unfiltered features and more clauses. They leave open how the unfiltered vocabulary would perform at the original clause count, how much the larger clause count contributes, and how the alternatives compare in cost. The numbers support the authors’ suggestion that feature selection can sometimes be dispensed with. The demonstrated setting is the broad-topic newsgroup benchmark.

There is also a metric distinction. The configuration comparison gives average accuracy, while the main comparison table gives precision, recall, and F-measure. The 99.8% average accuracy in the full-vocabulary runs and the 99.8 mean F-measure from the selected-feature table are different measurements. The paper describes the full-vocabulary accuracy as maintained. The reported full-vocabulary result does not show whether every component measure from the selected-feature table is preserved.

Extending training on the clinical data

The authors extend training on the clinical task to 2000 epochs. They report peak accuracy of 79.1% at epoch 294. In later epochs the accuracy settles around 70%. They interpret the higher checkpoint cautiously, suggesting that it could reflect temporary overfitting on the test set. The main clinical table uses the shorter training schedule and reports its precision, recall, and F-measure separately from this peak-accuracy observation.

This comparison shows how the apparent conclusion can depend on what is reported from a run. If the outcome of interest is the best observed checkpoint, the peak makes the extended run look attractive. If the outcome of interest is performance that persists as training continues, the later trajectory gives a different impression. The paper does not establish a checkpoint selection rule that could identify such a peak using data independent of the final evaluation. The extended run is therefore an analysis of training behavior and the difficulty of interpreting a maximum seen during testing.

The clinical analysis also points to a distinction between overfitting to training documents and choosing a favorable result after inspecting test performance. The authors discuss constraints that are intended to keep individual clauses from becoming too specific. Even with those mechanisms in place, picking the strongest checkpoint based on its reported test accuracy can favor a result that does not recur. The paper’s caution about the extended run illustrates that the procedure used to summarize training matters alongside the construction of the classifier.

What the rule walkthrough explains

The allergy walkthrough isolates changes in the contents of particular clauses. When Voltaren is added alongside reacts, a document lacking the drug term fails a clause it could previously have matched. When the condition concerning not enters the clause, the illustrated negative document stops satisfying it. The authors can point to the exact feature, its truth value on the document, and the automaton action that changed. This is direct evidence of how the method implements a particular change in the rule.

The walkthrough is qualitative. It follows selected documents and clauses, including a case chosen to make Type II feedback intelligible. It does not measure how many false positives absence conditions eliminate across the datasets or how often they suppress a valid prediction. The paper gives no dataset-wide comparison with negated literals removed, no comparison in which clause polarity alone is changed, and no sweep isolating the contribution of s or the vote target. The parts of the method have understandable roles, while the reported benchmark scores measure their combined effect.

The hardware comparison is controlled in a different sense. Moving the implementation from CPU to GPU changes the execution setting and produces the reported speedup. That comparison speaks to computational feasibility. It supplies no evidence about which logical components improve precision or recall. Likewise, the cross-system score tables establish the relative performance of complete implementations under the experiment’s settings. Differences among those systems cannot identify why a single Tsetlin component works. The feature-selection comparison, training extension, and clause walkthrough answer narrower questions that the broad tables leave open.

Limitations

Limits the authors identify

The authors explicitly describe the document representation as coarse. It preserves whether a vocabulary feature occurs while discarding general term order. Sequences used as features can retain a small amount of local structure. The paper’s main proposal still describes documents in terms of the presence and absence of those features. The authors propose exploring smaller text units and local context windows as ways to represent sentences and paragraphs more precisely. They also raise pretrained and unsupervised word embeddings as directions for capturing relationships that exact feature matches leave out.

The clinical motivation itself identifies a related limitation. Records can contain statements from different times as well as uncertainty and speculation. A combination of terms can be relevant in several of those contexts. The authors show how an absence condition handles a particular misleading match, but their account of electronic health records explains why similar-looking mentions can still be difficult to distinguish. The method as evaluated does not assign temporal relationships to the mentions or resolve the scope of an assertion. The paper proposes more context-sensitive representation as future work in response to this gap.

The authors also qualify their comparisons through their discussion of tuning. They report using a manual grid search for the Tsetlin Machine and automated tuning for some baseline configurations. They describe trying to give the approaches comparable attention and acknowledge that stronger configurations may exist. The chosen parameters therefore define a set of empirical comparisons among the methods the authors ran. The ranking does not establish what would happen under other search spaces, preprocessing decisions, or budgets. The cited IMDb results show how differences in training approach and representation can matter.

Another explicit caution concerns the clinical peak. The authors raise the possibility that the result observed during extended training reflects temporary overfitting associated with the test set. Their distinction between average results and favorable individual outcomes also appears in the IMDb discussion, where they emphasize reporting the mean. These observations limit claims about the best seen accuracies. A quoted peak carries information about what occurred during the experiment, while the paper’s evaluation of representative performance rests on the reported averages and their conditions.

Limits visible in the setup

The clinical rule about not exposes the difference between an inspectable pattern and a linguistic account of a sentence. A document could contain that word in a passage unrelated to the drug. With the illustrated rule, the document would fail the clause because the word is present anywhere within the represented unit. Conversely, the absence of the word does not establish that the record confirms the allergy. A reader can ascertain precisely what triggered the rule and still need to read the passage to determine whether the condition was appropriate. That is a consequence of the representation, independent of how well the automata learned their choices.

Readability is demonstrated through selected clauses and a traceable decision structure. The paper does not report a study of how clinicians or other readers understand the learned rules in practice. It also does not give a distribution of clause lengths or a count of how many clauses usually contribute to a decision. The configured clause collections can be large. Several concise clauses may be straightforward to audit individually, while a decision involving many matching clauses can require substantial review. Structural access to the rule is established by the architecture. Usability at the scale of a full clinical decision remains open.

The evaluation contains no clinical deployment study, no test on data from another hospital, and no measurement of how the system affects decisions made by practitioners. The private dataset makes the published clinical comparison relevant to the authors’ application while limiting independent inspection of the underlying records and errors. The account gives feature counts and training settings in more detail than it gives the composition of the clinical sample. Accordingly, the reader can assess the comparative mean scores for the reported task, with much less basis for judging which types of clinical notes or patients are represented and how the method might generalize across them.

The newsgroup result has a different boundary. Grouping the corpus into 4 broad topics creates a task in which several methods achieve very high reported scores. A strong result there shows that the Tsetlin Machine can solve the experiment’s modified task. The paper does not establish equivalent performance on the original category distinctions or on documents whose topics are harder to separate. Its comparison with earlier convolutional work is described as using an approximately identical dataset. A precise ranking across those studies would require closer alignment of the task and the measures.

The reporting leaves some procedural details uncertain across the experiments. On the newsgroups the relationship between the stated 10-fold scheme and the 80%-20% division is unresolved. For IMDb the fixed split is clear, while the description of the peak refers to both epochs and folds. The paper names information-gain feature selection and tuning methods, but its account does not fully specify how every selection and tuning step was nested within each split. That limits reconstruction of the experiment and makes the comparisons most defensible when stated using the authors’ reported protocols and results.

Uncertainty around means also qualifies the rankings. Several newsgroup methods have close reported scores, and the clinical means are accompanied by substantial variation. The inconsistent description of the clinical ± values makes a fine-grained statistical reading harder. The paper’s tables establish the point estimates and their order. Where those means are close, the text supports a claim of competitive performance more readily than a claim of a reliably superior classifier. This matters especially for the clinical motivation because the Tsetlin Machine’s readability and the conventional baselines’ mean scores are different dimensions of the comparison.

The CPU and GPU timing result has a similarly specific scope. It demonstrates that the authors accelerated their own Tsetlin implementation, and the reported range varies with the dataset. The paper does not provide a per-dataset timing breakdown or comparable timing measurements for the other classifiers in the results tables. The range consequently describes an implementation advantage within the experiment. It leaves open the relative cost of the method against the baselines and how well the same speedup would carry over to other hardware or configurations.

What came after

Subsequent studies building on this paper are undocumented here. The authors’ conclusion instead records several strands they intended to pursue, all as proposed work. One was to investigate how the Tsetlin Machine could learn word embeddings without labeled examples. The proposal addresses a limitation of using literal vocabulary coordinates. Related expressions can occupy separate coordinates even when they play much the same role in a document, and the paper’s rules only see how those coordinates are set. The authors also suggest pretrained embeddings as a possible way to enhance IMDb classification. The paper contains no experiment implementing either direction.

A second strand was to use local context windows to learn structure within sentences and paragraphs. This would change the unit in which conditions are observed and could make a rule more sensitive to the nearby words that modify a mention. The paper’s contrast between document-wide term presence and more local patterns explains the motivation. A clinical clause can currently fire when its required terms occur in unrelated parts of the record. Context windows would give the learning procedure a more precise place to look for combinations. The authors present that as a route towards richer representations, leaving the effect on measured performance open.

The authors also propose taking advantage of document sparsity to speed training. A document typically activates a subset of its vocabulary features, while the basic clause-learning procedure considers decisions over a much broader collection of candidate literals. The newsgroup configuration comparison shows why this is of interest. Retaining the full vocabulary can work in the tested setting, yet it expands the set of features and the authors also expand the clause collection. Their conclusion identifies sparsity as a possible way to reduce the work involved. The GPU result measures an implementation speedup and gives no measurement of the proposed sparsity-based change.

Finally, the authors envision combining structured medical data with the narrative in clinical decision support. That prospect follows from how the present method handles evidence. Its clauses require particular input conditions and expose those conditions to inspection. The clinical experiment tests narrative classification, and the walkthrough traces selected narrative features. Combining those features with structured medical observations, determining how a practitioner would review the resulting votes, and evaluating the system in clinical use remain projects the authors propose beyond the experiments reported in the paper.

Cite

Cite as Geir Thore Berge, Ole-Christoffer Granmo, Tor Oddbj\orn Tveit, Morten Goodwin, Lei Jiao and Bernt Viggo Matheussen. 2018. Using the Tsetlin Machine to Learn Human-Interpretable Rules for High-Accuracy Text Categorization with Medical Applications. arXiv:1809.04547.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.48550/arxiv.1809.04547 · arXiv 1809.04547

@misc{berge2018using,
  title = {{Using the Tsetlin Machine to Learn Human-Interpretable Rules for High-Accuracy Text Categorization with Medical Applications}},
  author = {Geir Thore Berge, Ole-Christoffer Granmo, Tor Oddbjorn Tveit, Morten Goodwin, Lei Jiao and Bernt Viggo Matheussen},
  year = {2018},
  doi = {10.48550/arxiv.1809.04547},
  eprint = {1809.04547},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.1809.04547}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/berge-2018-using-tsetlin-machine-learn-human/