// constructor public RidgeRegression(int n, double penalty = 10e-5) { this.N = n; this.Penalty = penalty; // initialize all matrices and vectors this.ATA = new Matrix <double>(n, n); ATA.SetIdentity(new MCvScalar(penalty)); // add regulation weights ATA[n - 5, n - 5] = 0; // bias term has no regulation this.ATb = new Matrix <double>(n, 1); ATb.SetZero(); this.W = new Matrix <double>(n, 1); W.SetZero(); this.Inv = new Matrix <double>(n, n); Inv.SetZero(); }