废话少说,上代码!
回归
from sklearn.datasets import make_regression
from sklearn.model_selection import train_test_split
x, y = make_regression(n_samples=200, n_features=5, noise=0.1)
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.3, random_state=False)
from lazypredict.Supervised import LazyRegressor
reg = LazyRegressor(ignore_warnings=False, custom_metric=None)
models, predictions = reg.fit(x_train, x_test, y_train, y_test)
print(models)
print(predictions)
分类
from sklearn.datasets import make_blobs
from sklearn.model_selection import train_test_split
x, y = make_blobs(n_features=4, n_samples=200, centers=5, random_state=3, cluster_std=[0.8, 2, 0.5, 0.4, 0.1])
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.3, random_state=False)
from lazypredict.Supervised import LazyClassifier
clf = LazyClassifier(verbose=0, ignore_warnings=True, custom_metric=None)
models, predictions = clf.fit(x_train, x_test, y_train, y_test)
print(models)
print(predictions)