Coder Social home page Coder Social logo

Comments (6)

BochenLv avatar BochenLv commented on May 20, 2024

Hi,

Thanks for the question. The goal of policy optimization is to find the specific treatment that maximizes the causal effect among all possible treatment values, thus $\mathcal{Y}$ should be the causal effects and $\mathcal{X}$ should include possible treatments.

As for the fit() function, first you need to provide a data, then:

  • $\mathcal{Y}$ can be given in 3 different ways by specifying effect (string, name of the causal effects in your data), or effect_array (an additional array of causal effect) if your data does not include causal effects directly, or, if you don't have the calculated causal effects, providing an est_model (must be trained), which will then be used to calculate the causal effects.
  • $\mathcal{X}$ needs not be given since the information has already included in the causal effects when specifying $\mathcal{Y}$.
  • $\mathcal{S}$ should include all the other relevant variables in your data and is given by covariate (names of these relevant variables in your data)

from ylearn.

zhj2022 avatar zhj2022 commented on May 20, 2024

Hi,

Thanks for the question. The goal of policy optimization is to find the specific treatment that maximizes the causal effect among all possible treatment values, thus Y should be the causal effects and X should include possible treatments.

As for the fit() function, first you need to provide a data, then:

* Y can be given in 3 different ways by specifying `effect` (string, name of the causal effects in your data), or `effect_array` (an additional array of causal effect) if your data does not include causal effects directly, or, if you don't have the calculated causal effects, providing an `est_model` (must be trained), which will then be used to calculate the causal effects.

* X needs not be given since the information has already included in the causal effects when specifying Y.

* S should include all the other relevant variables in your data and is given by `covariate` (names of these relevant variables in your data)

Thanks for your reply!

In the example given in the doc, the array $y$, which is taken by the argument effect_array, has two columns. Does the first column stands for $\mathcal{X}$ while the second column stands for $\mathcal{Y}$? And if effect_array takes an array which contains more than two columns, how does $\mathcal{X}$ and $\mathcal{Y}$ represented respectively? And I'm also confused about the meaning of the return value which is a (1000, ) array.

from ylearn.

BochenLv avatar BochenLv commented on May 20, 2024

The shape of an allowed effect_array (usually a numpy array) should be $(N, J)$, where $N$ is the number of examples in your data and $J$ is the number of possible treatment values. In this way, the $(n,j)$ element of a given effect_array indicates that the causal effect of taking the $j$-th treatment on the $n$-th example is effect_array[n, j].

Specifically, for the example provided in the doc,

  • Does the first column stands for $\mathcal{X}$ while the second column stands for $\mathcal{Y}$?

    No. As stated in the early reply, there is no need to provide $\mathcal{X}$. The first column indicates the causal effect of taking treatment 0 while the second column for treatment 1, i.e., both columns correspond to $\mathcal{Y}$.

  • And if effect_array takes an array which contains more than two columns, how does...

    Please see the comment above.

  • ... meaning of the return value which is ...

    The returned array, say a numpy array R, means that which value of the treatment should be taken on each example to obtain the best causal effect for it, thus the shape $(N, )$, e.g, R[n,] = 1 means that taking treatment 1 would lead to the best causal effect for the $n$-th example.

from ylearn.

zhj2022 avatar zhj2022 commented on May 20, 2024

Thanks, I can understand what it means by specifying effect_array.
In the case where I don't have all the treatment effects, for example, for $i$-th example I only have treatment effect for treatment 1 while for $j$-th example I only have treatment 2, how should I specify the argument effect_array?

from ylearn.

BochenLv avatar BochenLv commented on May 20, 2024

The important thing is that you need the full set of treatment effects to apply an optimization of the policy, since you are actually selecting the suitable treatment values when optimizing the policy. That said, if you only have the treatment effect for treatment 1 then there is no information on how to make the selection, thus the training of the policy tree is not feasible.

If you don't have the calculated effect_array, then you can simply use a trained est_model (any kinds of estimator_model provided by YLearn) and pass it as an argument to the fit method of the policy_tree (the fit method will automatically calculate the effect).

from ylearn.

zhj2022 avatar zhj2022 commented on May 20, 2024

Okay, your explanation is quite clear! Thanks!

from ylearn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.