parameters: (self, topic_names=None, eps=None)
return_statement: return data, rows, columns
docstring: :Description: get Theta matrix in sparse format
  
          :param topic_names: list with topics or single topic to extract, None means all topics
          :type topic_names: list of str or str or None
          :param float eps: threshold to consider values as zero
  
          :return:
            * a 3-tuple of (data, rows, columns), where
            * data --- scipy.sparse.csr_matrix with values
            * columns --- the ids of documents;
            * rows --- the names of topics in topic model;
docstring_summary: :Description: get Theta matrix in sparse format
docstring_tokens: : Description : get Theta matrix in sparse format
function: def get_theta_sparse(self, topic_names=None, eps=None):
          """
          :Description: get Theta matrix in sparse format
  
          :param topic_names: list with topics or single topic to extract, None means all topics
          :type topic_names: list of str or str or None
          :param float eps: threshold to consider values as zero
  
          :return:
            * a 3-tuple of (data, rows, columns), where
            * data --- scipy.sparse.csr_matrix with values
            * columns --- the ids of documents;
            * rows --- the names of topics in topic model;
          """
          from scipy import sparse
  
          if self.cache_theta is False:
              raise ValueError('cache_theta == False. Set ARTM.cache_theta = True')
          if not self._initialized:
              raise RuntimeError('Model does not exist yet. Use ARTM.initialize()/ARTM.fit_*()')
  
          args = messages.GetThetaMatrixArgs()
          args.matrix_layout = wrapper.constants.MatrixLayout_Sparse
          if eps is not None:
              args.eps = eps
          if topic_names is not None:
              if isinstance(topic_names, string_types):
                  topic_names = [topic_names]
              for topic_name in topic_names:
                  args.topic_name.append(topic_name)
          theta = self._lib.ArtmRequestThetaMatrixExternal(self.master.master_id, args)
  
          numpy_ndarray = numpy.zeros(shape=(3 * theta.num_values, 1), dtype=numpy.float32)
          self._lib.ArtmCopyRequestedObject(numpy_ndarray)
  
          col_ind = numpy.frombuffer(numpy_ndarray.tobytes(), dtype=numpy.int32,
                                     count=theta.num_values, offset=0)
          row_ind = numpy.frombuffer(numpy_ndarray.tobytes(), dtype=numpy.int32,
                                     count=theta.num_values, offset=4*theta.num_values)
          data = numpy.frombuffer(numpy_ndarray.tobytes(), dtype=numpy.float32,
                                  count=theta.num_values, offset=8*theta.num_values)
  
          # Rows correspond to topics; get topic names from theta.topic_name
          # Columns correspond to items; get item IDs from theta.item_id
          data = sparse.csr_matrix((data, (row_ind, col_ind)),
                                   shape=(len(theta.topic_name), len(theta.item_id)))
          rows = list(theta.topic_name)
          columns = list(theta.item_title) if self._theta_columns_naming == 'title' else list(theta.item_id)
          return data, rows, columns
function_tokens: def get_theta_sparse ( self , topic_names = None , eps = None ) : from scipy import sparse if self . cache_theta is False : raise ValueError ( 'cache_theta == False. Set ARTM.cache_theta = True' ) if not self . _initialized : raise RuntimeError ( 'Model does not exist yet. Use ARTM.initialize()/ARTM.fit_*()' ) args = messages . GetThetaMatrixArgs ( ) args . matrix_layout = wrapper . constants . MatrixLayout_Sparse if eps is not None : args . eps = eps if topic_names is not None : if isinstance ( topic_names , string_types ) : topic_names = [ topic_names ] for topic_name in topic_names : args . topic_name . append ( topic_name ) theta = self . _lib . ArtmRequestThetaMatrixExternal ( self . master . master_id , args ) numpy_ndarray = numpy . zeros ( shape = ( 3 * theta . num_values , 1 ) , dtype = numpy . float32 ) self . _lib . ArtmCopyRequestedObject ( numpy_ndarray ) col_ind = numpy . frombuffer ( numpy_ndarray . tobytes ( ) , dtype = numpy . int32 , count = theta . num_values , offset = 0 ) row_ind = numpy . frombuffer ( numpy_ndarray . tobytes ( ) , dtype = numpy . int32 , count = theta . num_values , offset = 4 * theta . num_values ) data = numpy . frombuffer ( numpy_ndarray . tobytes ( ) , dtype = numpy . float32 , count = theta . num_values , offset = 8 * theta . num_values ) # Rows correspond to topics; get topic names from theta.topic_name # Columns correspond to items; get item IDs from theta.item_id data = sparse . csr_matrix ( ( data , ( row_ind , col_ind ) ) , shape = ( len ( theta . topic_name ) , len ( theta . item_id ) ) ) rows = list ( theta . topic_name ) columns = list ( theta . item_title ) if self . _theta_columns_naming == 'title' else list ( theta . item_id ) return data , rows , columns