Skip to content

[JVM-package] How could i use additional column just for object function calculation not for train #4920

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

Open
zhangjinrui2718 opened this issue Oct 9, 2019 · 2 comments

Comments

@zhangjinrui2718
Copy link

for example:
there is a column named pay_amount
it does not exist in feature column array but i want to use it in custom object function to calculate the precision or recall for the pay_amount

@trivialfis
Copy link
Member

I don't think that's possible. How does a tree predict unknown feature?

@zhangjinrui2718
Copy link
Author

zhangjinrui2718 commented Oct 10, 2019

I don't think that's possible. How does a tree predict unknown feature?

for example :
there is a table witch schema is
x1:double
x2:double
x3:double
c1:double
y:int
predict:int

we use x1 x2 x3 as feature columns and y as label column (binary classfication)
after training , we get predict column witch is the output of the xgboost-tree

finally we need evaluate the tree by calculating some indicators like:

sum(case when y = 1 and predict = 1 then c1 else 0 end) as sum_tp_c1
sum(case when predict = 1 then c1  else 0 end) as sum_c1

now we get the precision for c1 = sum_tp_c1/sum_c1

i find we could define custom object function and evaluate function by extendingObjectiveTrait and EvalTrait, i want to calculate precision for c1 to guide the tree splits

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

No branches or pull requests

2 participants