Usage

Overview

This section of the Skyrun SDK documentation details the process of performing inference with a trained model to generate predictions or recommendations based on new input data. Following model training, the model is compiled into Rust for efficient inference and is automatically deployed to Kubernetes, ensuring scalability. The inference process is designed to be user-friendly, requiring only the user's history of interactions as input.

Configuring Inference Parameters

To perform inference with a model in the Skyrun SDK, you need to provide the user's history and specify the desired number of recommendations. The inference is conducted through the client.recommender.vae.inference function, streamlined to be both efficient and straightforward.

Defining Inference Parameters

The inference function can be utilized as follows:

res = client.recommender.vae.inference(
    user_history_ids=["807385", "797420", "796995", "811414", "790271", "817188", "790971", "834812"],
    k=3,
    model_uri="first-model-0peibudq"
)
print(res)

Parameters:

  • user_history_ids (Required): A list of user history interactions, represented by item IDs. This data is crucial for generating personalized recommendations.

  • k (Required): The number of recommendations to return. This allows you to control the volume of predictions based on your or your user's needs.

  • model_uri (Required): The unique identifier URI of the deployed model. This specifies the model to which the inference request is sent.

Usage Notes:

  • The model is compiled into Rust post-training, enhancing the efficiency of the inference process.

  • Automatic deployment to Kubernetes enables scalable and robust handling of inference requests, catering to applications of varying scales.

Example Usage

To perform inference and obtain recommendations, you can use the following code snippet:

res = client.recommender.vae.inference(
    user_history_ids=["807385", "797420", "796995", "811414", "790271", "817188", "790971", "834812"],
    k=3,
    model_uri="first-model-0peibudq"
)
print(res)

Expected Output

The inference function returns a JSON response containing the model's predictions or recommendations based on the provided user history. This response includes the top k recommendations, allowing for personalized interaction with the user. In case of an error, such as a network issue or an invalid model URI, a detailed exception will be raised to inform of the specific problem encountered.

Reach out to us if you have any questions

You can directly reach out to us on LinkedIn if you have any questions: https://www.linkedin.com/in/ariaattar/

Last updated