AI glossary: terms starting with K

15 terms starting with K, each defined the way the lesson that teaches it uses it, with a link to every lesson where it appears.

k-fold

k splits, each part validating once.

k-nearest neighbors

A classifier that predicts the majority label of the K nearest training rows.

k-NN regression

Predicting the mean label of the K nearest rows.

keepdims

Retain a reduced axis with size one

kernel

The program that runs a notebook's cells and keeps the names they create. Restarting it deletes every name.

kernel density estimate (KDE)

A smoothed density estimated from observations: a small curve (a kernel) is placed at each value and the curves are added.

key

What a dictionary looks a value up by, such as "Pasta" in the menu. Each key appears once, and must be hashable.

key function

A function passed as key=, whose result is what sorted, min and max compare.

key value pair

One entry of a dictionary: a key and its value, written "Pasta": 12.50.

KeyError

The exception for a missing dictionary key or an absent member passed to set.remove.

keyword

A word Python reserves, such as if, for, class, True and None. It can not be used as a name. Python 3.12 has 35.

keyword argument

An argument passed as name=value, matched to the parameter with that name: rate=0.2.

keyword-only parameter

A parameter after * or *args, which must be passed by keyword; it can be required even after a parameter with a default.

KKT conditions

the conditions for an optimum with inequality constraints

Example: gradient condition, feasibility, μ ≥ 0, slackness

kwargs

A parameter with two stars, which collects extra keyword arguments into a dictionary: def order(quantities).