From 6b126aec79faa3a869a375de5c616958db235233 Mon Sep 17 00:00:00 2001 From: Steven Cordwell Date: Tue, 6 Jan 2015 11:02:13 +1300 Subject: [PATCH] [example] Add example usage for the small example Add an example usage for the small example to the docstring for test coverage purposes. --- src/mdptoolbox/example.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/mdptoolbox/example.py b/src/mdptoolbox/example.py index 36fb13a..bad9157 100644 --- a/src/mdptoolbox/example.py +++ b/src/mdptoolbox/example.py @@ -362,6 +362,21 @@ def small(): out : tuple ``out[0]`` is a numpy array of the probability transition matriices. ``out[1]`` is a numpy arrray of the reward matrix. + + Examples + ======== + >>> import mdptoolbox.example + >>> P, R = mdptoolbox.example.small() + >>> P + array([[[ 0.5, 0.5], + [ 0.8, 0.2]], + + [[ 0. , 1. ], + [ 0.1, 0.9]]]) + >>> R + array([[ 5, 10], + [-1, 2]]) + """ P = _np.array([[[0.5, 0.5],[0.8, 0.2]],[[0, 1],[0.1, 0.9]]]) R = _np.array([[5, 10], [-1, 2]]) -- GitLab