Skip to content

Commit

Permalink
Add note to factor protocol docs saying that factors should (ideally)…
Browse files Browse the repository at this point in the history
… be pickleable
  • Loading branch information
njsmith committed Jun 9, 2015
1 parent 852eb36 commit d073839
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/expert-model-specification.rst
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ The full interface looks like this:
ideally be a 1-d or 2-d array or :func:`Categorical` object,
but this will be checked and converted as needed.

In addition, factor objects should be pickleable/unpickleable, so as
to allow models containing them to be pickled/unpickled. (Or, if for
some reason your factor objects are *not* safely pickleable, you
should consider giving them a `__getstate__` method which raises an
error, so that any users which attempt to pickle a model containing
your factors will get a clear failure immediately, instead of only
later when they try to unpickle.)

.. warning:: Do not store evaluation-related state in
attributes of your factor object! The same factor object may
appear in two totally different formulas, or if you have two
Expand Down

0 comments on commit d073839

Please sign in to comment.