Skip to content

Commit

Permalink
OPS with PDIS/SNPDIS
Browse files Browse the repository at this point in the history
  • Loading branch information
antoine-galataud committed Apr 22, 2024
1 parent c1a9a2b commit 6adb65b
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions tests/test_evaluation.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import unittest

import numpy as np

from hopes.ope.estimators import (
InverseProbabilityWeighting,
SelfNormalizedInverseProbabilityWeighting,
SelfNormalizedTrajectoryWiseImportanceSampling,
TrajectoryWiseImportanceSampling,
)
from hopes.ope.estimators import *
from hopes.ope.evaluation import OffPolicyEvaluation
from hopes.ope.selection import OffPolicySelection
from hopes.policy import ClassificationBasedPolicy, RandomPolicy
Expand Down Expand Up @@ -66,6 +59,7 @@ def test_ops(self):
obs = np.random.rand(num_samples, num_obs)
act = np.random.randint(num_actions, size=num_samples)
rew = np.random.normal(10, 2.0, num_samples)
gamma = 0.99

# create the behavior policy
behavior_policy = ClassificationBasedPolicy(
Expand All @@ -86,10 +80,16 @@ def test_ops(self):
InverseProbabilityWeighting(),
SelfNormalizedInverseProbabilityWeighting(),
TrajectoryWiseImportanceSampling(
steps_per_episode=steps_per_episode, discount_factor=0.99
steps_per_episode=steps_per_episode, discount_factor=gamma
),
SelfNormalizedTrajectoryWiseImportanceSampling(
steps_per_episode=steps_per_episode, discount_factor=0.99
steps_per_episode=steps_per_episode, discount_factor=gamma
),
PerDecisionImportanceSampling(
steps_per_episode=steps_per_episode, discount_factor=gamma
),
SelfNormalizedPerDecisionImportanceSampling(
steps_per_episode=steps_per_episode, discount_factor=gamma
),
]

Expand Down

0 comments on commit 6adb65b

Please sign in to comment.