-
Notifications
You must be signed in to change notification settings - Fork 725
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dff978e
commit 221aec3
Showing
11 changed files
with
1,158 additions
and
966 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
|
||
__all__ = ["dml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. | ||
|
||
"""Double Machine Learning for Dynamic Treatment Effects. | ||
A Double/Orthogonal machine learning approach to estimation of heterogeneous | ||
treatment effect in the dynamic treatment regime. For the theoretical | ||
foundations of these methods see: [dynamicdml]_. | ||
References | ||
---------- | ||
.. [dynamicdml] Greg Lewis and Vasilis Syrgkanis. | ||
Double/Debiased Machine Learning for Dynamic Treatment Effects. | ||
`<https://arxiv.org/abs/2002.07285>`_, 2021. | ||
""" | ||
|
||
from ._dml import DynamicDML | ||
|
||
__all__ = ["DynamicDML"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
import numpy as np | ||
|
||
|
||
def long(x): | ||
""" | ||
Reshape panel data to long format, i.e. (n_units * n_periods, d_x) or (n_units * n_periods,) | ||
Parameters | ||
---------- | ||
x : array-like | ||
Panel data in wide format | ||
Returns | ||
------- | ||
arr : array-like | ||
Reshaped panel data in long format""" | ||
n_units = x.shape[0] | ||
n_periods = x.shape[1] | ||
if np.ndim(x) == 2: | ||
return x.reshape(n_units * n_periods) | ||
else: | ||
return x.reshape(n_units * n_periods, -1) | ||
|
||
|
||
def wide(x): | ||
"""Reshape panel data to wide format, i.e. (n_units, n_periods * d_x) or (n_units, n_periods,) | ||
Parameters | ||
---------- | ||
x : array-like | ||
Panel data in long format | ||
Returns | ||
------- | ||
arr : array-like | ||
Reshaped panel data in wide format""" | ||
n_units = x.shape[0] | ||
return x.reshape(n_units, -1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1,885 changes: 932 additions & 953 deletions
1,885
...ios/Case Study - Long-Term Return-on-Investment at Microsoft via Short-Term Proxies.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters