Skip to content

Conversation

tic66777
Copy link
Contributor

What does this PR do?

Because the probability estimation function of tree-based method is not appropriate, this PR implements a tunable sigmoid function that can give better probability estimation.

Test CLI & API (bash tests/autotest.sh)

Test APIs used by main.py.

  • Test Pass
    • (Copy and paste the last outputted line here.)
  • Not Applicable (i.e., the PR does not include API changes.)

Check API Document

If any new APIs are added, please check if the description of the APIs is added to API document.

  • API document is updated (linear, nn)
  • Not Applicable (i.e., the PR does not include API changes.)

Test quickstart & API (bash tests/docs/test_changed_document.sh)

If any APIs in quickstarts or tutorials are modified, please run this test to check if the current examples can run correctly after the modified APIs are released.

@tic66777 tic66777 requested review from cjlin1 and a team as code owners July 11, 2025 13:24
self.estimator = self.sigmoid_A
self.estimator_parameter = 3

def exp_L2(self, x):
Copy link
Contributor

@chcwww chcwww Jul 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I came up with an idea that we could mimic how we handled LINEAR_TECHNIQUES by using a dict like

ESTIMATORS = {
    "exp-L1": lambda x, _: np.maximum(0, 1 - x),
    "exp-L2": lambda x, _: np.square(np.maximum(0, 1 - x)),
    "sigmoid-A": lambda x, param: -log_expit(param * x),
}

in the linear/utils.py.
And implement the estimator using a functor like this:

class Estimator:
    def __init__(self, estimation_function: str, estimation_parameter: int = None):
        self.estimation_function = ESTIMATORS[estimation_function]
        self.estimation_parameter = estimation_parameter

    def __call__(self, x):
        return self.estimation_function(x, self.estimation_parameter)

Would that be cool?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants