Skip to content

Commit d073839

Browse files
committed
Add note to factor protocol docs saying that factors should (ideally) be pickleable
1 parent 852eb36 commit d073839

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

doc/expert-model-specification.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,14 @@ The full interface looks like this:
197197
ideally be a 1-d or 2-d array or :func:`Categorical` object,
198198
but this will be checked and converted as needed.
199199

200+
In addition, factor objects should be pickleable/unpickleable, so as
201+
to allow models containing them to be pickled/unpickled. (Or, if for
202+
some reason your factor objects are *not* safely pickleable, you
203+
should consider giving them a `__getstate__` method which raises an
204+
error, so that any users which attempt to pickle a model containing
205+
your factors will get a clear failure immediately, instead of only
206+
later when they try to unpickle.)
207+
200208
.. warning:: Do not store evaluation-related state in
201209
attributes of your factor object! The same factor object may
202210
appear in two totally different formulas, or if you have two

0 commit comments

Comments
 (0)