foolbox.distances

Provides classes to measure the distance between inputs.

Distances

MeanSquaredDistance Calculates the mean squared error between two inputs.
MeanAbsoluteDistance Calculates the mean absolute error between two inputs.
Linfinity Calculates the L-infinity norm of the difference between two inputs.
L0 Calculates the L0 norm of the difference between two inputs.
ElasticNet Calculates the Elastic-Net distance between two inputs.

Aliases

MSE alias of foolbox.distances.MeanSquaredDistance
MAE alias of foolbox.distances.MeanAbsoluteDistance
Linf alias of foolbox.distances.Linfinity
EN Creates a class definition that assigns ElasticNet a fixed l1_factor.

Base class

To implement a new distance, simply subclass the Distance class and implement the _calculate() method.

Distance Base class for distances.

Detailed description

class foolbox.distances.Distance(reference=None, other=None, bounds=None, value=None)[source]

Base class for distances.

This class should be subclassed when implementing new distances. Subclasses must implement _calculate.

class foolbox.distances.MeanSquaredDistance(reference=None, other=None, bounds=None, value=None)[source]

Calculates the mean squared error between two inputs.

class foolbox.distances.MeanAbsoluteDistance(reference=None, other=None, bounds=None, value=None)[source]

Calculates the mean absolute error between two inputs.

class foolbox.distances.Linfinity(reference=None, other=None, bounds=None, value=None)[source]

Calculates the L-infinity norm of the difference between two inputs.

class foolbox.distances.L0(reference=None, other=None, bounds=None, value=None)[source]

Calculates the L0 norm of the difference between two inputs.

foolbox.distances.MSE[source]

alias of foolbox.distances.MeanSquaredDistance

foolbox.distances.MAE[source]

alias of foolbox.distances.MeanAbsoluteDistance

foolbox.distances.Linf[source]

alias of foolbox.distances.Linfinity