Skip to content

Commit 4409cc8

Browse files
authored
Merge pull request #26 from CyberAgentAILab/doc/multi-task
Add a guide for multi-task learning
2 parents 7ef2a5c + f83ff96 commit 4409cc8

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Overview
22

3-
This a Python package for building the regression adjusted distribution function estimator proposed in "Estimating Distributional Treatment Effects in Randomized Experiments: Machine Learning for Variance Reduction". For the details of this package, see [the documentation](https://cyberagentailab.github.io/python-dte-adjustment/).
3+
`dte_adj` is a Python package for estimating distribution treatment effects. It provides APIs for conducting regression adjustment to estimate precise distribution functions as well as convenient utils. For the details of this package, see [the documentation](https://cyberagentailab.github.io/python-dte-adjustment/).
44

55
## Installation
66

docs/source/get_started.rst

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ A convenience function is available to visualize distribution effects. This meth
8181
:align: center
8282

8383
To initialize the adjusted distribution function, the base model for conditional distribution function needs to be passed.
84-
In the following example, we use Logistic Regression. Please make sure that your base model implements `fit` and `predict_proba` methods.
84+
In the following example, we use Logistic Regression. Please make sure that your base model implements ``fit`` and ``predict_proba`` methods.
8585

8686
.. code-block:: python
8787
@@ -117,7 +117,7 @@ Confidence bands can be computed in different ways. In the following code, we us
117117
:width: 450px
118118
:align: center
119119

120-
Also, an uniform confidence band is used when "uniform" is specified for the "variance_type" argument.
120+
Also, an uniform confidence band is used when ``uniform`` is specified for the ``variance_type`` argument.
121121

122122
.. code-block:: python
123123
@@ -130,7 +130,7 @@ Also, an uniform confidence band is used when "uniform" is specified for the "va
130130
:width: 450px
131131
:align: center
132132

133-
To compute PTE, we can use "predict_pte" method.
133+
To compute PTE, we can use ``predict_pte`` method.
134134

135135
.. code-block:: python
136136
@@ -143,7 +143,7 @@ To compute PTE, we can use "predict_pte" method.
143143
:width: 450px
144144
:align: center
145145

146-
To compute QTE, we use "predict_qte" method. The confidence band is computed by bootstrap method.
146+
To compute QTE, we use ``predict_qte`` method. The confidence band is computed by bootstrap method.
147147

148148
.. code-block:: python
149149
@@ -157,11 +157,23 @@ To compute QTE, we use "predict_qte" method. The confidence band is computed by
157157
:width: 450px
158158
:align: center
159159

160-
You can use any model with "predict_proba" or "predict" method to adjust the distribution function estimation. For example, the following code use XGBoost classifier to estimate the conditional distribution.
160+
You can use any model with ``predict_proba`` or ``predict`` method to adjust the distribution function estimation.
161+
For example, the following code use XGBoost classifier to estimate the conditional distribution.
161162

162163
.. code-block:: python
163164
164165
import xgboost as xgb
165166
estimator = dte_adj.AdjustedDistributionEstimator(xgb.XGBClassifier(), folds=3)
166167
estimator.fit(X, D, Y)
167-
cdf = estimator.predict(1, locations)
168+
cdf = estimator.predict(1, locations)
169+
170+
``predict_dte`` and ``predict_pte`` methods provide an option to train a model for multiple locations simultaneously.
171+
To enable the feature, pass ``is_multi_task=True``.
172+
173+
.. code-block:: python
174+
175+
from sklearn.linear_model import LinearRegression
176+
model = LinearRegression()
177+
estimator = dte_adj.AdjustedDistributionEstimator(model, folds=3)
178+
estimator.fit(X, D, Y)
179+
dte, lower_bound, upper_bound = estimator.predict_dte(target_treatment_arm=1, control_treatment_arm=0, is_multi_task=True, locations=locations, variance_type="moment")

0 commit comments

Comments
 (0)