|
| 1 | +{ |
| 2 | + "cells": [ |
| 3 | + { |
| 4 | + "cell_type": "markdown", |
| 5 | + "metadata": {}, |
| 6 | + "source": [ |
| 7 | + "***\n", |
| 8 | + "# Implementing Score Testing\n", |
| 9 | + "\n", |
| 10 | + "_**Note:** Before running this example, you will need to run an example that creates a model on a Viya server and copy the UUID. This will be used as a create_score_definition function parameter._" |
| 11 | + ] |
| 12 | + }, |
| 13 | + { |
| 14 | + "cell_type": "code", |
| 15 | + "execution_count": null, |
| 16 | + "metadata": {}, |
| 17 | + "outputs": [], |
| 18 | + "source": [ |
| 19 | + "import requests\n", |
| 20 | + "import sys\n", |
| 21 | + "\n", |
| 22 | + "from sasctl._services.score_definitions import ScoreDefinitions as sd # Importing ScoreDefinitions service\n", |
| 23 | + "from sasctl._services.score_execution import ScoreExecution as se # Importing ScoreExecution service" |
| 24 | + ] |
| 25 | + }, |
| 26 | + { |
| 27 | + "cell_type": "code", |
| 28 | + "execution_count": null, |
| 29 | + "metadata": {}, |
| 30 | + "outputs": [], |
| 31 | + "source": [ |
| 32 | + "# Creating the score definition for this model using the model UUID generated two steps before\n", |
| 33 | + "score_definition = sd.create_score_definition(\n", |
| 34 | + " \"example_score_def_name\", # Name of the score_definition, which can be any string\n", |
| 35 | + " \"model_id\", # Use Model UUID generated two steps before\n", |
| 36 | + " \"table_name\", # Table name for input data, which must exist in host server or it will throw an HTTP error and prompt you to upload a data file\n", |
| 37 | + " # True, # Uncomment 'True' if your Viya version is compatible with CAS Gateway\n", |
| 38 | + ")" |
| 39 | + ] |
| 40 | + }, |
| 41 | + { |
| 42 | + "cell_type": "code", |
| 43 | + "execution_count": null, |
| 44 | + "metadata": {}, |
| 45 | + "outputs": [], |
| 46 | + "source": [ |
| 47 | + "# Executing the score definition\n", |
| 48 | + "score_execution = se.create_score_execution(\n", |
| 49 | + " score_definition.get(\"id\") # Score definition id created in the previous cell\n", |
| 50 | + ")\n", |
| 51 | + "\n", |
| 52 | + "# Prints score_execution_id\n", |
| 53 | + "print(score_execution)" |
| 54 | + ] |
| 55 | + }, |
| 56 | + { |
| 57 | + "cell_type": "markdown", |
| 58 | + "metadata": {}, |
| 59 | + "source": [ |
| 60 | + "We can view our scored model information within Model Manager under Projects -> Choose your model -> Scoring. \n", |
| 61 | + "***" |
| 62 | + ] |
| 63 | + } |
| 64 | + ], |
| 65 | + "metadata": { |
| 66 | + "language_info": { |
| 67 | + "name": "python" |
| 68 | + } |
| 69 | + }, |
| 70 | + "nbformat": 4, |
| 71 | + "nbformat_minor": 2 |
| 72 | +} |
0 commit comments