scikit-learn provides a wide range of machine learning algorithms and utilities, organized into various modules. It can be helpful to get an overview of all available modules to navigate the library effectively.
You can list all public modules in scikit-learn using the __all__
attribute after importing the library:
import sklearn
for m in sorted(sklearn.__all__):
print(m)
Running the example prints the sorted list of module names:
calibration
clone
cluster
compose
config_context
covariance
cross_decomposition
datasets
decomposition
discriminant_analysis
dummy
ensemble
exceptions
experimental
externals
feature_extraction
feature_selection
gaussian_process
get_config
impute
inspection
isotonic
kernel_approximation
kernel_ridge
linear_model
manifold
metrics
mixture
model_selection
multiclass
multioutput
naive_bayes
neighbors
neural_network
pipeline
preprocessing
random_projection
semi_supervised
set_config
show_versions
svm
tree
The code first imports the
sklearn
library to access its attributes and modules.sklearn.__all__
is a list of strings containing the names of all public modules in scikit-learn.sorted()
is used to alphabetically sort the list before printing, making it easier to scan and find specific modules.Reviewing this list gives you a high-level view of scikit-learn’s organization and the available functionality, which can help you explore and utilize the library more effectively for your machine learning tasks.