Menu

How to use logistic regression to do classification in waffles?

Help
Anonymous
2014-07-02
2014-07-03
  • Anonymous

    Anonymous - 2014-07-02

    Hi All, I'd like to use logistic regression to do classification in waffles. When I use neural network or decision tree to classfication, I can follow the code in the demos directory, but I can't find the code about logistic regression, what I found is the function calibrate(GMatrix& features, GMatrix& labels) in GLearner.h, my question is , What algorithm does the waffles use to do logistic regression(for example, Stochastic gradient descent, SGD)? where can I find the relative code?
    any kind of help is appreciate, thanks.

     
  • Mike Gashler

    Mike Gashler - 2014-07-02

    If you use the GNeuralNet class, but you add no hidden layers before training, then the model will consist of a single layer of logistic units trained by stochastic gradient descent. I would call that logistic regression. Does that differ from what you are looking for in any specific ways?

     
  • Anonymous

    Anonymous - 2014-07-03

    thanks for the help, Mike. I've found the SGD code.
    In the do_neural_network() function, can I use the following codes to achieve the same function with logistic regression?
    void do_neural_network(...)
    {
    GNeuralNet model;
    model.setTopology(0); //add no hidden layers
    model.setLearningRate(0.1);
    model.setMomentum(0.1);
    model.train(features, labels);
    model.predict(test_features, predicted_labels);
    }

     
  • Mike Gashler

    Mike Gashler - 2014-07-03

    Yes, except omit the line

    model.setTopology(0);

    That actually says to add one hidden layer containing zero nodes. (I'm not quite sure what that will do.) If you do not call setTopology at all, then there will be no hidden layers.

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.