mlrl.seco.cython.lift_function module

@author: Michael Rapp (michael.rapp.ml@gmail.com)

class mlrl.seco.cython.lift_function.KlnLiftFunctionConfig

Bases: object

Allows to configure a lift function that monotonously increases according to the natural logarithm of the number of labels for which a rule predicts.

get_k() float

Returns the value of the parameter “k” that affects the steepness of the lift function.

Returns:

The value of the parameter “k”

set_k(k: float) KlnLiftFunctionConfig

Sets the value of the parameter “k”, which affects the steepness of the lift function.

Parameters:

k – The value of the parameter “k”. The steepness of the lift function increases with larger values for “k”. Must be greater than 0

Returns:

A KlnLiftFunctionConfig that allows further configuration of the lift function

class mlrl.seco.cython.lift_function.PeakLiftFunctionConfig

Bases: object

Allows to configure a lift function that monotonously increases until a certain number of labels, where the maximum lift is reached, and monotonously decreases afterwards.

get_curvature() float

Returns the curvature of the lift function.

Returns:

The curvature of the lift function

get_max_lift() float

Returns the lift at the peak label.

Returns:

The lift at the peak label

get_peak_label() int

Returns the number of labels for which the lift is maximal.

Returns:

The number of labels for which the lift is maximal or 0, if the average label cardinality is used

set_curvature(curvature: float) PeakLiftFunctionConfig

Sets the curvature of the lift function.

Parameters:

curvature – The curvature of the lift function. A greater value results in a steeper curvature, a smaller value results in a flatter curvature. Must be greater than 0

Returns:

A PeakLiftFunctionConfig that allows further configuration of the lift function

set_max_lift(max_lift: float) PeakLiftFunctionConfig

Sets the lift at the peak label.

Parameters:

max_lift – The lift at the peak label. Must be at least 1

Returns:

A PeakLiftFunctionConfig that allows further configuration of the lift function

set_peak_label(peak_label: int) PeakLiftFunctionConfig

Sets the number of labels for which the lift should be maximal.

Parameters:

peak_label – The number of labels for which the lift should be maximal. Must be at least 1 or 0, if the average label cardinality should be used

Returns:

A PeakLiftFunctionConfig that allows further configuration of the lift function