Skip to content

Commit

Permalink
general refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
adzcai committed Sep 6, 2024
1 parent d25532d commit c0f946a
Show file tree
Hide file tree
Showing 21 changed files with 1,074 additions and 871 deletions.
16 changes: 9 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@ ENV_NAME = rlbook

RUN = micromamba run -n $(ENV_NAME)

_NOTEBOOKS = $(addprefix book/, intro bandits mdps fitted_dp control pg exploration)

NOTEBOOKS = $(addsuffix .md, $(_NOTEBOOKS))

IPYNBS = $(addsuffix .ipynb, $(_NOTEBOOKS))
_NOTEBOOKS = $(addprefix book/, bandits contextual_bandits control exploration fitted_dp imitation_learning mdps pg planning supervised_learning)

_META = \
appendix \
background \
bibliography \
challenges \
index

NOTEBOOKS = $(addsuffix .md, $(_NOTEBOOKS))

IPYNBS = $(addsuffix .ipynb, $(_NOTEBOOKS))

META = $(addsuffix .md, $(addprefix book/, $(_META)))

SOLUTIONS = book/solutions/bandits.py
Expand Down Expand Up @@ -50,3 +49,6 @@ lab:

lint:
$(RUN) ruff check --fix $(IPYNBS)

publish: book/_build/html
$(RUN) ghp-import --cname "rlbook.adzc.ai" --no-jekyll --push --force book/_build/html
13 changes: 7 additions & 6 deletions book/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ root: index.md
options:
numbered: true
chapters:
- file: intro.md
- file: bandits.md
- file: mdps.md
- file: fitted_dp.md
- file: control.md
- file: bandits.md
- file: supervised_learning.md
- file: fitted_dp.md
- file: pg.md
- file: exploration.md
- file: imitation_learning.md
# - file: challenges
# - file: appendix
- file: planning.md
- file: exploration.md
- file: contextual_bandits.md
- file: bibliography.md
- file: background.md
6 changes: 0 additions & 6 deletions book/appendix.md

This file was deleted.

37 changes: 37 additions & 0 deletions book/background.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
(background)=
# Appendix: Background

## O notation

Throughout this chapter and the rest of the book, we will describe the
asymptotic behavior of a function using $O$ notation.

For two functions $f(t)$ and $g(t)$, we say that $f(t) \le O(g(t))$ if
$f$ is asymptotically upper bounded by $g$. Formally, this means that
there exists some constant $C > 0$ such that $f(t) \le C \cdot g(t)$ for
all $t$ past some point $t_0$.

We say $f(t) < o(g(t))$ if asymptotically $f$ grows strictly slower than
$g$. Formally, this means that for *any* scalar $C > 0$, there exists
some $t_0$ such that $f(t) \le C \cdot g(t)$ for all $t > t_0$.
Equivalently, we say $f(t) < o(g(t))$ if
$\lim_{t \to \infty} f(t)/g(t) = 0$.

$f(t) = \Theta(g(t))$ means that $f$ and $g$ grow at the same rate
asymptotically. That is, $f(t) \le O(g(t))$ and $g(t) \le O(f(t))$.

Finally, we use $f(t) \ge \Omega(g(t))$ to mean that $g(t) \le O(f(t))$,
and $f(t) > \omega(g(t))$ to mean that $g(t) < o(f(t))$.

We also use the notation $\tilde O(g(t))$ to hide logarithmic factors.
That is, $f(t) = \tilde O(g(t))$ if there exists some constant $C$ such
that $f(t) \le C \cdot g(t) \cdot \log^k(t)$ for some $k$ and all $t$.

Occasionally, we will also use $O(f(t))$ (or one of the other symbols)
as shorthand to manipulate function classes. For example, we might write
$O(f(t)) + O(g(t)) = O(f(t) + g(t))$ to mean that the sum of two
functions in $O(f(t))$ and $O(g(t))$ is in $O(f(t) + g(t))$.

## Python


Loading

0 comments on commit c0f946a

Please sign in to comment.