Did you know ... Search Documentation:
Pack logistic_regression -- README.md

logistic_regression

Logistic regression in SWI-Prolog using Iteratively Reweighted Least Squares (IRLS).

This program performs logistic regression using IRLS. See Logistic regression on Wikipedia and Murphy, Kevin P. (2012). Machine Learning – A Probabilistic Perspective. The MIT Press.

It also includes the predicate generate_data(N, Variance, Coeff, X, Y) that generates an N-row dataset with predictor variables in matrix X and predicted variable in list Y. The predicted variable is computed with the formula:

Y = (Coeff dotprod X + Noise > 0 -> 1 ; 0)

where Variance is the variance of Noise.

The predicate example_log_r(N, Coeff) is used to test the algorithm for logistic regression and dataset generation: it generates an N-row dataset with 5 as the noise variance and coefficients [1,2,3]. Then it performs 10 iterations of logistic regression. Coeff is the output of regression and should be a list of three numbers close to [1,2,3]. The higher N is, the closer to [1,2,3] Coeff should be.

Requirements: