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

lightgbm cv #2871

Closed
Solly7 opened this issue Mar 5, 2020 · 1 comment
Closed

lightgbm cv #2871

Solly7 opened this issue Mar 5, 2020 · 1 comment

Comments

@Solly7
Copy link

Solly7 commented Mar 5, 2020

Summary

Hi i nee help, still new in machine learning and willing to learn.

I am using lightgbm cv and i need to be able to print out my best AUC score on an each every fold using lgb cv without doing parameter tuning.
i.e fold 1 AUC : 81.2
fold 2 AUc : 83
......
Currently i only see AUC mean per iteration from my cv_results. See my code Below

params = {
'objective': 'binary',
'boosting': 'gbdt',
'max_depth':-1,
'num_leaves': 31, # 2^max_depth - 1
'learning_rate': 0.1,
'min_data_in_leaf':20,
'min_child_samples': 20,
'min_child_weight':0.001,
'verbose': 0,
}

params['metric'] = 'auc'
num_rounds = 5000

lgtrain = lgb.Dataset(train, label=labelTrain)
lgvalid = lgb.Dataset(test, label=labelTest,reference=lgtrain)

#replace this with cv only
cv_results = lgb.cv(params,
lgtrain,
nfold=5,
stratified=False ,
num_boost_round = num_rounds,
early_stopping_rounds = 10, metrics = {'auc'},
seed = 50)

cv_results = pd.DataFrame(cv_results)
cv_results.to_csv('cv_results.csv')

Best_rounds =np.argmax((cv_results['auc-mean']))
best_score = max(cv_results['auc-mean'])

@StrikerRUS
Copy link
Collaborator

@Solly7

I am using lightgbm cv and i need to be able to print out my best AUC score on an each every fold using lgb cv without doing parameter tuning.

Unfortunately, it is not possible yet. We already have some feature requests regarding this: #2105, #283. You can comment there with description of desired behavior you want to see in LightGBM.

Also, as I said earlier, as for novice I'd strongly recommend to switch to scikit-learn wrapper and their great tools which make life easier.

@lock lock bot locked as resolved and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants