Example using gradient descent BFGS?

June 24th, 2013

Home Forums General Example using gradient descent BFGS?

This topic contains 1 reply, has 2 voices, and was last updated by  Baz 4 years, 7 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #238


    I want to use gradient descent with BFGS for a machine learning problem.
    In the API I found the ParameterDifferentiableCostMinimizer that seems to be designed to do the job.
    Can you please show me an example of how to use this for say, linear regression?

    Congrats to the new release btw. Keep up the good work!



    Here is an example of how to use BFGS with the cost minimizer on a generalized linear model with a linear link function. Its similar to the example in the learning experiment. Basically you just need to create the ParameterDifferentiableCostMinimizer, the BFGS line minimizer, and then pass in the right function.

    int dimensionality = ...;
    List<InputOutputPair<Vector, Vector>> data = ...;
    DifferentiableGeneralizedLinearModel glm = new DifferentiableGeneralizedLinearModel(
        dimensionality, 1, new LinearFunction());
    ParameterDifferentiableCostMinimizer bfgs =
        new ParameterDifferentiableCostMinimizer(
            new FunctionMinimizerBFGS());
    bfgs.setCostFunction(new MeanSquaredErrorCostFunction());
    GradientDescendable learned = bfgs.learn(data);
    • This reply was modified 4 years, 7 months ago by  Baz.
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Comments are closed.