Registry Mirror
Skip to content

LinearModelParameters have two ways to get Weights, should be one #2763

Closed

Description

@Ivanidzo4ka

we have this:

public IReadOnlyList<float> Weights => new WeightsCollection(this);

and we have this:
public void GetFeatureWeights(ref VBuffer<float> weights)

I would prefer to hide second one (and IHaveFeatureWeights interface) but it's up to discussion

Activity

  1. TomFinley commented on Feb 27, 2019

    @TomFinley
    Contributor

    I might actually prefer the opposite. It more closely resembles how IDataView and its schema and annotations are used. I also am unclear on the benefits of exposing ``IHaveFeatureWeights`, which is as an interface, AFAIK, not terribly well designed or thought out. (Does a multi-class logistic regression classifier have weights? How about OVA? How about an ensemble? How about a calibrated predictor.)

    So I feel we must hide that interface. Whether or not we have one of these accessors or the other, I am slightly more indifferent. Either is fine I think. The latter is more in line with how we generally ask people to access data out of our core structures, so there is a consistency argument. The IReadOnlyList is easier to understand, and the performance reasons that lead us to prefer buffer reuse in IDataView itself are less important here.

  2. Ivanidzo4ka commented on Feb 27, 2019

    @Ivanidzo4ka
    ContributorAuthor

    Sorry, I'm a bit confuse. I suggest to hide IHaveFeatureWeights and GetFeatureWeights method.
    It looks like you prefer same thing, but you start your sentence with

    I might actually prefer the opposite

  3. TomFinley commented on Feb 27, 2019

    @TomFinley
    Contributor

    Ah, I'm misspeaking I think.

    So I would prefer to have the second one, that is, keep the ref, as it is consistent. But I would prefer to hide the interface itself. One can have an interface be internal while having its implementation remain public after all.

    I don't insist on it though!! So I think we agree on hiding the interface, but might disagree on which of the two methods should be the actual accessors. But my disagreement on this part is not strong. There is a consistency argument w.r.t. IDataView itself for the ref, but we also expose model parameters as IReadOnlyList in many places since perf in these situations is always less critical.

    So I agree with hiding the interface (I think I misunderstood you, and read "have" instead of "hide" on that point), and my disagreement on the other point is minor, and I'd be perfectly happy with your porposal being put into effect. I agree there should be only one in v1. (And if it becomes necessary for some reasson, we could always add the ref version later.)

  4. self-assigned this
    on Mar 1, 2019
  5. added this to the 0319 milestone on Mar 2, 2019
  6. ghost locked as resolved and limited conversation to collaborators on Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions