public MonitorFunction(LambdaSolve m, CGRunner.LikelihoodFunction lf, string filename) { // end static class LikelihoodFunction // = 0 this.model = m; this.lf = lf; this.filename = filename; }
/// <summary>Set up a LambdaSolve problem for solution by a Minimizer.</summary> /// <param name="prob">The problem to solve</param> /// <param name="filename">Used (with extension) to save intermediate results.</param> /// <param name="tol">Tolerance of errors (passed to CG)</param> /// <param name="sigmaSquareds"> /// The prior sigma<sup>2</sup> for each feature: this doubled will be /// used to divide the lambda<sup>2</sup> values as the /// prior penalty. This array must have size the number of features. /// If it is null, no regularization will be performed. /// </param> public CGRunner(LambdaSolve prob, string filename, double tol, double[] sigmaSquareds) { this.prob = prob; this.filename = filename; this.tol = tol; this.useGaussianPrior = sigmaSquareds != null; this.sigmaSquareds = sigmaSquareds; this.priorSigmaS = -1.0; }
/// <summary>Set up a LambdaSolve problem for solution by a Minimizer.</summary> /// <param name="prob">The problem to solve</param> /// <param name="filename">Used (with extension) to save intermediate results.</param> /// <param name="tol">Tolerance of errors (passed to CG)</param> /// <param name="priorSigmaS"> /// The prior sigma<sup>2</sup>: this doubled will be /// used to divide the lambda<sup>2</sup> values as the /// prior penalty. A value of 0.0 /// or Double.POSITIVE_INFINITY /// indicates to not use regularization. /// </param> public CGRunner(LambdaSolve prob, string filename, double tol, double priorSigmaS) { // = null; this.prob = prob; this.filename = filename; this.tol = tol; this.useGaussianPrior = priorSigmaS != 0.0 && priorSigmaS != double.PositiveInfinity; this.priorSigmaS = priorSigmaS; this.sigmaSquareds = null; }
public LikelihoodFunction(LambdaSolve m, double tol, bool useGaussianPrior, double sigmaSquared, double[] sigmaSquareds) { model = m; this.tol = tol; this.useGaussianPrior = useGaussianPrior; if (useGaussianPrior) { // keep separate prior on each parameter for flexibility this.sigmaSquareds = new double[model.lambda.Length]; if (sigmaSquareds != null) { System.Array.Copy(sigmaSquareds, 0, this.sigmaSquareds, 0, sigmaSquareds.Length); } else { Arrays.Fill(this.sigmaSquareds, sigmaSquared); } } else { this.sigmaSquareds = null; } }
/// <summary> /// Set up a LambdaSolve problem for solution by a Minimizer, /// specifying a value for sigma<sup>2</sup>. /// </summary> /// <param name="prob">The problem to solve</param> /// <param name="filename">Used (with extension) to save intermediate results.</param> /// <param name="priorSigmaS"> /// The prior sigma<sup>2</sup>: this doubled will be /// used to divide the lambda<sup>2</sup> values as the /// prior penalty in the likelihood. A value of 0.0 /// or Double.POSITIVE_INFINITY /// indicates to not use regularization. /// </param> public CGRunner(LambdaSolve prob, string filename, double priorSigmaS) : this(prob, filename, DefaultTolerance, priorSigmaS) { }
/// <summary>Set up a LambdaSolve problem for solution by a Minimizer.</summary> /// <remarks> /// Set up a LambdaSolve problem for solution by a Minimizer. /// Uses a Gaussian prior with a sigma<sup>2</sup> of 0.5. /// </remarks> /// <param name="prob">The problem to solve</param> /// <param name="filename">Used (with extension) to save intermediate results.</param> public CGRunner(LambdaSolve prob, string filename) : this(prob, filename, DefaultSigmasquared) { }