Feature

In machine learning, a feature is one measurable input variable a model uses to make a prediction, such as a house's floor area or the time an email was sent.

Google's machine learning glossary defines a feature as an input variable to a machine learning model. Each example in a dataset is made up of one or more features. In a model predicting students' test scores from the weather, temperature, humidity and air pressure would be the features and the test score the label, the answer the model learns to predict.

A model cannot read a spreadsheet row directly, so the features for each example are turned into a list of numbers called a feature vector. Numbers can go in more or less as they are. Categories need converting: a feature with five possible values is often represented by five numbers, four zeros and a single one marking which value applies, a method called one-hot encoding.

Features can be continuous, like temperature, or take a fixed set of values, like a colour. They can also be built from other features, for example by combining two of them or by grouping a number into ranges. Choosing and constructing features is called feature engineering, and it has long been where much of the work in machine learning goes. In a 2012 review, Pedro Domingos wrote that the features used are easily the most important factor in whether a machine learning project succeeds.

Deep learning shifted some of that work to the model. Networks trained on raw pixels, audio or text build their own internal features layer by layer, which is why people sometimes say such models learn their features rather than being given them.

Features are also where many errors start. A feature that is only known after the event being predicted, such as whether a customer was assigned a customer agent after buying, leaks the answer into the model. Features with missing or inconsistent values make predictions unreliable. When a model behaves strangely, its features are one of the first places to look.

Common questions

What is a feature in machine learning?

It is an input variable the model uses to make predictions, such as age, price or word count. Each example in a dataset has a value for each feature, and the model learns how those values relate to the answer it is trying to predict.

What is the difference between a feature and a label?

Features are the inputs; the label is the answer. In a spam filter, features might include the sender and the words in the message, and the label is whether the email is spam. The model learns to predict the label from the features.

What is a feature vector?

It is the list of numbers that represents one example's features, in a fixed order, so a model can process it. Categories are converted into numbers first, for example with one-hot encoding, where each possible value gets its own position.

Do deep learning models use features?

Yes, but they mostly learn them. Instead of relying on hand-built inputs, deep networks are given raw data such as pixels or tokens and develop their own internal features during training.

Finding more

Search for "features and labels machine learning", "feature vector" or "one-hot encoding". Introductory course material from machine learning providers, such as Google's Machine Learning Crash Course and glossary, explains the vocabulary clearly. Research reviews by established academics give a sense of how much features matter in practice.

Working out what this means for your business?

Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.