Skip to content

Commit

Permalink
improved docs for purging addtional matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
vi3k6i5 committed Oct 29, 2017
1 parent 2e9dd6e commit 90b1650
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
13 changes: 9 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,21 @@ The document-topic distributions should be retrived as: ``doc_topic = model.tran
top topic: 1 Document: company, comic, series, case, executive
top topic: 3 Document: son, scene, charge, episode, attack
Save the model for production or for running later:
Optionally, reduce the model by purging additional matrices:

.. code-block:: python
>>> from six.moves import cPickle as pickle
>>> # Uncomment next step if you want to lighten the model object
>>> # Next step will lighten the model object
>>> # This step will delete some matrices inside the model.
>>> # you will be able to use model.transform(X) the same way as earlier.
>>> # you wont be able to use model.fit_transform(X_new)
>>> # model.purge_extra_matrices()
>>> model.purge_extra_matrices()
Save the model for production or for running later:

.. code-block:: python
>>> from six.moves import cPickle as pickle
>>> with open('guidedlda_model.pickle', 'wb') as file_handle:
>>> pickle.dump(model, file_handle)
>>> # load the model for prediction
Expand Down
13 changes: 9 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,21 @@ The document-topic distributions should be retrived as: ``doc_topic = model.tran
top topic: 1 Document: company, comic, series, case, executive
top topic: 3 Document: son, scene, charge, episode, attack
Save the model for production or for running later:
Optionally, reduce the model by purging additional matrices:

.. code-block:: python
>>> from six.moves import cPickle as pickle
>>> # Uncomment next step if you want to lighten the model object
>>> # Next step will lighten the model object
>>> # This step will delete some matrices inside the model.
>>> # you will be able to use model.transform(X) the same way as earlier.
>>> # you wont be able to use model.fit_transform(X_new)
>>> # model.purge_extra_matrices()
>>> model.purge_extra_matrices()
Save the model for production or for running later:

.. code-block:: python
>>> from six.moves import cPickle as pickle
>>> with open('guidedlda_model.pickle', 'wb') as file_handle:
>>> pickle.dump(model, file_handle)
>>> # load the model for prediction
Expand Down

0 comments on commit 90b1650

Please sign in to comment.