Task 1: Making a decision service

You create a decision service that contains a decision model. When you run the model, it produces a greeting.

About this task

In this task, you...

  • Create a decision automation.
  • Create a decision service inside the automation.
  • Create a decision model inside the service.
  • Define the data and logic of the model.
  • Create a test data set.
  • Run the model on test data.

When defined, the model takes a name as input, and produces a greeting that includes the name. If no name is entered, the model produces a default value.

For more information about the structure of decision automations, see Building decision services in Decision Designer.

Step 1: Creating a decision automation

About this task

In this step, you create a decision automation. Users can work collaboratively in decision automations through a shared Decision Designer repository.

Procedure

  1. On the Decision Intelligence Client Managed Software home page, click Create.
  2. Enter a name for your decision automation in the Name field.
    The automation does not accept the name of an existing one. Use a unique name, for example, a name that uses your initials: <YourInitials> Getting Started. The project name in this tutorial is My Getting Started.
  3. Enter the following description:
    My decision automation for the getting started tutorial.
  4. Click Create. Your new decision automation opens in Decision Designer.

Step 2: Creating a decision service

About this task

In this step, you create a decision service to model and define a decision (see Building decision services).

Procedure

  1. Click New decision in your automation to create a decision service.
    From the New decision wizard, you can:
    • Create decision services from scratch.
    • Import existing decision services. You can import a ZIP file that contains one or more decision services.
    • Import samples and tutorials:
      • Discovery tutorials help you get started in Decision Intelligence.
      • Using the industry samples, you can discover decision services that are tailored for specific business applications.
      • Localized samples show you an example of a simple decision service in the different languages that Decision Intelligence supports.
  2. Make sure Create decision service is selected and enter My Service in the Name field.
  3. Expand Language, and select English (United States) in the menu.
    Tip: This tutorial is done in English, but you can make decision services in different languages. To get the results of this tutorial in another language, see Decision Intelligence Client Managed Software samples External link opens a new window or tab.
  4. Enter the following description:
    My getting started decision service.
    Note: The group ID is optional. If none is entered, a default one is used. The group ID is used to uniquely identify a decision service.
  5. Click Create.
    Your decision service opens. It shows the following tabs:
    • Models: Create and manage decision, task, and predictive models that define decisions.
    • Data: Create and manage data models that define custom data types.
    • Decision operations: Create and manage decision operations that define entry points for running the decision, predictive, and task models.

Step 3: Creating a decision model

About this task

You define the flow of a decision through a diagram in a model. The primary parts of the diagram are nodes:
  • Decision nodes: Contain the logic that processes the input data.
  • Input nodes: Provide the data that is needed to make the decision.
  • Prediction nodes: Provide values that are computed in predictive models. (Prediction nodes are not used in this tutorial.)
  • Function nodes: Provide values that are computed in other decision models. (Function nodes are not used in this tutorial.)
  • Generative AI nodes: Provide values that are computed in generative AI models. (Generative AI nodes are not used in this tutorial.)

Data enters through input data nodes, and is processed by rules in decision nodes. The rules define the logic of the decision. They are expressed in business rules and decision tables. The rules determine the output of the model (see Creating a decision diagram).

In this step, you create a model that has a diagram with a decision node and an input node.

Procedure

  1. In the Models tab, click Create.
    The Decision model type is selected by default.
  2. Enter My Model in the Name field. You can add a description, but it is optional.
  3. Click Create. A basic model opens. It contains a diagram that has a decision node and an input node.
    In addition to the Modeling tab, Decision Designer shows four other tabs:
    • Error report: Checks the model for errors.
    • Run: Runs the model on test data.
    • View history: Shows the version of the model. You create the first version when you share the decision service.
    • Dependencies: Shows the decision artifacts and external libraries that the model depends on. You can declare new dependencies in this tab.

    Your changes are automatically saved, and the information in these tabs is recomputed in each save.

    You can use the navigation breadcrumbs to move back through the interconnected interfaces.

    To the right of the breadcrumbs is a toolbar with a group of icons:

    Image shows the tools.

    From left to right, the icons have the following functions:

    • Status shows that your changes are saved automatically. The status icon is updated for each save.
    • Edit opens a window for editing the details of the model.
    • Undo reverts the last change.
    • Redo reinstates the last reverted change.
    • Navigation history helps you navigate easily between artifacts.
    • Connected to shows the URI of the Git repository the decision automation is connected to.
    • Load changes shows how many incoming changes can be loaded.
    • Share changes shows a blue dot when you have changes to share with your collaborators.
    • Deploy is a feature for deploying your decision service.

    The appearance of the toolbar varies depending on the page that you are viewing.

Step 4: Defining the nodes

About this task

You start defining the nodes in a model by giving them descriptive names and output types. If you create a decision node that produces a message, for example, you might name it Message and set its output to string. For a node that outputs a price, you might name it Price and set its output to integer (see Modeling data).

In this step, you define the names and output types of the nodes in your model. You define the logic of the model in the next step.

Procedure

  1. Select the Input node.
  2. In the right panel, change the Node name field to Name.
  3. Leave string selected in the Output type field.
  4. Select the Decision node.
  5. Change the Node name field to Daily advice. Leave string as the output type.

Step 5: Defining the decision logic

About this task

You use rules to define the logic that is used by decision nodes. A rule applies conditions to data, and when the data meets the conditions, the rule associates an action with the conditions. A rule might check data for a specific value, for example, and if the data contains the value, the rule outputs an action that is related to the value.

You express rules in business rules and decision tables:

  • Business rules contain a rule statement that has a condition and an action.
  • Decision tables group business rules that use the same rule statement but with different variables.
  • Default rules apply an action when no other condition can be met.

When you write a rule, you use a language that is natural in form (see Rule language). The rules include variables that are derived from the names of the nodes in the model (see Rule structure).

In this step, you add a business rule and default value to the Daily advice node to process the data from the Name node.

Procedure

  1. With the Daily advice decision node selected, open the Logic tab, and then click the Add button Add and select Business rule.
  2. Enter Advice rule in the Name field, select Name in the list of criteria, and click Create.
    The editor displays an error icon "Error icon" until you define the rule.
  3. Define the rule for processing input data.
    In the rule editor, you see the default rule:
    if
    Name is <a string>
    then
    set decision to <a string> ;
    You change the rule to output a greeting that includes a name when one is provided:
    1. Click the first <a string>.
    2. Browse the completion menu, and click defined.
    3. Click outside the menu to close it.
    4. Click the second <a string>.
    5. Use string interpolation to complete the output by adding `Hello { Name }!` to compose the greeting. Add a space just after Hello to insert a space before the name in the output message.
      Note: String interpolation assists you in authoring rules for decision services (see String interpolation).

    You now have the following greeting rule:

    if
        Name is defined
    then
        set decision to `Hello { Name }!` ;

    The rule states that if a name is entered as input, the output of the model shows a greeting that includes the name.

    Tip: Alternatively, you can copy and paste the greeting rule into the rule editor.
  4. In the right column, click the Add button Add and select Default rule to add a rule that displays a message when no name is entered.
  5. Replace the default rule with the following rule statement:
    set decision to "Sorry, we don't have enough information to provide a response." ;

    Now, if no name is entered, the output of the model is the message in the output-default-setting rule.

    Enclose a string of characters in quotation marks to display the string as a message.

  6. Click Back to the diagram in the upper right side of the editor.
    Now, data flows from the Name node up to the Daily advice node, which adds the data to an output message. When no data is entered, the default statement becomes the output message.

Step 6: Running the model

About this task

You run the model against representative test data, and use the results to further develop the model (see Running models).

In this step, you run your model twice. You enter test data, and run the model to produce a greeting. Then, you run the model without test data to see whether it returns the default message.

Procedure

  1. Open the Run tab. You define your test data set in the side column of the tab window.
  2. Click Add test data set.
    You can provide the data in a friendly form or in its underlying JSON format. You can click the Image shows the JSON and form buttons. switch button to switch between the two edition modes.

    In this example, you enter your data in a form.

  3. Click name in the form, and enter Jamie in the input field.
    The form uses the JSON representation of the name of an input node. In this instance, Name becomes name. For more information, see Modeling data.
  4. Click Run. You get the following result:
    Hello Jamie!
  5. Click the dots next to name to open the overflow menu, and click Delete in the menu to remove the name from the test data.
  6. Click Run again. You get the following result:
    Sorry, we don't have enough information to provide a response.
  7. When you finish running the model, click the trash bin icon in the header of the data set column to delete the test data set. You create a new test data set in the next task.

What to do next

In the next task, you expose and share your decision service.