module ml.logreg#

Short summary#

module mlstatpy.ml.logreg

Helpers on logistic regression.

source on GitHub

Functions#

function

truncated documentation

criteria

Computes Gini, information gain, likelihood on a dataset with two features assuming the first coordinates is used to …

criteria2

Computes Gini, information gain, likelihood on a dataset with two features assuming the first coordinates is used to …

likelihood

Computes \sum_i y_i f(\theta (x_i - x_0)) + (1 - y_i) (1 - f(\theta (x_i - x_0))) where f(x_i) is \frac{1}{1 + e^{-x}}. …

logistic

Computes \frac{1}{1 + e^{-x}}.

plog2

Computes x \ln_2 x.

plot_ds

Plots a dataset, X is a dataset with two features, y contains the binary labels.

random_set_1d

Builds a random dataset as describes in example Arbre d’indécision.

Documentation#

Helpers on logistic regression.

source on GitHub

mlstatpy.ml.logreg.criteria(X, y)#

Computes Gini, information gain, likelihood on a dataset with two features assuming the first coordinates is used to classify.

Paramètres:
  • X – 2D matrix

  • y – binary labels

Renvoie:

dataframe

source on GitHub

mlstatpy.ml.logreg.criteria2(X, y)#

Computes Gini, information gain, likelihood on a dataset with two features assuming the first coordinates is used to classify.

Paramètres:
  • X – 2D matrix

  • y – binary labels

Renvoie:

dataframe

source on GitHub

mlstatpy.ml.logreg.likelihood(x, y, theta=1.0, th=0.0)#

Computes \sum_i y_i f(\theta (x_i - x_0)) + (1 - y_i) (1 - f(\theta (x_i - x_0))) where f(x_i) is \frac{1}{1 + e^{-x}}.

source on GitHub

mlstatpy.ml.logreg.logistic(x)#

Computes \frac{1}{1 + e^{-x}}.

source on GitHub

mlstatpy.ml.logreg.plog2(p)#

Computes x \ln_2 x.

source on GitHub

mlstatpy.ml.logreg.plot_ds(X, y, ax=None, title=None)#

Plots a dataset, X is a dataset with two features, y contains the binary labels.

source on GitHub

mlstatpy.ml.logreg.random_set_1d(n, kind)#

Builds a random dataset as describes in example Arbre d’indécision.

Paramètres:
  • n – number of observations

  • kind – 2, 3, 4 (see example)

Renvoie:

array 2D

source on GitHub