oktoberfest.pr.Koina.predict
- Koina.predict(data, **kwargs)
Perform inference on the given data using the Koina model.
This method allows you to perform inference on the provided input data using the configured Koina model. You can choose to perform inference asynchronously (in parallel) or sequentially, depending on the value of the ‘_async’ parameter. If asynchronous inference is selected, the method will return when all inference tasks are complete. Note: Ensure that the model and server are properly configured and that the input data matches the model’s input requirements.
- Parameters:
data (dict[str, np.ndarray] | pd.DataFrame | Spectra) – A dictionary or dataframe containing input data for inference. For the dictionary, keys are input names, and values are numpy arrays. In case of a dataframe, the input fields for the requested model must be present in the column names.
kwargs – Additional params that are forwarded to super().predict
- Return type:
dict[str, np.ndarray]
- Returns:
A dictionary containing the model’s predictions. Keys are output names, and values are numpy arrays representing the model’s output.
Example:
model = Koina("Prosit_2019_intensity") input_data = { "peptide_sequences": np.array(["PEPTIDEK" for _ in range(size)]), "precursor_charges": np.array([2 for _ in range(size)]), "collision_energies": np.array([20 for _ in range(size)]), "fragmentation_types": np.array(["HCD" for _ in range(size)]), "instrument_types": np.array(["QE" for _ in range(size)]) } predictions = model.predict(input_data)