docstr: Test that we can make predictions using the model.
docstr_tok: ["Test","that","we","can","make","predictions","using","the","model","."]
code: def test_predict(self):
      """
      Test that we can make predictions using the model.
      """
  
      docs = self.docs
      for m in self.models:
          preds = m.predict(docs)
          self.assertTrue(isinstance(preds, turicreate.SArray))
          self.assertEqual(len(preds), len(docs))
          self.assertEqual(preds.dtype, int)
  
          preds = m.predict(docs, output_type="probability")
          self.assertTrue(isinstance(preds, turicreate.SArray))
          self.assertTrue(len(preds) == len(docs))
          s = preds.apply(lambda x: sum(x))
          self.assertTrue(
              (s.apply(lambda x: abs(x - 1)) < 0.000001).all()
          )
  
          # Test predictions when docs have new words
          new_docs = turicreate.SArray(
              [{"-1,-1": 3.0, "0,4": 5.0, "0,3": 2.0}]
          )
          preds = m.predict(new_docs)
          self.assertEqual(len(preds), len(new_docs))
  
          # Test additional burnin. Ideally we could show that things
          # converge as you increase burnin.
          preds_no_burnin = m.predict(
              docs, output_type="probability", num_burnin=0
          )
          self.assertEqual(len(preds_no_burnin), len(docs))
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import os
  import tempfile
  import shutil
  import unittest
  import turicreate
  from turicreate.toolkits._main import ToolkitError
  from turicreate.toolkits.topic_model import topic_model
  from turicreate.toolkits.text_analytics import parse_sparse
  from turicreate.toolkits.text_analytics import parse_docword
  from turicreate.toolkits.topic_model import perplexity
  from .None import util
  import time
  import random
  import numpy
  import itertools
label_desc: Use image node_id 9 for calling the BasicTest obj's underlying member method code with example usage: obj.test_predict() without return types