Elamur Research

Optimizing a Supervised Classifier for a Difficult Language Identification Problem

Paper · 2021 · Yves Bestgen

Summary

A short YouTube comment can mix English with another language, use Roman letters for both, and offer only a few words from which to identify either. Yves Bestgen studies this problem in the Dravidian Language Identification shared task at VarDial 2021. The challenge assigns each comment to Kannada, Malayalam, Tamil, or Other-language. The named languages are closely related, the Other-language label covers a mixture whose composition was unclear to participants, and Tamil accounts for most of the examples. A system must make a comment-level decision even when its evidence is sparse and shared across categories.

Bestgen represents each comment as a collection of character sequences, or n-grams, with lengths from 1 to 5. The representation retains punctuation and spaces, distinguishes sequences at the ends of comments, and discards sequences seen fewer than twice. BM25 weights the remaining features using their frequencies and the length of the comment. L2 normalization puts the resulting feature vectors on a common scale. A logistic regression classifier then learns which patterns favor each label. To give errors on less common labels more influence during training, Bestgen adjusts the regularization setting separately for each category. The choices were tuned on the learning material using stratified cross-validation and Macro-F1, which gives every category equal weight.

The submission, named LAST, ranked first among the entrants on the test set, with 0.928 weighted-average F1 and 0.810 Macro-F1. The category scores explain why these aggregate results tell different stories. Tamil and Malayalam reached F1 scores of 0.960 and 0.943, respectively. Kannada reached 0.745, and Other-language reached 0.591. Under the official weighted average, the frequent categories have the greatest influence. Under Macro-F1, the weaker results for Kannada and Other-language count just as much as the stronger results for Tamil and Malayalam.

After the organizers released the test labels, Bestgen varied individual settings and compared the submission with a less thoroughly tuned version of the same approach. The choice of character sequence lengths, the weighting of features, normalization, and the class-specific training settings all mattered more to Macro-F1 than to weighted-average F1 in the reported comparisons. The study shows how much the training and representation choices can affect a straightforward character-based classifier, and how the evaluation metric determines whether those gains are easy to see.

Deep dive: Optimizing a Supervised Classifier for a Difficult Language Identification Problem

Yves Bestgen tests how feature weighting and class-specific training affect language identification in short, code-mixed YouTube comments. · about 30 minutes to read

The problem and its context

When a language label is hard to assign

Language identification asks what language a piece of text is written in. Its output can inform what happens next. A translation system needs to decide how to interpret its input, a spell checker needs to know which writing conventions apply, and a search system can use language information when handling documents and queries. Bestgen treats language identification as a decision that can affect these downstream tasks. Machine translation and information retrieval are among the paper’s examples.

The paper describes a history in which language identification looked close to solved under favorable conditions. These conditions included comparatively long documents, a manageable set of candidate languages, and a single language within each document. A long text lets evidence accumulate. Individual words or sequences may be ambiguous, but the rest of the document offers further chances to distinguish the candidates. Shorter texts take away much of that redundancy. Mixed-language text also changes what it means to have evidence for a language, because the same comment can provide evidence for several at once. Bestgen attributes the earlier assessment of the field to the survey by Jauhiainen and colleagues.

The VarDial evaluation campaigns exposed more demanding cases. The Dravidian task combines several complications in a single decision. The named categories are closely related, with some words shared among them. Their comments appear in Roman script, which can reduce visible differences that a classifier could otherwise exploit. The task material also has considerable variation in how much linguistic evidence a comment contains. An extended comment may have several clauses, while a brief reaction may be little more than a name, a short expression, or a title written as separated letters. Merely knowing that the list of candidate labels is short tells a reader little about how much evidence is available to select one of them.

Writing in Roman script can have effects in both directions. Bestgen points out that it can make distinct languages look more alike while also making authors’ writing more uniform in some respects. For this task, a classifier has to learn the distinctions that survive in the actual spelling of the comments. The script alone gives it little help, since the choice of script is shared across the categories. The question becomes whether recurring sequences within that script, and the places where those sequences appear, distinguish the labels well enough.

Mixed language within a comment

The task’s comments commonly contain material from English and from another language. Bestgen describes switches both between sentences and within them. An English expression can occur in a clause framed by a Dravidian language, or Dravidian vocabulary can appear within an English grammatical frame. The paper gives a Tamil example about the timing of a release and an announcement. English words for times and events appear alongside Tamil material within the same comment. The example makes it hard to treat the presence of an English word as a decision about the language of the whole text.

Code-switching also separates the challenge from an exercise in assigning a language to each span of a message. The reference decision is a label for the entire comment. If a classifier uses English fragments, a transliterated ending, or a pattern spanning both, it can still earn credit for the same comment-level prediction. The task provides no separate score for identifying the point where a switch occurred. Bestgen situates this feature of the material through earlier studies of code-mixed Tamil-English text and code-mixed Malayalam-English text.

The source of the comments adds another kind of overlap. YouTube viewers in different categories can be doing much the same thing when they write. They can report how many views or likes a video has, point to a timestamp, or react to a brief moment. Numbers, shared expressions, and the conventional layout of such comments can therefore occupy much of the available text. In the paper’s examples, a remark about the response to a video and a remark about a particular scene are both labeled Tamil. Their form and subject give readers a sense of how easily the most visible parts of a comment can resemble material from other categories.

The Other-language category poses a further problem. Kannada, Malayalam, and Tamil each name a language. Other-language is a single output label apparently covering several languages in unknown proportions. A training example assigned to that category can consequently have a different linguistic makeup from another example with the same label. A classifier still has to learn one decision for the category. How well that decision will travel from the learning material to the test set depends partly on how those sets were assembled, a question the label alone leaves open.

A simple representation under closed rules

In a supervised approach to text classification, the learning material supplies the answers for examples the classifier sees during training. The classifier learns associations between properties of the text and those answers, then applies the learned associations to new comments. The class distribution matters because frequent labels supply many more examples of what counts as evidence for them. In the challenge material, Tamil and Malayalam have much more training evidence than Kannada and Other-language. Choosing how to use those examples is part of the method, and choosing how much influence each class has is also part of the evaluation.

Bestgen entered the Closed submission type. Participants in that track could use only the materials from the organizers. The author regards the restriction as a practical obstacle to detecting English words automatically and to bringing syntactic analysis into the system. The character-based representation offered a way to use the supplied comments directly. It could preserve fragments of words and phrases, including local patterns where languages might meet, without requiring a separate resource to analyze them.

There was a precedent for this choice in Bestgen’s earlier shared-task entry. In the VarDial 2017 evaluation campaign, the author had used a supervised classifier based mainly on character sequences and had obtained encouraging results. The Dravidian study asks whether a simpler version of that general approach can be competitive in a more demanding setting when its settings receive closer attention. The main design decisions concern what counts as a feature, how much weight each feature receives, and how the classifier responds to uneven class frequencies.

The method, step by step

From a comment to a set of features

The system starts with the comment as written and converts its letters to lower-case. An n-gram is a contiguous sequence of a specified length. Here the units are characters, so the shortest sequence is an individual character. Longer sequences retain some of the local order of the original text. The submitted classifier uses sequences of every length from 1 to 5. This gives it several ways to represent the same stretch of a comment. A particular character can contribute on its own while also contributing as part of a more specific local pattern.

Spaces and punctuation remain in the input. Consequently, a feature can represent part of a word, run across a space, or include punctuation next to a fragment of text. The system does not need a prior decision about word boundaries in order to preserve evidence around spaces. This is relevant to the example of a title whose letters appear with spaces between them. The spaces are part of what the reader sees, and they are part of what the classifier receives. Lowercasing removes the distinction between upper-case and lower-case forms while leaving that spacing in place.

Bestgen also distinguishes sequences at the beginning and end of a comment using a special symbol. A sequence next to a comment boundary can then have a different representation from an otherwise identical sequence inside a comment. The distinction is local. It can tell the classifier that a pattern opens or closes a comment without encoding the positions of all its occurrences. This matters for understanding what a vector of character features preserves. It can represent specific short stretches in order and mark the outer boundaries, while the feature counts supply only a summary of where the rest of the text went.

The feature vocabulary has a minimum frequency threshold of 2. An n-gram observed fewer than twice in the material is discarded. The threshold governs which patterns become available to training. It does not, by itself, specify how strongly a retained pattern should count when it appears in a particular comment. A pattern can be rare enough to carry useful information and still occur frequently enough to meet the threshold. Conversely, a retained pattern can be widespread across all categories and therefore have little value in distinguishing them.

Preparing character features and learning a comment classifier

The steps in order.

Preparing character features and learning a comment classifierStep 1: Lowercase comments and mark their outer boundaries1. Lowercase comments and mark their outer boundariesStep 2: Extract character sequences, retaining spaces and punctuation2. Extract character sequences, retaining spaces and punctuationStep 3: Discard sequences below the frequency threshold3. Discard sequences below the frequency thresholdStep 4: Weight retained features with BM254. Weight retained features with BM25Step 5: Normalize each comment vector with its L2 norm5. Normalize each comment vector with its L2 normStep 6: Tune training settings through stratified cross-validation6. Tune training settings through stratified cross-validationStep 7: Train the classifier and predict comment labels7. Train the classifier and predict comment labels

Giving the features numerical weights

A classifier needs numbers for the features it receives. One possibility is to record whether a sequence occurred at all. Another is to give a recurring sequence a larger value. Bestgen uses BM25, a weighting scheme related to TF-IDF. The central distinction is between frequency in the current comment and frequency across the material. A sequence can be prominent within a particular comment while also being ubiquitous across comments. The weighting stage can use both facts to shape how much that sequence contributes.

BM25 also accounts for document length, with each comment treated as a document in this application. A longer comment gives a sequence more opportunities to occur. The same raw count can therefore carry different information in a very short comment and a longer one. Bestgen describes this length adjustment as part of the rationale for BM25 and points to the earlier VarDial study for the equation. The Dravidian paper names the scheme and gives its role in the pipeline. Its own account of the weighting step is at that level.

It helps to distinguish these numerical weights from the classifier’s learned coefficients. BM25 supplies a feature value for a sequence in a comment. The classifier learns how a feature with that value bears on the category decision, based on the labeled examples. Giving a particular sequence a large feature value has no automatic implication about which language it favors. That direction comes from training. A widespread fragment can likewise receive a treatment reflecting its distribution before the classifier sees any association between that fragment and a category.

The frequency threshold and the weighting scheme also address different questions. The threshold decides whether a sequence has a coordinate at all. Weighting decides what value a comment receives on that coordinate. This distinction helps explain why Bestgen varies them separately in the later comparisons. A higher cutoff can remove a sequence altogether, while a different weighting scheme can preserve the sequence and alter the influence of its occurrences.

Putting comments on a common scale

The BM25 values form a vector for each comment. A coordinate corresponds to a retained n-gram, and its value expresses the weight of that n-gram in that comment. Different comments can yield vectors of different magnitudes, even after BM25 has adjusted for document length. Bestgen applies L2 normalization to each comment’s vector. The operation divides the coordinates by the vector’s overall Euclidean length.

For a comment with non-zero feature weights, the normalized coordinates can be written as follows.

zᵢ = xᵢ / √(Σⱼ xⱼ²)

Here xᵢ is the BM25 value of feature i in the comment, and zᵢ is the corresponding value after normalization. The index j runs through the feature coordinates of the same comment. Σⱼ adds the squared values of those coordinates, and √ takes the square root of that sum. The exponent ² means that each value is multiplied by itself. The denominator is the L2 norm of the BM25 vector.

Every coordinate of a comment is divided by the same amount, so their relative proportions are preserved. The operation changes the magnitude of the vector that reaches the classifier. A comment can have many active features and another can have few, while their non-zero normalized vectors have the same overall length. Which coordinates are active, and how much of the normalized vector each accounts for, can still differ substantially.

BM25’s length treatment and L2 normalization occur at different points. BM25 affects the value assigned to a particular feature before the comment vector is complete. L2 normalization uses all the weighted features of that comment to apply a common scaling factor. The submitted system uses both. The later comparisons change the feature weighting while keeping the standard normalization, and change the normalization while retaining the standard weighting. That division makes the role of each choice easier to interpret in the context of the submitted system.

Learning the category decision

Bestgen uses LIBLINEAR’s dual form of L2-regularized logistic regression. A linear classifier combines the feature values with coefficients learned from the labeled material. Patterns useful to a category can contribute evidence toward selecting that category. The classifier learns these associations from examples of whole comments. The labeled input supplies the answer at comment level, so a recurring fragment can be useful even if it never receives its own language label.

Regularization limits how freely the learned coefficients can grow to accommodate the training data. L2 regularization penalizes large coefficients through their squared magnitudes. It acts on the learned coefficients, while L2 normalization acts earlier on the input vectors. The shared name reflects the use of squared magnitudes in both operations. The objects and purposes differ. Normalization sets the scale of a comment’s representation. Regularization affects the balance between fitting the labeled examples and keeping the learned coefficients constrained.

The base regularization parameter C is set to 9. LIBLINEAR also accepts the -wi options, which adjust C by category. The system as submitted assigns Kannada a setting of 300, Malayalam 24, Tamil 1, and Other-language 310. These are training settings. They change how strongly the fitting procedure responds to the examples of each class. They do not change how many comments the organizers supplied or how a test comment counts towards the official score.

The settings make the treatment of the labels visibly asymmetric. Tamil has the largest share of the training material and receives the smallest -wi value. Kannada and Other-language receive much larger adjustments, while Malayalam falls between these cases. The values come from tuning the classifier. They are best read alongside the choice of optimization metric and the test comparisons that enable or omit the class adjustments. Their significance lies in what they do to the fitted decision, not in a direct conversion from the class frequencies.

Choosing settings before the test

Bestgen tunes the system on the learning material with 5-fold cross-validation. The comments are divided into folds. A configuration is trained on the material outside a fold and evaluated on that held-out portion, with the held-out role rotating across the folds. The folds are stratified by category, so the partition is designed to maintain the class distribution across them. Stratification is important here because Kannada and Other-language are already uncommon. Uncontrolled differences in their representation across folds could make a setting look better or worse depending on which comments happened to be held out.

The metric used during optimization is Macro-F1. At the time of tuning, Bestgen did not know which measure the organizers would use for ranking. The author anticipated that the strong class imbalance would make Macro-F1 the likely choice. That expectation established what counted as a promising setting during development. Under Macro-F1, improving a class with few comments can matter as much as improving a class with many.

This procedure makes the subsequent chronology important. Bestgen selected the submitted settings during cross-validation on the learning material. The organizers later used weighted-average F1 as the official measure. After they released the correct labels for the test set, Bestgen evaluated variants on that set to examine the choices made during development. Those retrospective comparisons help explain the behavior of the submission. The original entry had already been selected using a different split and a stated tuning criterion.

Experiments and results

The learning and test material

The learning set contains 16,674 labeled YouTube comments. Tamil contributes 10,969, Malayalam 4,204, Other-language 1,008, and Kannada 493. In percentage terms, the learning split is 65.8% Tamil, 25.2% Malayalam, 6.0% Other-language, and 3.0% Kannada. This distribution means the classifier sees many more examples of the spelling and context variation found under Tamil and Malayalam than it sees under the other categories. The same imbalance gives a majority label considerable influence over any aggregate measure that weights by the number of examples.

The test set contains 4,588 comments. There are 3,049 Tamil comments, 1,171 Malayalam comments, 305 Other-language comments, and 63 Kannada comments. In the paper’s distribution table, those shares are 66.5%, 25.5%, 6.6%, and 1.4%, respectively. The shift is particularly important for Kannada. It supplies few examples in the learning set and has an even smaller share of the set used to assess the submission.

The paper uses a chi-square test to look at the category distribution across the two splits. It reports the result as follows.

χ²(3) = 37.0, p < .0001

Here χ² is the chi-square statistic for the contingency table of category by split. The 3 in parentheses is its degrees of freedom, and 37.0 is the observed statistic. The symbol p denotes the probability, under the null hypothesis of the same category distribution, of observing a statistic at least as extreme. The less-than sign gives the reported upper bound of .0001. For this study, the practical detail behind the statistic is the change in class proportions, especially the reduction in the share of Kannada at test time.

Bestgen characterizes the comments as having an average length of 8.5 tokens and 58 characters, with a quarter of them containing 6 tokens or fewer. These are descriptions of the task material. The feature extractor itself uses characters, including spaces and punctuation. The token count gives a reader another way to picture the inputs. A classifier may have enough characters to form many overlapping features while still seeing only a short fragment of language.

What the scores count

Precision and recall address different questions for a category. Precision asks how often a prediction of that category is correct. Recall asks how frequently the classifier recovers comments that truly belong to it. A system can predict a category broadly and find many of its genuine examples while also collecting comments that belong elsewhere. It can also use a category sparingly, producing a more reliable set of predictions while leaving more genuine examples assigned to other labels. F1 combines precision and recall into a single score for the class, with a weak value on either side pulling it down.

The official score, weighted-average F1 or WA-F1, averages category F1 scores according to their support. Support is the number of comments with that reference label in the evaluation set. The meaning of the calculation can be written as follows.

WA-F1 = (Σ꜀ s꜀ F꜀) / (Σ꜀ s꜀)

Here WA-F1 denotes the weighted-average score. The index c runs through the categories, F꜀ is the F1 score for category c, and s꜀ is its reference support. The numerator sums each category’s F1 multiplied by its support. The denominator sums the supports. Accordingly, Tamil and Malayalam have more influence on this score, given their prevalence on the test set.

Macro-F1 gives the category scores equal influence.

Macro-F1 = (Σ꜀ F꜀) / K

Macro-F1 denotes the equal-weight average. The index c again ranges over the categories, and F꜀ is the F1 for category c. The summation adds the category F1 scores, and K is the number of categories included in the average. Under this calculation, Kannada contributes as much as Tamil even though their test supports differ greatly.

Bestgen describes weighted-average F1 as close to Micro-F1 in this setting. The paper reports WA-F1 and Macro-F1 for the team and setting comparisons. Their useful difference is whose performance can move the aggregate. A change on a class with little test support can leave WA-F1 nearly steady while shifting Macro-F1 appreciably. On the other hand, sustained performance on the large categories matters directly to an evaluation intended to reflect where most comments occur. The shared task’s ranking and Bestgen’s tuning procedure thus use different views of the same class-level scores.

How LAST ranked

The test-set comparison includes the other shared-task submissions, HWR, Nayel, and Phlyers. They serve as competition comparators. Bestgen’s study centers on the submitted LAST configuration and on changes to that configuration after the test labels become available. The leaderboard establishes where LAST placed among the entrants. The subsequent variants support comparisons about particular choices inside LAST.

Weighted-average F1 of the VarDial DLI submissions on the test set

LAST leads the official ranking, with HWR closest to it.

Weighted-average F1 of the VarDial DLI submissions on the test setLAST (this paper): 0.928LAST (this paper)0.928HWR: 0.923HWR0.923Nayel: 0.915Nayel0.915Phlyers: 0.896Phlyers0.896
The numbers
System or settingWA-F1
LAST (this paper)0.928
HWR0.923
Nayel0.915
Phlyers0.896

The paper describes the gaps among submissions as small. The official test scores support a close comparison between LAST at 0.928 and HWR at 0.923. Nayel scores 0.915 and Phlyers 0.896 on the same metric and split. The result answers the study’s competition question. A classifier using character sequences alone can lead this particular field of shared-task submissions when its representation and training settings are tuned.

Macro-F1 of the VarDial DLI submissions on the test set

Giving each category equal weight preserves the order of the submissions.

Macro-F1 of the VarDial DLI submissions on the test setLAST (this paper): 0.810LAST (this paper)0.810HWR: 0.793HWR0.793Nayel: 0.765Nayel0.765Phlyers: 0.728Phlyers0.728
The numbers
System or settingMacro-F1
LAST (this paper)0.810
HWR0.793
Nayel0.765
Phlyers0.728

The ranking also places LAST first under its tuning metric. On test Macro-F1 it reaches 0.810, followed by HWR at 0.793, Nayel at 0.765, and Phlyers at 0.728. The same order can coexist with a different assessment of performance. Under the equal-weight metric, weakness on rare classes affects all the scores more strongly. The leaderboard therefore supports both the relative claim about placement and a closer examination of how evenly the system performs.

The category scores and their errors

LAST category F1 on the VarDial DLI test set

The two frequent language categories score highest, while Other-language is hardest to identify.

LAST category F1 on the VarDial DLI test setTamil (this paper): 0.960Tamil (this paper)0.960Malayalam: 0.943Malayalam0.943Kannada: 0.745Kannada0.745Other-language: 0.591Other-language0.591
The numbers
System or settingF1
Tamil (this paper)0.960
Malayalam0.943
Kannada0.745
Other-language0.591

The test performance is strongest on Tamil and Malayalam, with test F1 of 0.960 and 0.943. Kannada, at 0.745, and Other-language, at 0.591, present substantially more difficulty. The author also reports that Other-language was hard for all the submitted systems. The category ranking is consistent with the contrast between an aggregate led by the larger categories and one that gives the weaker categories equal influence. It also directs attention to the error patterns that a single score would conceal.

The confusion matrix counts comments according to both their reference and predicted labels. The count on the matching pair tells how many comments of that class the system classified correctly. Counts involving different labels show errors and preserve their direction. Reading the matrix by direction matters. Predicting Kannada on a Tamil comment is a different event from predicting Tamil on a Kannada comment. The numbers of available comments in those categories also differ, so the counts and the rates answer related but distinct questions.

For Kannada, LAST correctly labels 54 of the 63 reference comments. Its Kannada predictions also include 12 Tamil comments and 15 Other-language comments. The separation between Kannada and Malayalam is comparatively strong in the matrix. The system assigns 1 Malayalam comment to Kannada and 2 Kannada comments to Malayalam. The small cross-category counts provide more specific evidence than the general observation that the languages are related. In this test, Kannada’s errors as a predicted label come mainly from the categories other than Malayalam.

The classwise score table and the matrix need to be read together. The values printed under precision and recall in the classwise table appear in reverse order relative to the usual definitions and the matrix. For Kannada, 0.857 corresponds to recall, as indicated by the number of genuine Kannada comments recovered, and 0.659 corresponds to precision, as indicated by how many of its Kannada predictions belong to that class. This reading also matches Bestgen’s description of a classifier that retrieves most Kannada examples while using the label for some comments in other categories. The reported F1 values are unaffected by exchanging the two labels.

For Other-language, 176 comments receive the correct label. The remaining reference examples are assigned across all the named categories. The confusion matrix records 15 Other-language comments assigned to Kannada, 31 to Malayalam, and 83 to Tamil. This spread shows that the residual class poses a broader problem than confusion with a single named language. Any explanation by particular language would require knowing what the Other-language comments contained, which the reported results leave unresolved.

The test results also record strong performance for Tamil and Malayalam alongside meaningful overlap between them. The system correctly classifies 2,929 Tamil comments and 1,100 Malayalam comments. The matrix records 28 Tamil comments predicted as Malayalam and 38 Malayalam comments predicted as Tamil. Large supports make it possible to obtain a high category score while making a visible number of errors. In the rarer categories, a much smaller collection of errors can carry more weight in the class score. This is one reason to read the supports, the direction of errors, and the two aggregates together.

What the ablations show

Interpreting the setting comparisons

Once the organizers released the test labels, Bestgen examined the effect of changing decisions in the submitted system. The main comparisons vary one setting at a time. The reference point is LAST with a maximum n-gram length of 5, a minimum frequency of 2, BM25 weighting, L2 normalization, and C set to 9 with the class-specific adjustments enabled. The table reports differences from that reference on the test set. A negative entry means the variant scored below the submitted configuration under the specified metric. An entry of 0.000 reports a tie at the precision shown in the table.

The tests are controlled in a practical sense. For instance, changing the maximum n-gram length leaves the usual feature weighting and classifier settings in place. The result answers how that change behaves in the rest of the selected configuration. It gives no direct estimate of how the same change would behave alongside another normalization method or with the class adjustments disabled. Bestgen chose this design because evaluating all combinations would produce a much larger experiment. The paper also reports that the broad conclusions from the test comparisons generally agree with those reached during cross-validation.

How much character context to retain

The largest changes in the length comparison come from restricting the available context. With a maximum length of 3, the test difference from LAST is -0.021 WA-F1 and -0.049 Macro-F1. A maximum of 4 improves on that variant, but still shows differences of -0.005 WA-F1 and -0.017 Macro-F1. Because the feature sets include the shorter sequences as well, this comparison asks what happens when the classifier loses access to the longer patterns used by the submission.

The longer settings give a different picture. With a maximum of 6, the test differences are -0.001 WA-F1 and -0.005 Macro-F1. The maximum of 7 has the same reported differences. The maximum of 8 gives -0.003 WA-F1 and -0.009 Macro-F1. The experiments therefore point to a range in which the precise boundary matters relatively little to the support-weighted score, while Macro-F1 distinguishes the submitted setting from its neighbors more clearly. Expanding the feature vocabulary with yet longer sequences brings no improvement in the tested configuration.

The comparison has a straightforward interpretation at the level of the representation. Longer n-grams can retain more of the local spelling or adjacent context that shorter fragments omit. Their addition can also introduce more specific patterns with limited evidence behind them. The test results show how those effects balance for the settings evaluated here. They do not identify individual sequences responsible for the outcome. The evidence for choosing a maximum of 5 concerns the observed behavior of the whole feature set on this problem.

What happens when rarer sequences are removed

Raising the minimum frequency threshold makes the vocabulary more selective. A threshold of 3 produces test differences of -0.001 WA-F1 and -0.004 Macro-F1. At 5, the differences are -0.002 WA-F1 and -0.010 Macro-F1. At 10, they are -0.003 WA-F1 and -0.013 Macro-F1. The support-weighted results change little across this progression. The equal-weight results give a clearer indication that removing less frequent sequences costs predictive information.

This is a comparison of vocabularies with other settings held at the submitted values. A sequence that occurs infrequently across the learning material may still carry evidence for a category that itself occurs infrequently. That is a plausible way to read the stronger sensitivity of Macro-F1. The table reports aggregate scores for these variants, so it does not establish which categories or sequences account for the difference. What it directly shows is that the test score with equal category weights falls more as the threshold rises than the test score with weights based on support.

This result also separates having a feature from trusting it equally whenever it appears. The winning configuration retains sequences that clear the threshold of 2, then uses BM25 and the classifier to determine their influence. A larger threshold settles the question earlier by deleting more coordinates. The comparisons indicate that, under the submitted weighting and fitting choices, the additional filtering comes at a measurable cost to Macro-F1.

How feature values and vector scale matter

Bestgen compares BM25 with binary weighting, raw frequency, logarithmic weighting, sublinear TF-IDF, and log-entropy weighting. Binary weighting records presence. Raw frequency reflects how often a sequence occurs. Logarithmic weighting makes additional occurrences increase the feature value less rapidly than they would under raw counts. The comparison includes alternatives that further account for properties of the sequence across the material. This range allows the experiment to ask whether a simple count is sufficient and whether BM25’s advantage depends on the metric.

Binary weighting yields test differences of -0.006 WA-F1 and -0.017 Macro-F1. Raw frequency yields -0.010 WA-F1 and -0.017 Macro-F1. Logarithmic weighting gives -0.005 WA-F1 and -0.012 Macro-F1. The logarithmic transform performs better than raw counts under both measures among these variants. In the author’s reading, this supports diminishing the influence of repeated occurrences. Presence alone also loses some of the information used by the submitted representation.

The strongest alternatives depend on the metric. Sublinear TF-IDF and log-entropy each report a test WA-F1 difference of 0.000 from BM25. Their Macro-F1 differences are -0.003 and -0.004, respectively. The official score would give those alternatives the same reported result as BM25. The equal-weight average gives BM25 a small advantage over both. This qualifies the comparison with Bestgen’s earlier VarDial study, in which BM25 had outperformed sublinear TF-IDF. The current evidence favors BM25 on the metric used for tuning and shows equally effective alternatives on the official measure.

The normalization comparison holds the submitted feature weighting in place and changes how the resulting comment vectors are scaled. Omitting normalization gives test differences of -0.007 WA-F1 and -0.030 Macro-F1. The tested range normalization to [0,1] gives the same reported aggregate differences. Both variants fall short of the L2-normalized reference under both metrics. The equal reported differences describe the totals. They leave open whether the variants made the same predictions or affected the categories in the same way.

L2 normalization has a clear contribution within this comparison. The test result is evidence that the scale in which the classifier receives the BM25 features matters. It also helps distinguish the weighting and normalization decisions. Even with BM25 already taking document length into account, changing the subsequent vector normalization affects the scores. The paper measures that effect for entire settings. It gives no breakdown by comment length from which to locate the examples most affected by the change.

Regularization and class adjustments

The test comparisons vary the base C setting both with and without the class-specific adjustments. At C of 9 without -wi, the difference from the submitted system is -0.013 WA-F1 and -0.038 Macro-F1. This is a direct comparison at the submitted base C. With a base C of 1 and no class adjustments, the differences are -0.038 WA-F1 and -0.140 Macro-F1. The particularly large Macro-F1 loss illustrates how strongly the equal-weight assessment can react to a poor fitting configuration.

Increasing C without class adjustments improves on the low-C variants, while leaving a gap to the submission. At C of 50 without -wi, the test differences are -0.007 WA-F1 and -0.017 Macro-F1. At C of 200 they are -0.006 and -0.017, and at C of 1000 they are -0.005 and -0.016, respectively. A larger common C can recover some of the performance in this series. Every tested setting without the category adjustments still has a lower reported Macro-F1 than the reference.

The series with -wi enabled shows less sensitivity around the selected base setting. C of 1 gives test differences of -0.014 WA-F1 and -0.019 Macro-F1. At C of 5 the differences are -0.002 and -0.005. At C of 8 they are -0.001 and -0.002. At C of 10 they are 0.000 and -0.001. At C of 15 they are -0.001 and -0.003. Under the tested class adjustments, several choices near C of 9 produce very similar scores. The result lends more weight to the choice to adjust training by class than to the idea that the exact selected C is essential.

Class adjustment in training and class weighting in evaluation are distinct operations. The former changes the classifier that is learned. The latter changes the importance given to each category when reporting performance on a fixed set of predictions. The paper varies the first and reports the outcome under both versions of the second. The stronger response in Macro-F1 shows that the benefit of changing the fitting procedure becomes more visible when every category has equal influence on the evaluation.

A comparison with several settings changed together

Bestgen also evaluates a version that retains character n-grams of lengths 1 to 5 but uses a frequency threshold of 10, logarithmic weighting, and no normalization. The variant reported in the paper keeps the optimized C and class adjustments, which narrowly give the strongest scores for that version. This comparison addresses how the classifier fares when several of the feature choices are less thoroughly optimized, even with the training settings kept at their selected values.

The less tuned version achieves 0.915 WA-F1 and 0.772 Macro-F1 on the test set. Its official-metric score matches Nayel’s reported 0.915, putting it level with the submission in third place on that measure. Its Macro-F1 is also visibly below LAST’s 0.810. The paper’s parenthetical differences for this variant are inconsistent with the reported absolute scores and the headline scores for LAST. The absolute scores give the basis for the comparison here.

The combined variant makes a different point from the individual setting comparisons. It shows where a less tuned version of the general approach would have stood against the other entries. It cannot allocate the change among the higher threshold, the weighting choice, and the omission of normalization. Those choices could interact, since each changes the values available to the next stage of the pipeline. The one-at-a-time comparisons are the direct evidence for how each change behaves around the submitted configuration.

Limitations

Limits stated by Bestgen

Bestgen identifies explicit treatment of code-switching as an open development direction. The classifier can use character patterns around a switch, but its training target is the category of the entire comment. Its features do not label a stretch as English or identify the boundaries between languages. In the Closed track, the author regarded automatic English-word recognition using only the organizer’s material as a substantial undertaking. An English word list would have simplified that particular step, but such a resource was outside the rules of the submission.

The Other-language category limits the explanation of the results. Bestgen describes it as plausibly consisting of several languages in different proportions. The author also raises the possibility that the learning and test sets cover different sets of languages within that label. This is an uncertainty about the category’s composition. Its relatively low F1 and the distribution of its predictions across the named labels are measured. Attributing those errors to a particular language, or to a mismatch in coverage between splits, would require details of the underlying comments that the paper does not establish.

Bestgen also treats transfer of the selected settings as a question for further work. The author sees BM25 as a promising choice and suggests that logarithmic weighting and L2 normalization may also carry over to earlier VarDial tasks. The choice of a maximum n-gram length of 5 is treated more cautiously. Which local sequences are useful depends in part on the languages under comparison. The fact that an earlier task used the same general feature family and a supervised classifier leaves room for the settings to behave differently.

The paper offers one related result outside the Dravidian leaderboard. Bestgen reports using the same system for an extension of the Uralic language identification task, where it failed to improve on the organizers’ baseline. The paper leaves that participation largely undiscussed. The result establishes a boundary on the competitive claim. LAST’s ranking is evidence about the Dravidian challenge and the entries evaluated there, while the Uralic outcome provides a case in which the same configuration did not deliver a comparable result.

Bestgen frames the choice of evaluation measure as a question that depends on the purpose of the task. WA-F1 suits an objective in which performance on the most frequently encountered categories should have the greatest effect on the total. Macro-F1 brings performance on rare classes into clearer view, while also allowing changes on a small number of examples to have a noticeable influence. The study illustrates the consequences of the choice. The author argues for specifying the shared-task metric before training so that participants can tune toward the intended objective.

Limits visible in the evaluation design

The competition compares a small group of submissions on one test set. LAST ranks first on both reported aggregates, and the paper reports close official scores. The comparison establishes the order of those entries on that material. The reported leaderboard consists of point estimates, so it gives no basis for saying how consistently the same order would recur with different comments. This matters especially when a reader moves from the concrete claim of first place to a broader claim about the superiority of one approach.

The amount of evidence for Kannada also constrains interpretation. The test set supplies 63 reference comments in that category. The confusion matrix gives a transparent account of what happened to those comments and how frequently the label was used on others. A different sample with different spellings, topics, or mixtures could yield a different class score. Macro-F1 makes the performance of the rare class visible, a property that comes with sensitivity to the particular sample used to estimate it.

The parameter comparisons are chiefly tests of changes around the selected configuration. A result for BM25 with L2 normalization in place does not establish the same ranking of weighting schemes under other normalization choices. Likewise, the apparent tolerance for nearby values of C applies to the tested class adjustments. The combined variant demonstrates that less thoroughly tuned feature settings can give a weaker result as a group. It leaves the interactions among those settings unresolved.

The study’s material also defines the scope of the classification result. The comments share a platform, Roman script, short length, and a tendency to mix languages. Character features can represent spelling, punctuation, spaces, and fragments associated with the kinds of comments people post there. The results do not isolate evidence of linguistic structure from evidence associated with that particular writing environment. The system was evaluated on the labels of comments from this setting, and the test scores describe its ability to reproduce those labels.

Finally, the experiments describe the effects of feature choices at the level of aggregate settings. The tests show that longer character sequences, the weighting scheme, and normalization affect performance. They offer no detailed attribution to particular fragments, types of switch, or classes of comment. The confusion matrix helps locate the most visible category errors, while the parameter tables show how scoring responds to changes in the pipeline. Together they provide a behavioral account of the classifier, with the linguistic explanation of its individual decisions left open.

What came after

Follow-up studies building directly on this entry have yet to be documented. Bestgen leaves two concrete questions open. One is whether a system can use explicit information about language switches to improve whole-comment identification. The other is whether the useful feature choices carry over across VarDial tasks, particularly the balance between the context supplied by longer character sequences and the amount of evidence available to learn from them. The Dravidian experiments establish where these questions begin. Carefully tuned character features were competitive on this test, the two evaluation measures responded differently to changes in the classifier, and the largest remaining difficulties lay in the less frequent categories.

Cite

Cite as Yves Bestgen. 2021. Optimizing a Supervised Classifier for a Difficult Language Identification Problem. Proceedings of the Eighth Workshop on NLP for Similar Languages, Varieties and Dialects.

The paper itself, not this page. BibTeX from the library's record of the work.

@inproceedings{yves2021optimizing,
  title = {{Optimizing a Supervised Classifier for a Difficult Language Identification Problem}},
  author = {Yves Bestgen},
  booktitle = {Proceedings of the Eighth Workshop on NLP for Similar Languages, Varieties and Dialects},
  year = {2021},
  url = {https://aclanthology.org/2021.vardial-1.11/}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/bestgen-2021-optimizing-supervised-classifier-difficult-language/