question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question on example for adding a recourse method

See original GitHub issue

Hi there!

I have a few (3) questions about how to add a new recourse method

  1. In your notebook example, there is:
def get_counterfactuals(self, factuals: pd.DataFrame):
      # this property is responsible to generate and output
      # encoded and scaled counterfactual examples
      # as pandas DataFrames
      return counterfactual_examples

I wonder what you mean exactly by encoded and scaled. Does that mean that they should follow the same encoding of factuals? Moreover, should there be exactly 1 counterfactual example per given factual? (I assume that factuals is a collection of points for which a counterfactual is needed).

  1. I see you test the counterfactuals according to 4 distance functions. Do we have info on what distance function is used when the get_counterfactuals is called? I can imagine that you’d wish your recourse method to optimize for the distance that is ultimately used for evaluation.

  2. Is there a way for the recourse method to know what is the range of variability of a feature? E.g., min and max for numerical features based on the training set, and the categorical possibilities for categorical features. Otherwise, I can imagine the black box model could be given an invalid input while searching for the counterfactuals (a too high or too small number or a category that does not exist).

Forgive me if this info is explained somewhere else and I missed it, in which case I’d kindly ask you to point me to it.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
JohanvandenHeuvelcommented, May 30, 2022

I will close this issue now, but feel free to re-open if issue not fixed.

1reaction
JohanvandenHeuvelcommented, May 6, 2022

The idea is to keep the recourse method and the evaluation method separate, having a dynamically changed metric would go against this. It is possible to define a recourse methods with L1, evaluate it with L1, and repeat for L2. Having the metric depend on the recourse method, would force you to do this, and would make it more difficult to e.g. evaluate a L1 method using a L2 metric. So basically we don’t want to decide for the user how exactly they should do evaluation, but rather provide options to do so. As far as I know the above option you described is possible to do fairly easy by hand right now.

I don’t know if this is a satisfactory answer, and sorry for the late reply.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stochastic Programming - Recourse
To illustrate the method we use the example used for simple recourse. A product mix problem has four products and two resources. The...
Read more >
Recourse Definition
Recourse is the lender's legal right to collect the borrower's pledged collateral if the borrower does not pay their debt obligation.
Read more >
2.3 Recourse and nonrecourse notes to purchase stock
Entities may allow employees to purchase stock or exercise stock options in exchange for a note payable to the company.
Read more >
What is Recourse and Non-Recourse Factoring?
Recourse factoring – the most common kind of factoring. With a full recourse program, should your customer fail to pay an invoice within...
Read more >
The Pros and Cons of Recourse and Nonrecourse Patient ...
To answer that question, here are five steps for evaluating recourse versus nonrecourse patient financing. Discover what's best for the majority ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found