Core Concepts (AI/ML)

Algorithm

In shortA defined set of steps for solving a problem; in machine learning, the procedure that learns patterns from data to produce a model.

Updated 24 Oct 2026· 2 min read

An algorithm is a precise, step-by-step procedure for solving a problem or completing a task. In machine learning, an algorithm is the method that learns from data: for example k-means, logistic regression or random forest. The result of running a learning algorithm on data is a model, which you then use to make predictions.

How it works

A traditional algorithm follows rules a programmer wrote: “if the URL contains /blog/, label it as a blog post”. A machine learning algorithm writes its own rules by finding patterns in examples. Supervised algorithms learn from labelled examples; unsupervised algorithms look for structure in unlabelled data; reinforcement learning algorithms learn from rewards.

MLforSEO’s framework for choosing one is to describe the problem first. The task (classification, clustering, regression, matching), the data (labelled or not, text or numbers, how much) and the solution requirements (accuracy, explainability, cost) narrow down which family of algorithms fits. Each algorithm also has settings, called hyperparameters, such as the number of clusters in k-means.

How it’s used in SEO and marketing

  • Clustering algorithms such as k-means, HDBSCAN or BERTopic for keyword and content clustering.
  • Classification algorithms for search intent, sentiment or content categories.
  • Matching algorithms such as Levenshtein distance for redirect mapping and duplicate detection.
  • Search engine “algorithms”: the ranking systems that combine hundreds of signals and many ML models. When SEOs say “the algorithm”, they usually mean this whole system.

Example

You want to group 5,000 keywords into topics. Your data is unlabelled text, so you need an unsupervised approach. You convert keywords to embeddings, then try k-means (fast, but you must choose the number of clusters) and HDBSCAN (finds the number itself and leaves outliers unclustered). You compare results by reading the clusters and checking a silhouette score, then pick the algorithm that produces groups your team can use.

Limitations and things to watch

  • No algorithm is best for every problem. Fit depends on the task, the data and how the result will be used.
  • Algorithms reflect the data they learn from, including its gaps and biases.
  • Complex algorithms such as deep neural networks can be hard to explain, which matters for decisions you must justify.
  • Start simple. A rule-based approach or a pre-trained API is often enough.

Learn it on MLforSEO

Where Algorithm shows up on MLforSEO

Sources and further reading

Other terms from Core Concepts (AI/ML)

See all 19 Core Concepts (AI/ML) terms →