Skip to content

reset_learning_rate callback: 'NoneType' object has no attribute 'set_param' #2971

@hmishra2250

Description

@hmishra2250

Environment info

Operating System: Ubuntu 16.04 LTS

Compiler:

Package used (python/R/jvm/C++): python

xgboost version used: 0.6

Steps to reproduce

  1. Define custom learning rate function or provide as list to xgboost.cv method. Attaching the error snippet as image.
    image

  2. The exact code snippet is

xgtest = xgb.DMatrix(x_test)

def get_learning_rate(i, n):
    if i<=1000:
        return 0.01
    return 0.001

lrl = [1]*5000
for i in range(5000):
        lrl[i] = 0.01 if i<=1000 else 0.00

res = xgb.cv(params, xgtrain, num_boost_round=5000, nfold=5, 
             early_stopping_rounds=50, maximize=False, 
             callbacks=[xgb.callback.reset_learning_rate(lrl)]) 

What have you tried?

  1. Read the source code of callbacks.py and it turns out that cvpack object in env.cvfolds is getting to be None
  2. Searched through all the issues in this repository and stackoverflow, and couldn't find a similar one, t the best of my reach.

I hope I am doing everything correct, hence I would appreciate feedback if its some bug or human error. Thanks in Advance and cheers 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions