Logistic Regression#

A type of linear classifier that uses the logistic (sigmoid) function to estimate the probabilities of exactly two classes. The model parameters (weights and bias) are solved using mini batch Gradient Descent with pluggable optimizers and cost functions that run on the neural network subsystem.

Interfaces: Estimator, Learner, Online, Probabilistic, Verbose, Persistable

Data Type Compatibility: Continuous


# Param Default Type Description
1 batch size 100 int The number of training samples to process at a time.
2 optimizer Adam object The gradient descent optimizer used to train the underlying network.
3 alpha 1e-4 float The amount of L2 regularization to apply to the weights of the network.
4 epochs 1000 int The maximum number of training epochs to execute.
5 min change 1e-4 float The minimum change in the cost function necessary to continue training.
6 cost fn Cross Entropy object The function that computes the cost of an erroneous activation during training.
7 window 5 int The number of epochs without improvement in the training loss to wait before considering an early stop.

Additional Methods#

Return the average loss of a sample at each epoch of training:

public steps() : array

Return the underlying neural network instance or null if untrained:

public network() : Network|null


use Rubix\ML\Classifers\LogisticRegression;
use Rubix\ML\NeuralNet\Optimizers\Adam;
use Rubix\ML\NeuralNet\CostFunctions\CrossEntropy;

$estimator = new LogisticRegression(10, new Adam(0.001), 1e-4, 100, 1e-4, new CrossEntropy(), 5);