Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

RFC Make all conditional/optional attributes raise a meaningful error when missing #31010

Copy link
Copy link
Open
@adrinjalali

Description

@adrinjalali
Issue body actions

Related: #10525, #30999

Right now accessing attributes which are added to the instances when a method is called (like coef_ in fit) before they're created, raises a simple python AttributeError. This is not only on our estimators, but also sometimes on other objects such as display objects.

Since we've had issues / confusions before, I was wondering if we'd want to introduce meaningful error messages when somebody tries to access an attribute which is not there yet, and we can tell them why it's not there. Like, Call fit to have this attribute or set store_cv_results=True to have this attribute.

In terms of UX, that to me is a very clear improvement, but I'm not sure if we want to add the complexity. We can certainly find ways to make it easier to implement via some python magic, to reduce/minimise the boilerplate code.

cc @scikit-learn/core-devs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.