question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make all non-canonical modules private?

See original GitHub issue

This is maybe for 1.0. Recently we started marking files like model_selection._split private, so that everything has a single canonical import:

from sklearn.model_selection import cross_val_score

For many (older?) models that’s not the case, we have

from sklearn.linear_model.logistic import LogisticRegression
from sklearn.linear_model import LogisticRegression

etc. I think it would be nice to make all the files that are not the canonical import (according to the API documentation) private (with deprecation obviously). That might be a bit annoying for existing users that used long import paths, but it makes auto-complete much more helpful and the module structure much less confusing for newcomers.

For example sklearn.linear_model.ridge is a module, while sklearn.linear_model.ridge_regression is a function that implements ridge regression and sklearn.linear_model.Ridge is a class that implements ridge regression. From the names this is totally unclear.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:30 (30 by maintainers)

github_iconTop GitHub Comments

1reaction
glemaitrecommented, Dec 23, 2019

you can import from sklearn.datasets._base import ...

However, now you are aware that _base will be private and you might have to change your code at a new scikit-learn release since we might not provide backward-compatible code.

This said, be aware that we are going to define a developer API which will define some backward support for these types of utilities used in third-party.

0reactions
lucasdavidcommented, Dec 23, 2019

I had a ton of private datasets, such as names, text and geographical data. I used to use the following utils to download and manage these:

from sklearn.datasets.base import (get_data_home, RemoteFileMetadata, _fetch_remote)

What’s the recommended approach now?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Go Modules Reference - The Go Programming Language
Introduction. Modules are how Go manages dependencies. This document is a detailed reference manual for Go's module system. For an introduction to creating ......
Read more >
How to Use a Private Go Module in Your Own Project
To create your new private Go module, start by cloning the private GitHub repository where it will live. As part of the prerequisites...
Read more >
Python Module for Non-canonical Keyboard Input Processing
There are special modules to create interactive command line . They can use special keys to show history, edit line, auto suggestions.
Read more >
Xcode should offer a fixit for ensuring private modules have ...
Steps to Reproduce: Use a non-canonical private module name, like PSPDFKitPrivate. Xcode outputs a warning but does not offer a fixit.
Read more >
module source path hell - Google Groups
I have the following package structure: org name common gwt client - contains client gwt client utilities module1 client. Module1.java
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found