Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Clarify perfs of ObliqueDTPolicy compared to DTPolicy #6

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -71,7 +71,7 @@ with open("tree_halfcheetah.pkl", "rb") as f:
clf = load(f)
# Render
evaluate_policy(
DTPolicy(clf, env),
ObliqueDTPolicy(clf, env),
env=Monitor(gym.make("HalfCheetah-v4", render_mode="human")),
render=True,
)
2 changes: 1 addition & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ Main functions
:toctree: generated/
:template: function.rst

interpreter.interpreter.Interpreter.train
interpreter.Interpreter.train
interpreter.policies.ObliqueDTPolicy.get_oblique_data


2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
project = "interpreter"
copyright = "2024, Hector Kohler"
author = "Hector Kohler"
release = "0.1.1"
release = "0.1.2"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
2 changes: 1 addition & 1 deletion docs/usage.md
Original file line number Diff line number Diff line change
@@ -56,7 +56,7 @@ with open("tree_halfcheetah.pkl", "rb") as f:
clf = load(f)
# Render
evaluate_policy(
DTPolicy(clf, env),
ObliqueDTPolicy(clf, env),
env=Monitor(gym.make("HalfCheetah-v4", render_mode="human")),
render=True,
)
2 changes: 1 addition & 1 deletion interpreter/interpreter.py
Original file line number Diff line number Diff line change
@@ -79,7 +79,7 @@ def train(self, nb_iter):
print("Fitting tree nb {} ...".format(t + 1))
S_new, A_new = self.tree_policy.generate_data(self.env, self.data_per_iter)
S = np.concatenate((S, S_new))
A = np.concatenate((A, A_new))
A = np.concatenate((A, self.oracle.predict(S_new)[0]))

self.tree_policy.fit_tree(S, A)
tree_reward, _ = evaluate_policy(self.tree_policy, self.env)
2 changes: 1 addition & 1 deletion interpreter/policies.py
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ def generate_data(self, env, nb_data):
)
if isinstance(env.action_space, gym.spaces.Discrete):
assert env.action_space.n == self.action_space.n
A = np.zeros((nb_data, 1))
A = np.zeros((nb_data))
elif isinstance(env.action_space, gym.spaces.Box):
assert env.action_space.shape == self.action_space.shape
A = np.zeros((nb_data, self.action_space.shape[0]))
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from setuptools import setup, find_packages

__version__ = "0.1.1"
__version__ = "0.1.2"

packages = find_packages(
exclude=[
Loading