Step 4: Deploy the model and analyze incoming requests

Build better loan database with shared knowledge and strategies.
Post Reply
Maksudasm
Posts: 1052
Joined: Thu Jan 02, 2025 6:44 am

Step 4: Deploy the model and analyze incoming requests

Post by Maksudasm »

To provide third-party access to the recommender system, GlowByte experts included the main classes with methods that make up suggestions in their own notebook. It has a base class with recommendations, a class with options for clients with history or unknown users. It also includes code for analyzing requests.

The demo laptop is equipped with a class for compiling recommendations, the analysis of external requests can be made independently, based on the code presented in this article. The request includes a timestamp and the basket collected by the client, other properties.

It is necessary to execute the notebook code and pin the checkpoint with the deployment. This operation is performed in the Checkpoints section, where you need to specify the desired one, click Pin and title it as Deploy.

We specify the required cell overseas chinese in australia data and click Deploy selected cell in the context menu. We also call it Deploy, specify the checkpoint previously saved for it, and the input and output values.

Let's make sure the cell is active. Go to the Nodes menu, select the Deploy cell and copy the ID - it needs to be entered into the request.

Next, a third-party request is created. The REQBIN service will help with this, and you can also use any HTTP client that can transmit parameterized requests. Postman, a browser extension, or curl will do.

Let's enter the URL used for the POST request:



(Instead of <node_id>, specify the copied ID from the Deploy cell).

An IAM token is used for authorization. It can be obtained using the Yandex Cloud CLI. The token is specified in the Authorization menu. In the content menu, go to JSON and enter the following parameters:

{ "folder_id",
"b1XXXXXXXXXXXXXXi",
"input": {
"input_data": {
"user_id": 290000000,
"created_at": "2021-04-24T18-25:43.511Z",
"store_id": 742,
"slot_num ": 5,
"session_id": "qwe-123-asd",
"items": [{
"name": "dish_1",
"code": 13,
},
{
"name": "dish_2",
"code": 77,
},
{
"name ": "dish_3",
"code": 39,
}
]
}
}
}

For folder_id in this case, the ID of the directory where the project is located in DataSphere is used. Input_data is determined by the structure and content of the data and includes a list of products that were in the basket before. A structure similar to that specified in the Deploy notebook will also work.

Click Send in REQBIN, and we get JSON with data selected by the recommendation system. It includes 5 products selected in accordance with the customer's shopping cart. Here, these are products with id 4, 5, 6, 62, and 58.

Deploying a model and analyzing incoming requests

Thus, the algorithm processes third-party requests and is ready for use. Although the considered instructions for the system use a synthetic dataset, it is also suitable for analyzing real data. Neural networks and ML algorithms are not considered, but the use of gradient boosting makes it possible to effectively classify data to form a system. Any enterprise, regardless of its scale, can create a similar one.

Evaluation of a recommender system
All machine learning methods, including recommender systems, require performance evaluation to select the optimal method. Methods for this can be divided into
Post Reply