← all concepts

Binary Classification

A model task with exactly two possible output labels — yes/no, spam/not-spam, AI/human — the simplest and most common form of supervised classification.

Listen

At its core, binary classification is the task of making a simple, two-way decision. It takes an input, like a piece of text, and assigns it to one of exactly two categories. Think of deciding whether an email is spam or not, if a document is human-written or AI-generated, or if a search query is well-formed.

To do this, a classifier typically outputs a probability score between zero and one. If the score is above a certain threshold, usually point-five, the model assigns one label. If it is below, it assigns the other. This raw probability score is incredibly useful because it shows the model’s level of confidence. A score of point-ninety-seven means high certainty, while point-fifty-four means the model is barely making the cut. Because of this, many production systems use these raw scores so they can set their own custom thresholds.

This clean, two-state framing powers several practical models, from detecting link spam to analyzing query quality. If a problem grows to include more than two categories, it shifts into multi-class territory.

When it comes to measuring success, we look at accuracy, precision, and recall. The right metric to focus on always depends on the cost of making a mistake. For some systems, letting a bad link slip through is worse than accidentally blocking a good one, while for others, the opposite is true. Ultimately, binary classification succeeds by reducing complex data down to a single, actionable decision boundary.

What binary classification is

Binary classification is the task of assigning one of exactly two labels to each input. The model reads a piece of text (or any other input) and outputs either class 0 or class 1 — human-written or AI-generated, organic link or money link, well-formed query or keyword fragment. Everything reduces to a single decision boundary.

How it works

A binary classifier typically ends with a single output neuron that produces a probability between 0 and 1. A threshold — usually 0.5 — decides the label: above the threshold is class 1, below is class 0. The model is trained by minimising a loss function, typically binary cross-entropy, which penalises confident wrong predictions more heavily than uncertain ones.

At prediction time, the raw probability score is also useful in its own right: a score of 0.97 indicates high confidence, while 0.54 indicates the model is barely past the decision boundary. In production, many systems expose the score rather than the hard label so downstream logic can apply its own threshold.

DEJAN's binary classifiers

Several DEJAN models are binary classifiers. The AI Content Detection model outputs organic vs. AI-generated. The Link Spam Algorithm outputs money-link vs. organic link. LinkBERT and LinkjeBERT assign O (not a link) or LINK to each token in a document. The Query Form Quality Classifier outputs well-formed vs. not well-formed. In each case the problem naturally has two states, and binary classification is the cleanest framing.

When a problem has more than two states — multiple intent categories, multiple sentiment levels — the task becomes multi-label classification or multi-class classification instead.

Evaluation

Binary classifiers are evaluated with precision, recall, F1 score, and overall accuracy. Which metric to optimise depends on the cost of each error type: a spam detector that misses spam (low recall) may be worse than one that over-flags legitimate content (low precision), or vice versa depending on the use case.

Related concepts

Concept