Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: Multi-Linear Regression OLS in java ( Weka)

  1. #1
    Join Date
    Sep 2013
    Posts
    15

    Question Multi-Linear Regression OLS in java ( Weka)

    Hi there,

    I was just wanting confirmation that this function: weka.classifiers.functions.LinearRegression, uses the OLS algorithm, closed form.
    I found from this link below:

    http://forums.pentaho.com/showthread...oefficients%29

    Also I have been trying to find a sample example in java of Multi-Linear Regression that not only returns the coefficients, but also returns many more statistics such as,
    standard error of the coefficients, t-statistics of coefficients, p-values, F-test value, residuals, R.

    On the web I only found one example which just returns the coefficients and nothing more.

    Hope someone knows of some examples or resources on Multi-Linear Regression in java using Weka.

    Regards.

  2. #2
    Join Date
    Aug 2006
    Posts
    1,741

    Default

    Yes, it is a closed from solution. It also does attribute/model selection using the Akaike criterion. Since Weka version 3.7.12 (from memory), it also can output additional statistics (when the -additional-stats flag is used): SE of coefficients, t-stat, degrees of freedom, R^2, adjusted R^2 and F-stat. Unfortunately, I don't think that all these additional stats are available via API calls on the classifier - you'd probably have to hack the code to add some accessor methods.

    Cheers,
    Mark.

  3. #3
    Join Date
    Sep 2013
    Posts
    15

    Default

    Quote Originally Posted by Mark View Post
    Yes, it is a closed from solution. It also does attribute/model selection using the Akaike criterion. Since Weka version 3.7.12 (from memory), it also can output additional statistics (when the -additional-stats flag is used): SE of coefficients, t-stat, degrees of freedom, R^2, adjusted R^2 and F-stat. Unfortunately, I don't think that all these additional stats are available via API calls on the classifier - you'd probably have to hack the code to add some accessor methods.

    Cheers,
    Mark.
    Hi Mark,

    Really appreciate your reply. So what I gather is you are saying that the Weka GUI app can give these statistical measures, but the java API does not allow it.
    If that is the case how does the Weka get access to these additional statistical methods in code?
    Thanks for clarifying the fact that this classifier is the OLS linear regression.

    If anyone can provide links to the documentation on here on this, it would be much appreciated.

    P

  4. #4
    Join Date
    Sep 2013
    Posts
    15

    Default

    Quote Originally Posted by PabloGo View Post
    Hi Mark,

    Really appreciate your reply. So what I gather is you are saying that the Weka GUI app can give these statistical measures, but the java API does not allow it.
    If that is the case how does the Weka get access to these additional statistical methods in code?
    Thanks for clarifying the fact that this classifier is the OLS linear regression.

    If anyone can provide links to the documentation on here on this, it would be much appreciated.

    P
    Hi again,

    I found more on the documentation on this:

    http://weka.sourceforge.net/doc.dev/...egression.html


    So it mentions some of the stats. But does not show which specific methods actually
    can return these results.
    SO it seems the documentation does not have these written out for the developer
    SO I guess I will need to hack into the weka.jar file to find these methods?

    I am just wondering why the documentations does not give you these fundamental details about Linear Regression analysis.
    Does anybody know who the developer is that created the code for this part of weka?
    Hope that one of the developers can possibly update the documentation on this?


    ====================================================================
    getOutputAdditionalStats

    public boolean getOutputAdditionalStats()

    Get whether to output additional statistics (such as std. deviation of coefficients and t-statistics

    Returns:
    true if additional stats are to be output

    .

    ======================================================================


    setOutputAdditionalStats

    public void setOutputAdditionalStats(boolean additional)

    Set whether to output additional statistics (such as std. deviation of coefficients and t-statistics

    Parameters:
    additional - true if additional stats are to be output

    ====================================================

  5. #5
    Join Date
    Sep 2013
    Posts
    15

    Default

    Hi Mark,
    I was able to overcome the issues I had loading the data in java code using Weka. But when I ran a test data set for linear regression, i noticed like you mentioned above that the Linear-Regression it: "It also does attribute/model selection using the Akaike criterion". SO it deselected 2 of 6 independent variables.
    I do not want it to do the attribute selection, I need to see the full results.
    HOW can you TURN OFF via java code the "Attribute Selection"?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.