Skip to content

Regression Multi‐label classification

Saman .E edited this page Jul 9, 2023 · 1 revision
from cgb import cgb_reg
import sklearn.datasets as dts
from sklearn.model_selection import train_test_split

seed = 1

X, y = dts.make_regression(n_samples=100,
                           n_features=100,
                           n_targets=3,
                           random_state=seed)
                         
                         
x_train, x_test, y_train, y_test = train_test_split(X, y,
                                                    test_size=0.3, 
                                                    random_state=seed)


model = cgb_reg(learning_rate=0.1,
                subsample=1,
                loss='ls',
                max_features="sqrt",
                n_estimators=100,
                max_depth=3,
                random_state=seed)

model.fit(x_train, y_train)
model.predict(x_test)
model.score(x_test, y_test)

Return the RMSE for n_outputs

array([164.36658903, 101.0311495 , 166.13994623])
Clone this wiki locally