ShichenXie / scorecardpy

Scorecard Development in python, 评分卡
http://shichen.name/scorecard
MIT License
717 stars 301 forks source link

Can we use XGBRegressor? #95

Open hanzigs opened 1 year ago

hanzigs commented 1 year ago

Hi, The scorecard function param says "model: A LogisticRegression model object." image

can we use any regression model. like XGBRegressor with 'gblinear' booster?

ShichenXie commented 1 year ago

Support sklearn lr model object only.

hanzigs commented 1 year ago

Thanks for the reply,

Actually any linear model with coefficient attribute is working including xgb linear, like

model.coef_

I have tried these

from xgboost import XGBRegressor
xgb_fit = XGBRegressor(booster='gblinear')
xgb_model = xgb_fit.fit(X_train, y_train)
xgb_model.coef_

from sklearn.linear_model import LogisticRegression
lr_fit = LogisticRegression()
lr_model = lr_fit.fit(X_train, y_train)
lr_model.coef_

from sklearn.linear_model import SGDRegressor
SGD_fit = SGDRegressor()
SGD_model = SGD_fit.fit(X_train, y_train)
SGD_model.coef_

All these models can generate scorecard using scorecard function

card = scorecard(train_bins, lr_model, training_fields)

Thanks

autogluonisgod commented 1 year ago

'TabularPredictor' object has no attribute 'coef_', I want t ues autogluon to remould this scordcard,but this error is happen. So how should I do to solve this ?

autogluonisgod commented 1 year ago

'TabularPredictor' object has no attribute 'coef_', I want t ues autogluon to remould this scordcard,but this error is happen. So how should I do to solve this ?

ShichenXie commented 1 year ago

A new function scorecard2 is introduced, which requires binning from woebin function and x variable only.