# Create predictive scoring model

Create a new predictive scoring model.

Endpoint: POST /entities/predictive_segments
Version: 1.0.0

## Request fields (application/vnd.treasuredata.v1+json):

  - `id` (string)

  - `type` (string)
    Enum: "predictive-segment"

  - `attributes` (object)

  - `attributes.name` (string)

  - `attributes.description` (string)

  - `attributes.baseSegmentId` (integer)

  - `attributes.segmentId` (integer)

  - `attributes.scoredSegmentId` (integer)

  - `attributes.gradeThresholds` (array)
    Given the items [a, b, c], they must meet the condition `a >= b >= c`
    Example: [75,50,25]

  - `attributes.categoricalAsColumnNames` (array)

  - `attributes.categoricalArrayAsColumnNames` (array)

  - `attributes.quantitativeAsColumnNames` (array)

  - `attributes.preprocess` (array)
    Definition of preprocess. All of `$item.column` must be specified in one of categoricalAsColumnNames, categoricalArrayAsColumnNames, or quantitativeAsColumnNames.

  - `attributes.preprocess.column` (string, required)

  - `attributes.preprocess.source` (object, required)

  - `attributes.preprocess.source.column` (string)

  - `attributes.preprocess.source.table` (string)

  - `attributes.preprocess.source.functions` (array)

  - `attributes.preprocess.source.functions.function` (string, required)
    Enum: "+", "-", "*", "/"

  - `attributes.preprocess.source.functions.arg` (number)

  - `attributes.preprocess.source.functions.search` (string)

  - `attributes.preprocess.source.functions.replacement` (string)

  - `attributes.preprocess.source.functions.start` (number)

  - `attributes.preprocess.source.functions.length` (number)

  - `attributes.preprocess.source.functions.pattern` (string)

  - `attributes.preprocess.source.functions.group` (number)

  - `attributes.preprocess.source.functions.default` (number, required)

  - `attributes.preprocess.source.functions.op` (string)
    Enum: ">", "<", "<=", ">=", "=", "!=", "is", "is\\", "not"

  - `attributes.preprocess.source.functions.right_value` (number)

  - `attributes.preprocess.source.functions.then` (number)

  - `attributes.preprocess.source.functions.else` (number)

  - `relationships` (object)

  - `relationships.parentFolder` (object)

  - `relationships.parentFolder.data` (object)

  - `relationships.parentFolder.data.id` (string, required)

  - `relationships.parentFolder.data.type` (string, required)
    Enum: "folder-segment"

## Response 200 fields (application/vnd.treasuredata.v1+json):

  - `data` (object, required)

  - `data.audienceId` (string)

  - `data.baseSegmentId` (string)

  - `data.segmentId` (string)

  - `data.scoredSegmentId` (string)

  - `data.name` (string)

  - `data.description` (string)

  - `data.categoricalAsColumnNames` (array)

  - `data.categoricalArrayAsColumnNames` (array)

  - `data.quantitativeAsColumnNames` (array)

  - `data.accuracy` (number)
    Accuracy for trained model evaluated on initial training.

  - `data.areaUnderRocCurve` (number)
    Evaluation score for the model. See also https://en.wikipedia.org/wiki/Receiver_operating_characteristic#Area_under_the_curve

  - `data.gradeThresholds` (array)
    Given the items [a, b, c], they must meet the condition `a >= b >= c`
    Example: [75,50,25]

  - `data.createdAt` (string)

  - `data.updatedAt` (string)

  - `data.modelUpdatedAt` (string)

  - `included` (array, required)

  - `included.id` (string, required)

  - `included.type` (string, required)
    Enum: "user"

  - `included.attributes` (object, required)

  - `included.attributes.tdUserId` (string, required)

  - `included.attributes.name` (string, required)

