/// <summary> /// Trains a logistic regression model on a data table /// </summary> /// <param name="table">The training data</param> /// <param name="lap">Linear algebra provider</param> /// <param name="iterations">Number of iterations to train for</param> /// <param name="learningRate">The learning rate</param> /// <param name="lambda">Regularisation lambda</param> /// <param name="costCallback">Optional callback that is called after each iteration with the current cost</param> /// <returns>The trained model</returns> public static LogisticRegression TrainLogisticRegression(this IDataTable table, ILinearAlgebraProvider lap, int iterations, float learningRate, float lambda = 0.1f, Func <float, bool> costCallback = null) { var trainer = table.CreateLogisticRegressionTrainer(lap); return(trainer.GradientDescent(iterations, learningRate, lambda, costCallback)); }