Example #1
0
        private Matrix<double> BinLogitReg(Matrix<double> X, Matrix<double> y)
        {
            var w = new Matrix<double>(1, X.Shape.D, 0d);

            for (int i = 0; i < 100; i++)
            {
                var s1 = X * w.Transpose;
                var s2 = MatrixExtensions.DoOperation(s1, x => 1 / (1 + Math.Exp(-x)));
                w = w - 10e-3 * (X.Transpose * (s2 - y)).Transpose;
            }

            return w;
        }