Skip to content

OLS FeatureWeights are not the model weights #1850

Closed
@rogancarr

Description

@rogancarr

For the LinearPredictor, the GetFeatureWeights returns the model weights, as expected:

public virtual void GetFeatureWeights(ref VBuffer<Float> weights)
{
    Weight.CopyTo(ref weights);
}

The OlsLinearRegressionPredictor has the same method, but it does not return the model weights. It returns the -log(p-value) for each feature. This is weird because it overrides the LinearRegressionPredictor's GetFeatureWeights method but returns a different kind of value, essentially the magnitudes of the p-values.

Now, this goes back to the meaning of feature weight. Many predictors that are not linear models implement GetFeatureWeight, and it looks like it's a measure of importance. What's the right thing here? Do we want to return a measure of relative importance or do we want to return the model weights?

Currently, I find this API to be super confusing because there is no docstring to explain what you are getting back, and I would expect the "Feature Weights" of a linear model to the model weight parameters.

Also, this is a nit, but if we really want to return the magnitude of the p-values, doesn't -log10(p-value) make more sense? The base e log puts these onto a weird scale.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingquestionFurther information is requestedusabilitySmoothing user interaction or experience

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions