diff -ur patsy-0.5.1/doc/stateful-transforms.rst patsy-0.5.1.doc/doc/stateful-transforms.rst --- patsy-0.5.1/doc/stateful-transforms.rst 2018-10-28 04:04:50.000000000 +0100 +++ patsy-0.5.1.doc/doc/stateful-transforms.rst 2018-11-12 21:25:46.469485037 +0100 @@ -35,6 +35,7 @@ Now we can build a design matrix and see what we get: .. ipython:: python + :okexcept: mat = dmatrix("naive_center(x)", data) mat @@ -49,6 +50,7 @@ transformation, like so: .. ipython:: python + :okexcept: new_data = {"x": [5, 6, 7, 8]} # Broken! @@ -76,6 +78,7 @@ way: .. ipython:: python + :okexcept: fixed_mat = dmatrix("center(x)", data) fixed_mat @@ -83,6 +86,7 @@ But if we then feed in our new data, we also get out the correct result: .. ipython:: python + :okexcept: # Correct! build_design_matrices([fixed_mat.design_info], new_data)[0] @@ -97,6 +101,7 @@ just similar enough for you to miss the problem until it's too late.) .. ipython:: python + :okexcept: data_chunked = [{"x": data["x"][:2]}, {"x": data["x"][2:]}] @@ -108,6 +113,7 @@ But if we use the proper stateful transform, this just works: .. ipython:: python + :okexcept: dinfo = incr_dbuilder("center(x)", lambda: iter(data_chunked)) # Correct! @@ -133,6 +139,7 @@ for prediction as well: .. ipython:: python + :okexcept: # Correct! build_design_matrices([dinfo], new_data)[0]