Print the Sci-kit linear model list

34 views Asked by At

Is it possible to access some kind of list of all the linear models in sklearn? They must be stored somewhere and accessible right?

1

There are 1 answers

1
m13op22 On BEST ANSWER

The best way is to check their documentation, which lists all their linear models on the website. This should be the first place to look because it provides in-depth explanations and examples for each model.

Alternatively, if you want to load it in Python, use the dir function to list all the properties and methods of linear_model.

from sklearn import linear_model

print(dir(linear_model))

['ARDRegression', 'BayesianRidge', 'ElasticNet', 'ElasticNetCV', 
'GammaRegressor', 'Hinge', 'Huber', 'HuberRegressor', 'Lars', 'LarsCV',
 'Lasso', 'LassoCV', 'LassoLars', 'LassoLarsCV', 'LassoLarsIC',
'LinearRegression', 'Log', 'LogisticRegression', 'LogisticRegressionCV', 
'ModifiedHuber', 'MultiTaskElasticNet', 'MultiTaskElasticNetCV', 
'MultiTaskLasso', 'MultiTaskLassoCV', 'OrthogonalMatchingPursuit',
 'OrthogonalMatchingPursuitCV', 'PassiveAggressiveClassifier',
 'PassiveAggressiveRegressor', 'Perceptron', 'PoissonRegressor', 
'QuantileRegressor', 'RANSACRegressor', 'Ridge', 'RidgeCV', 'RidgeClassifier',
 'RidgeClassifierCV', 'SGDClassifier', 'SGDOneClassSVM', 'SGDRegressor', 
'SquaredLoss', 'TheilSenRegressor', 'TweedieRegressor', '__all__', 
'__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__',
 '__package__', '__path__', '__spec__', '_base', '_bayes', '_cd_fast', 
'_coordinate_descent', '_glm', '_huber', '_least_angle', '_linear_loss', 
'_logistic', '_omp', '_passive_aggressive', '_perceptron', '_quantile', 
'_ransac', '_ridge', '_sag', '_sag_fast', '_sgd_fast', '_stochastic_gradient',
 '_theil_sen', 'enet_path', 'lars_path', 'lars_path_gram', 'lasso_path', 
'orthogonal_mp', 'orthogonal_mp_gram', 'ridge_regression']

However, using dir returns more than just the different models, it returns all the properties and methods. Without more context from the docs, what's the difference between Ridge and ridge_regression?

Tldr; check the documentation on the website.