lightgbm ---- ValueError:检测到循环引用 [英] lightgbm ----ValueError: Circular reference detected

查看:123
本文介绍了lightgbm ---- ValueError:检测到循环引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将lightgbm导入为lgb
lgb_train = lgb.Dataset(x_train,y_train)
lgb_val = lgb.Dataset(x_test ,y_test)

import lightgbm as lgb lgb_train = lgb.Dataset(x_train, y_train) lgb_val = lgb.Dataset(x_test, y_test)

参数= {
'application':'binary',
'objective':'binary',
' metric':'auc',
'is_unbalance':'true',
'boosting':'gbdt',
'num_leaves':31,
'feature_fraction':0.5 ,
'bagging_fraction':0.5,
'bagging_freq':20,
'learning_rate':0.05,
'verbose':0
}

parameters = { 'application': 'binary', 'objective': 'binary', 'metric': 'auc', 'is_unbalance': 'true', 'boosting': 'gbdt', 'num_leaves': 31, 'feature_fraction': 0.5, 'bagging_fraction': 0.5, 'bagging_freq': 20, 'learning_rate': 0.05, 'verbose': 0 }

模型= lgb.train(参数,
train_data,
valid_sets = test_data,
num_boost_round = 5000,
early_stopping_rounds = 100)

model = lgb.train(parameters, train_data, valid_sets=test_data, num_boost_round=5000, early_stopping_rounds=100)

y_pred = model.predict(test_data)

y_pred = model.predict(test_data)

推荐答案

如果使用cut或qcut用于合并的函数,以后不进行编码(一次热编码,标签编码..)。这可能是导致错误的原因。尝试使用编码。

If you used cut or qcut functions for binning and did not encode later (one-hot encoding, label encoding ..). this may be the cause of the error. Try to use an encoding.

我希望它能起作用。

这篇关于lightgbm ---- ValueError:检测到循环引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆