Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working on setup and train functionality #327

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

reed0824
Copy link
Collaborator

I've updated the setup() function, and added train/call/summary/test to the class. Any comments are welcome if you have time, Brian.

I have temporarily removed plotting functionality

@reed0824 reed0824 temporarily deployed to Integrate Pull Request March 30, 2023 18:20 — with GitHub Actions Inactive
@reed0824 reed0824 had a problem deploying to Integrate Pull Request March 30, 2023 18:20 — with GitHub Actions Failure
Copy link
Collaborator

@bfhealy bfhealy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @reed0824, here are some comments on your latest draft. In addition to the itemized recommendations, I suggest that future PRs come from a branch of your forked repo, rather than your main branch. To create a new branch called branchname in the command line, you can use git checkout -b branchname.

Comment on lines +29 to +32
def __init__(
self,
**kwargs,
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably can remove this __init__ method. setup will take care of all the initializations.

#
def summary(self, **kwargs):

model = xgb.train(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to use self.model here, in addition to any other places where you'd like to set an attribute (variable accessible by all the different methods in the XGB class).

Comment on lines +55 to +64
def setup(
self,
'max_depth':6,
'min_child_weight': 1,
'eta':.1,
'subsample': 0.7,
'colsample_bytree': 0.7,
'objective': 'binary:logistic',
'eval_metric': 'auc',
**kwargs,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I think this is a good way to initialize the model parameters.

Comment on lines +83 to +87
self.model.compile(
params =self.meta["params"],
train = self.dtrain,
test = self.dtest,
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see compile in the XGBoost notebook. Should it be included here or at all?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly not; I copied the same format as nn.py here and model.compile does not yet exist for xgb


def train(self,X_train, **kwargs):
dtrain = xgb.DMatrix(X_train, label=y_train)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good place to add something like self.model = xgb.train(...).


return dtrain

def test(self, X_test, **kwargs);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we need a separate test method. Perhaps it's best for now to define dtest like you do for dtrain within the train method, then pass it in to the call to xgb.train(...), e.g. using evals=[(dtest, "Test")]. You'd need to add Xtest as another argument to the train method.

@reed0824 reed0824 had a problem deploying to Integrate Pull Request April 2, 2023 22:16 — with GitHub Actions Failure
@reed0824 reed0824 had a problem deploying to Integrate Pull Request April 2, 2023 22:16 — with GitHub Actions Failure
@reed0824 reed0824 had a problem deploying to Integrate Pull Request April 2, 2023 22:43 — with GitHub Actions Failure
@reed0824 reed0824 had a problem deploying to Integrate Pull Request April 2, 2023 22:43 — with GitHub Actions Failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants