Skip to content

Commit

Permalink
Improved documentation for example scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrucker committed May 16, 2024
1 parent 6f0d173 commit 39ed414
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
8 changes: 3 additions & 5 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
This directory contains a number of example experiments, scripts and jupyter notebooks.
# Examples

For all these examples it is assumed that the dependencies in environment.yml file have been installed.
This directory contains legacy examples.

If you are running locally the easiest way to install the dependencies is by using conda to create environment.yml.

If you are viewing this on the web you use this [link](https://mybinder.org/v2/gh/VowpalWabbit/Coba/HEAD?filepath=examples/notebooks) to start a Jupyter environment with all dependencies installed.
Many more examples can now be found in the [documentation](https://coba-docs.readthedocs.io/).
7 changes: 4 additions & 3 deletions examples/scripts/Custom Vowpal.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
"""
This is an example script that creates and executes an Experiment.
This script requires that the matplotlib and vowpalwabbit packages be installed.
This script creates and executes an Experiment with a custom namespace.
This script requires the matplotlib and vowpalwabbit package.
"""

import math
import coba as cb

class MakeCustomNamespaces:
Expand All @@ -17,6 +16,8 @@ def params(self):
return {"target": self.target, "parts": self.partitions}

def filter(self, interactions):
import math

n_parts = len(self.partitions)

for old in interactions:
Expand Down
4 changes: 2 additions & 2 deletions examples/scripts/Getting Started.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
This is an example script that creates and executes an Experiment.
This script depends on the matplotlib and vowpalwabbit packages.
This script creates and executes an Experiment.
This script requires the matplotlib and vowpalwabbit package.
"""

import coba as cb
Expand Down
6 changes: 6 additions & 0 deletions examples/scripts/Logged Results.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
"""
This script creates and executes an Experiment to generate logged data and then performs off-policy evaluation.
This script requires the matplotlib and vowpalwabbit package.
"""

import coba as cb

def main():
Expand All @@ -23,6 +28,7 @@ def main():
log = cb.Environments.from_result(filename)
lrn = cb.VowpalLearner("--cb_explore_adf --explore_eval")
val = cb.SequentialCB(learn='off',eval=False)

cb.Experiment(log, lrn, val).run()

# performance in the original online run
Expand Down
4 changes: 3 additions & 1 deletion examples/templates/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Templates

This directory contains two examples of environment template files.

Environment templates are a great way to share experiments with other researchers.

These files can be loaded via Environments.from_template("short_experiment.json").
Template files can be loaded via a call such as Environments.from_template("short.json").

0 comments on commit 39ed414

Please sign in to comment.