Skip to content

Commit

Permalink
update dir
Browse files Browse the repository at this point in the history
  • Loading branch information
samanemami committed Jun 9, 2022
1 parent 20545d6 commit 71728e9
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 6 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__all__=["ensemble"]
__all__=["cgb"]

4 changes: 4 additions & 0 deletions cgb/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .cgb import cgb_clf
from .cgb import cgb_reg

__all__ = ["cgb_clf", "cgb_reg"]
File renamed without changes.
3 changes: 0 additions & 3 deletions ensemble/__init__.py

This file was deleted.

1 change: 1 addition & 0 deletions test/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

52 changes: 50 additions & 2 deletions test/tets_clf.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,50 @@
#%%
from ensemble import cgb_clf
from sklearn.model_selection import train_test_split
from cgb import cgb_clf, cgb_reg
import sklearn.datasets as dt
import warnings

warnings.simplefilter("ignore")


def model(clf=True):

if clf:
X, y = dt.load_iris(return_X_y=True)

x_train, x_test, y_train, y_test = train_test_split(X,
y,
test_size=0.2)

model_ = cgb_clf(max_depth=5,
subsample=0.5,
max_features='sqrt',
learning_rate=0.05,
random_state=1,
criterion="mse",
loss="log_loss",
n_estimators=100)

else:
X, y = dt.make_regression(n_targets=3)

x_train, x_test, y_train, y_test = train_test_split(X,
y,
test_size=0.2)
model_ = cgb_reg(learning_rate=0.1,
subsample=1,
max_features="sqrt",
loss='ls',
n_estimators=100,
max_depth=3,
random_state=2)

model_.fit(x_train, y_train)
print(model_.score(x_test, y_test))


if __name__ == "__main__":
print('clf')
model(clf=True)
print('-----')
print('reg')
model(clf=False)

0 comments on commit 71728e9

Please sign in to comment.