From 79394dfbf03880d535e94feb35a1df5ea0f0ddce Mon Sep 17 00:00:00 2001 From: JuiP Date: Sat, 27 Feb 2021 01:02:40 +0530 Subject: [PATCH 1/7] Structure package Add requirements.txt back --- estimators/__init__.py | 0 basic-usage.py => estimators/basic-usage.py | 0 cressieread.py => estimators/cressieread.py | 0 ds_parse.py => estimators/ds_parse.py | 0 ips_snips.py => estimators/ips_snips.py | 0 mle.py => estimators/mle.py | 0 .../pseudo_inverse.py | 0 .../test_pi.cpython-36-pytest-6.2.2.pyc | Bin 0 -> 1891 bytes {test => estimators/test}/test_pi.py | 0 setup.py | 25 ++++++++++++++++++ 10 files changed, 25 insertions(+) create mode 100644 estimators/__init__.py rename basic-usage.py => estimators/basic-usage.py (100%) rename cressieread.py => estimators/cressieread.py (100%) rename ds_parse.py => estimators/ds_parse.py (100%) rename ips_snips.py => estimators/ips_snips.py (100%) rename mle.py => estimators/mle.py (100%) rename pseudo_inverse.py => estimators/pseudo_inverse.py (100%) create mode 100644 estimators/test/__pycache__/test_pi.cpython-36-pytest-6.2.2.pyc rename {test => estimators/test}/test_pi.py (100%) create mode 100644 setup.py diff --git a/estimators/__init__.py b/estimators/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/basic-usage.py b/estimators/basic-usage.py similarity index 100% rename from basic-usage.py rename to estimators/basic-usage.py diff --git a/cressieread.py b/estimators/cressieread.py similarity index 100% rename from cressieread.py rename to estimators/cressieread.py diff --git a/ds_parse.py b/estimators/ds_parse.py similarity index 100% rename from ds_parse.py rename to estimators/ds_parse.py diff --git a/ips_snips.py b/estimators/ips_snips.py similarity index 100% rename from ips_snips.py rename to estimators/ips_snips.py diff --git a/mle.py b/estimators/mle.py similarity index 100% rename from mle.py rename to estimators/mle.py diff --git a/pseudo_inverse.py b/estimators/pseudo_inverse.py similarity index 100% rename from pseudo_inverse.py rename to estimators/pseudo_inverse.py diff --git a/estimators/test/__pycache__/test_pi.cpython-36-pytest-6.2.2.pyc b/estimators/test/__pycache__/test_pi.cpython-36-pytest-6.2.2.pyc new file mode 100644 index 0000000000000000000000000000000000000000..55c05645d14718ddee49995bdde9d2f2b5747a03 GIT binary patch literal 1891 zcma)6O^72!6t3z{I!ULK%+8E6qj>1UEKWc&llk3+ak8Q-EXc4h;6kIcovE5kXFJ`! zRh`|<*nKg35`^)ncmT#=G4@hx>F|_(H|kFLGTf37A_zXIy{yr#}%L&&>KMfBaBdj`gn{olxT`$ zf{FGBWv~Y+kRma9g-jsJv`PiO0m?)xtgJVF{_YzW~PUxg2hVb zWS2g~WT}9%3Xlm@1+su@K=rI~@9jH?EJ3eU&N{bm+59vb2E^`Co8BAx_q~9IiJe6D zt=mWTgHsyX$th*j_PHH}!N~S(?uWgA+B}GoV-4CWhvf3I9RcxGfCQz`fE6f#Y_Ob- z@v_uHddp}L-IbR`KkR+{_cves^TXE%7jQLD6ARtz@}?%RCvf*m#0=0reP#VL8qoFr z&|iP&&N}6ZKk$->@%02`1#axO;*lut2i~Adyo0Jt0|=e%Ngp>)*_A1StNZMrZW6hE z%v<|GbnFHE0EB#p-e;f6anb3?Z4ml(D*Vxzn11Z^w$yk$)%-ry{MPCH{F5AiO-aVMg`B8Y2v51KU_atI)Cn0Jac%heorFn(P z{~oJLumBt*c7v$Lol@+^j1mwSec&+=ipnA|lRnbsRAr+1z1W$%xZKFd>X@2NMILkZFpSO3?Gk*<6V0BL0mpJrkBw3qQbu44lgP#NWD0{;rt z5qk-In{%Q(EkBzFg?Q1;Yv0Nfhr+d>D$Gxy;Fl^PD=0.9'], + tests_require=['pytest'], + python_requires=">=3.6", +) \ No newline at end of file From a7993ef24d3ed00b812f421e15ffce86e8f87534 Mon Sep 17 00:00:00 2001 From: JuiP Date: Mon, 24 May 2021 18:51:15 +0530 Subject: [PATCH 2/7] Estimator for CATS added to package --- cats_utils.py => estimators/cats_utils.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename cats_utils.py => estimators/cats_utils.py (100%) diff --git a/cats_utils.py b/estimators/cats_utils.py similarity index 100% rename from cats_utils.py rename to estimators/cats_utils.py From 2ea078d2da7032ac284408466d1f56e5aa5fa301 Mon Sep 17 00:00:00 2001 From: JuiP Date: Mon, 31 May 2021 10:42:08 +0530 Subject: [PATCH 3/7] Added gitignore --- .gitignore | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2d981b1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +#Jupyter notebook checkpoints +**/.ipynb_checkpoints/* + +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class +*.egg-info + +# Python build artifacts +build/ +dist/ + +#ignored examples files +examples/*.log + +# Editors +.vscode/ +.idea/ + +# Type checking +.mypy_cache + +.coverage From 37aa0f76dbdfac3b1e7bc42508471ebd025be31f Mon Sep 17 00:00:00 2001 From: JuiP Date: Mon, 31 May 2021 20:45:36 +0530 Subject: [PATCH 4/7] Make folders --- estimators/contextual_bandits/__init__.py | 0 .../{ => contextual_bandits}/cats_utils.py | 0 .../{ => contextual_bandits}/cressieread.py | 0 estimators/{ => contextual_bandits}/ips_snips.py | 0 estimators/{ => contextual_bandits}/mle.py | 0 estimators/slates/__init__.py | 0 estimators/{ => slates}/pseudo_inverse.py | 0 .../test_pi.cpython-36-pytest-6.2.2.pyc | Bin 1891 -> 0 bytes 8 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 estimators/contextual_bandits/__init__.py rename estimators/{ => contextual_bandits}/cats_utils.py (100%) rename estimators/{ => contextual_bandits}/cressieread.py (100%) rename estimators/{ => contextual_bandits}/ips_snips.py (100%) rename estimators/{ => contextual_bandits}/mle.py (100%) create mode 100644 estimators/slates/__init__.py rename estimators/{ => slates}/pseudo_inverse.py (100%) delete mode 100644 estimators/test/__pycache__/test_pi.cpython-36-pytest-6.2.2.pyc diff --git a/estimators/contextual_bandits/__init__.py b/estimators/contextual_bandits/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/estimators/cats_utils.py b/estimators/contextual_bandits/cats_utils.py similarity index 100% rename from estimators/cats_utils.py rename to estimators/contextual_bandits/cats_utils.py diff --git a/estimators/cressieread.py b/estimators/contextual_bandits/cressieread.py similarity index 100% rename from estimators/cressieread.py rename to estimators/contextual_bandits/cressieread.py diff --git a/estimators/ips_snips.py b/estimators/contextual_bandits/ips_snips.py similarity index 100% rename from estimators/ips_snips.py rename to estimators/contextual_bandits/ips_snips.py diff --git a/estimators/mle.py b/estimators/contextual_bandits/mle.py similarity index 100% rename from estimators/mle.py rename to estimators/contextual_bandits/mle.py diff --git a/estimators/slates/__init__.py b/estimators/slates/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/estimators/pseudo_inverse.py b/estimators/slates/pseudo_inverse.py similarity index 100% rename from estimators/pseudo_inverse.py rename to estimators/slates/pseudo_inverse.py diff --git a/estimators/test/__pycache__/test_pi.cpython-36-pytest-6.2.2.pyc b/estimators/test/__pycache__/test_pi.cpython-36-pytest-6.2.2.pyc deleted file mode 100644 index 55c05645d14718ddee49995bdde9d2f2b5747a03..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1891 zcma)6O^72!6t3z{I!ULK%+8E6qj>1UEKWc&llk3+ak8Q-EXc4h;6kIcovE5kXFJ`! zRh`|<*nKg35`^)ncmT#=G4@hx>F|_(H|kFLGTf37A_zXIy{yr#}%L&&>KMfBaBdj`gn{olxT`$ zf{FGBWv~Y+kRma9g-jsJv`PiO0m?)xtgJVF{_YzW~PUxg2hVb zWS2g~WT}9%3Xlm@1+su@K=rI~@9jH?EJ3eU&N{bm+59vb2E^`Co8BAx_q~9IiJe6D zt=mWTgHsyX$th*j_PHH}!N~S(?uWgA+B}GoV-4CWhvf3I9RcxGfCQz`fE6f#Y_Ob- z@v_uHddp}L-IbR`KkR+{_cves^TXE%7jQLD6ARtz@}?%RCvf*m#0=0reP#VL8qoFr z&|iP&&N}6ZKk$->@%02`1#axO;*lut2i~Adyo0Jt0|=e%Ngp>)*_A1StNZMrZW6hE z%v<|GbnFHE0EB#p-e;f6anb3?Z4ml(D*Vxzn11Z^w$yk$)%-ry{MPCH{F5AiO-aVMg`B8Y2v51KU_atI)Cn0Jac%heorFn(P z{~oJLumBt*c7v$Lol@+^j1mwSec&+=ipnA|lRnbsRAr+1z1W$%xZKFd>X@2NMILkZFpSO3?Gk*<6V0BL0mpJrkBw3qQbu44lgP#NWD0{;rt z5qk-In{%Q(EkBzFg?Q1;Yv0Nfhr+d>D$Gxy;Fl^PD Date: Mon, 31 May 2021 22:43:59 +0530 Subject: [PATCH 5/7] Add init files and import changes due to restructuring --- estimators/basic-usage.py | 8 ++++---- estimators/test/__init__.py | 0 estimators/test/test_pi.py | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 estimators/test/__init__.py diff --git a/estimators/basic-usage.py b/estimators/basic-usage.py index 51221ac..41dace9 100644 --- a/estimators/basic-usage.py +++ b/estimators/basic-usage.py @@ -1,9 +1,9 @@ import argparse, os, gzip -import cressieread -import ips_snips -import mle +from contextual_bandits import cressieread +from contextual_bandits import ips_snips +from contextual_bandits import mle import ds_parse -import cats_utils +from contextual_bandits import cats_utils def compute_estimates(log_fp, cats_transformer=None): diff --git a/estimators/test/__init__.py b/estimators/test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/estimators/test/test_pi.py b/estimators/test/test_pi.py index f9d3838..1fe09e5 100644 --- a/estimators/test/test_pi.py +++ b/estimators/test/test_pi.py @@ -1,9 +1,9 @@ import os, sys sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) -import pseudo_inverse -import ips_snips -import cats_utils +from slates import pseudo_inverse +from contextual_bandits import ips_snips +from contextual_bandits import cats_utils def test_single_slot_pi_equivalent_to_ips(): """PI should be equivalent to IPS when there is only a single slot""" From 024f759cd9bc6a7a6d50530ca6fad2e624e6ca6d Mon Sep 17 00:00:00 2001 From: JuiP Date: Fri, 4 Jun 2021 19:12:50 +0530 Subject: [PATCH 6/7] Add utils folder and fix imports --- estimators/basic-usage.py | 2 +- estimators/utils/__init__.py | 0 estimators/{ => utils}/ds_parse.py | 0 3 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 estimators/utils/__init__.py rename estimators/{ => utils}/ds_parse.py (100%) diff --git a/estimators/basic-usage.py b/estimators/basic-usage.py index 41dace9..de7383f 100644 --- a/estimators/basic-usage.py +++ b/estimators/basic-usage.py @@ -2,7 +2,7 @@ from contextual_bandits import cressieread from contextual_bandits import ips_snips from contextual_bandits import mle -import ds_parse +from utils import ds_parse from contextual_bandits import cats_utils diff --git a/estimators/utils/__init__.py b/estimators/utils/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/estimators/ds_parse.py b/estimators/utils/ds_parse.py similarity index 100% rename from estimators/ds_parse.py rename to estimators/utils/ds_parse.py From 61eb892b68264b3493ed4c426c00a2febc21b049 Mon Sep 17 00:00:00 2001 From: JuiP Date: Mon, 7 Jun 2021 22:41:48 +0530 Subject: [PATCH 7/7] List as packages in setup.py --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index b7c8393..e694753 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setuptools.setup( name="vw-estimators", version="0.0.1", - description="Python package of estimators to perform off-policy evaluation ", + description="Python package of estimators to perform off-policy evaluation", long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/VowpalWabbit/estimators.git", @@ -18,7 +18,7 @@ "Operating System :: OS Independent", "Topic :: Scientific/Engineering" ], - packages=["estimators"], + packages=["estimators", "estimators.contextual_bandits", "estimators.slates", "estimators.utils"], install_requires= ['scipy>=0.9'], tests_require=['pytest'], python_requires=">=3.6",