def predict(<EOL>self, user_ids, item_ids, item_features=None, user_features=None, num_threads=<NUM_LIT:1><EOL>):
self._check_initialized()<EOL>if not isinstance(user_ids, np.ndarray):<EOL><INDENT>user_ids = np.repeat(np.int32(user_ids), len(item_ids))<EOL><DEDENT>if isinstance(item_ids, (list, tuple)):<EOL><INDENT>item_ids = np.array(item_ids, dtype=np.int32)<EOL><DEDENT>assert len(user_ids) == len(item_ids)<EOL>if user_ids.dtype != np.int32:<EOL><INDENT>user_ids = user_ids.astype(np.int32)<EOL><DEDENT>if item_ids.dtype != np.int32:<EOL><INDENT>item_ids = item_ids.astype(np.int32)<EOL><DEDENT>if num_threads < <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if user_ids.min() < <NUM_LIT:0> or item_ids.min() < <NUM_LIT:0>:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>n_users = user_ids.max() + <NUM_LIT:1><EOL>n_items = item_ids.max() + <NUM_LIT:1><EOL>(user_features, item_features) = self._construct_feature_matrices(<EOL>n_users, n_items, user_features, item_features<EOL>)<EOL>lightfm_data = self._get_lightfm_data()<EOL>predictions = np.empty(len(user_ids), dtype=np.float64)<EOL>predict_lightfm(<EOL>CSRMatrix(item_features),<EOL>CSRMatrix(user_features),<EOL>user_ids,<EOL>item_ids,<EOL>predictions,<EOL>lightfm_data,<EOL>num_threads,<EOL>)<EOL>return predictions<EOL>
Compute the recommendation score for user-item pairs.

For details on how to use feature matrices, see the documentation
on the :class:`lightfm.LightFM` class.

Arguments
---------

user_ids: integer or np.int32 array of shape [n_pairs,]
     single user id or an array containing the user ids for the
     user-item pairs for which a prediction is to be computed. Note
     that these are LightFM's internal id's, i.e. the index of the
     user in the interaction matrix used for fitting the model.
item_ids: np.int32 array of shape [n_pairs,]
     an array containing the item ids for the user-item pairs for which
     a prediction is to be computed. Note that these are LightFM's
     internal id's, i.e. the index of the item in the interaction
     matrix used for fitting the model.
user_features: np.float32 csr_matrix of shape [n_users, n_user_features], optional
     Each row contains that user's weights over features.
item_features: np.float32 csr_matrix of shape [n_items, n_item_features], optional
     Each row contains that item's weights over features.
num_threads: int, optional
     Number of parallel computation threads to use. Should
     not be higher than the number of physical cores.

Returns
-------

np.float32 array of shape [n_pairs,]
    Numpy array containing the recommendation scores for pairs defined
    by the inputs.