Skip to content

Create predictive scoring model (legacy)

Request

Create a new predictive scoring model.
This endpoint is for Audience Studio legacy. For the latest Audience Studio, contact your Customer Success Representative.

Security
TdApikeyAuth
Path
audienceIdinteger, (int64)required

Master Segment id of the preditive segment

Bodyapplication/jsonrequired

Predictive Segment parameters to create

namestring
descriptionstring or null
baseSegmentIdinteger or null, (int64)
segmentIdinteger, (int64)
scoredSegmentIdinteger or null, (int64)
gradeThresholdsArray of numbers, = 3 items(PredictiveSegmentGradeThresholds)

Given the items [a, b, c], they must meet the condition a >= b >= c

Example:
[ 75, 50, 25 ]
categoricalAsColumnNamesArray of strings
categoricalArrayAsColumnNamesArray of strings
quantitativeAsColumnNamesArray of strings
preprocessArray of objects, non-empty(PredictiveSegmentPreprocessItem)

Definition of preprocess. All of $item.column must be specified in one of categoricalAsColumnNames, categoricalArrayAsColumnNames, or quantitativeAsColumnNames.

curl -i -X POST \
  'https://api-cdp.treasuredata.com/audiences/{audienceId}/predictive_segments' \
  -H 'Authorization: YOUR_API_KEY_HERE' \
  -H 'Content-Type: application/json' \
  -d '{
    "name": "string",
    "description": "string",
    "baseSegmentId": 0,
    "segmentId": 0,
    "scoredSegmentId": 0,
    "gradeThresholds": [
      75,
      50,
      25
    ],
    "categoricalAsColumnNames": [
      "string"
    ],
    "categoricalArrayAsColumnNames": [
      "string"
    ],
    "quantitativeAsColumnNames": [
      "string"
    ],
    "preprocess": [
      {
        "column": "string",
        "source": {
          "column": "string",
          "table": "string",
          "functions": [
            {
              "function": "+",
              "arg": 0
            }
          ]
        }
      }
    ]
  }'

Responses

successful operation

Bodyapplication/json
audienceIdstring, (integer)
idstring, (integer)
baseSegmentIdstring or null, (integer)
segmentIdstring, (integer)
scoredSegmentIdstring or null, (integer)
namestring
descriptionstring or null
categoricalAsColumnNamesArray of strings
categoricalArrayAsColumnNamesArray of strings
quantitativeAsColumnNamesArray of strings
accuracynumber or null, (double), [ 0 .. 100 ](PredictiveSegmentAccuracy)

Accuracy for trained model evaluated on initial training.

areaUnderRocCurvenumber or null, (double), [ 0 .. 1 ](PredictiveSegmentAreaUnderRocCurve)

Evaluation score for the model. See also https://en.wikipedia.org/wiki/Receiver_operating_characteristic#Area_under_the_curve

gradeThresholdsArray of numbers, = 3 items(PredictiveSegmentGradeThresholds)

Given the items [a, b, c], they must meet the condition a >= b >= c

Example:
[ 75, 50, 25 ]
createdAtstring, (date-time)
updatedAtstring, (date-time)
Response
{ "audienceId": "string", "id": "string", "baseSegmentId": "string", "segmentId": "string", "scoredSegmentId": "string", "name": "string", "description": "string", "categoricalAsColumnNames": [ "string" ], "categoricalArrayAsColumnNames": [ "string" ], "quantitativeAsColumnNames": [ "string" ], "accuracy": 100, "areaUnderRocCurve": 1, "gradeThresholds": [ 75, 50, 25 ], "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z" }