AI engineering glossary · Feature engineering data prep

What is class weights?

Class weights (also called class_weight): Multipliers applied in the loss function that make mistakes on rare classes cost more, so the model pays them more attention without changing the data. A common choice is weight proportional to 1 / class frequency.

Level: intermediateTopic: Feature engineering data prep

Class weights: an example

With 1 percent fraud, giving fraud a weight of 99 makes one missed fraud cost as much as 99 missed non-frauds.

Related terms

More Feature engineering data prep terms

Where you learn it

Class weights is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.