{
  "titleDefinition": {
    "title": "Sample Rows"
  },
  "current_parameters": {
    "withReplacement": false,
    "samplingRatio": 1,
    "useSamplingSize": false,
    "samplingSize": -1,
    "useSamplingSeed": false,
    "samplingSeed": -1
  },
  "parameters": [
    {
      "id": "withReplacement",
      "enum": [
        true,
        false
      ],
      "type": "boolean",
      "default": false,
      "required": true
    },
    {
      "id": "samplingRatio",
      "type": "double",
      "default": 1,
      "required": true
    },
    {
      "id": "useSamplingSize",
      "type": "boolean",
      "default": false
    },
    {
      "id": "samplingSize",
      "type": "long",
      "default": -1,
      "required": true
    },
    {
      "id": "useSamplingSeed",
      "type": "boolean",
      "default": false
    },
    {
      "id": "samplingSeed",
      "type": "integer",
      "default": -1,
      "required": false
    }
  ],
  "uihints": {
    "id": "org.apache.spark.ml.ibm.transformers.Sample",
    "icon": "images/transformationspark.svg",
    "label": {
      "default": "Sample Rows"
    },
    "description": {
      "default": "Perform a simple sample operation on the data, with or without replacement"
    },
    "parameter_info": [
      {
        "parameter_ref": "withReplacement",
        "label": {
          "default": "Sample"
        },
        "description": {
          "default": "Indicate that sampling be performed with replacement"
        },
        "control": "radioset",
        "resource_key": "withReplace",
        "orientation": "vertical"
      },
      {
        "parameter_ref": "samplingRatio",
        "label": {
          "default": "Sample Ratio"
        },
        "description": {
          "default": "Fraction of rows to include in sample"
        }
      },
      {
        "parameter_ref": "useSamplingSize",
        "label": {
          "sample-size.label": "Use maximum sample size"
        }
      },
      {
        "parameter_ref": "samplingSize",
        "label": {
          "default": "Maximum sample size"
        },
        "description": {
          "default": "Maximum number of rows in the sample"
        }
      },
      {
        "parameter_ref": "useSamplingSeed",
        "label": {
          "resource_key": "sample-seed.label"
        }
      },
      {
        "parameter_ref": "samplingSeed",
        "label": {
          "default": "Seed"
        },
        "description": {
          "default": "Seed for the sample random number generator"
        },
        "number_generator": {
          "label": {
            "default": "Generate",
            "resource_key": "numberGenerator"
          },
          "range": {
            "min": 1000000,
            "max": 9999999
          }
        }
      }
    ],
    "group_info": [
      {
        "id": "settings",
        "label": {
          "default": "Settings"
        },
        "type": "panels",
        "group_info": [
          {
            "id": "basic-settings",
            "type": "controls",
            "parameter_refs": [
              "withReplacement",
              "samplingRatio"
            ]
          },
          {
            "id": "use-sampling-size",
            "type": "controls",
            "parameter_refs": [
              "useSamplingSize"
            ]
          },
          {
            "id": "sample-size-panel",
            "type": "panels",
            "group_info": [
              {
                "id": "sample-size-control",
                "type": "controls",
                "parameter_refs": [
                  "samplingSize"
                ]
              }
            ]
          },
          {
            "id": "use-sampling-seed",
            "type": "controls",
            "parameter_refs": [
              "useSamplingSeed"
            ]
          },
          {
            "id": "sample-seed-panel",
            "type": "panels",
            "group_info": [
              {
                "id": "sample-seed-control",
                "type": "controls",
                "parameter_refs": [
                  "samplingSeed"
                ]
              }
            ]
          }
        ]
      }
    ]
  },
  "conditions": [
    {
      "validation": {
        "fail_message": {
          "type": "error",
          "focus_parameter_ref": "samplingSize",
          "message": {
            "resource_key": "sampling-size_not_empty"
          }
        },
        "evaluate": {
          "condition": {
            "parameter_ref": "samplingSize",
            "op": "isNotEmpty"
          }
        }
      }
    },
    {
      "validation": {
        "fail_message": {
          "type": "error",
          "focus_parameter_ref": "samplingRatio",
          "message": {
            "resource_key": "sampling-ratio_not_empty"
          }
        },
        "evaluate": {
          "condition": {
            "parameter_ref": "samplingRatio",
            "op": "isNotEmpty"
          }
        }
      }
    },
    {
      "enabled": {
        "group_refs": [
          "sample-seed-panel"
        ],
        "evaluate": {
          "condition": {
            "parameter_ref": "useSamplingSeed",
            "op": "equals",
            "value": true
          }
        }
      }
    },
    {
      "enabled": {
        "group_refs": [
          "sample-size-panel"
        ],
        "evaluate": {
          "condition": {
            "parameter_ref": "useSamplingSize",
            "op": "equals",
            "value": true
          }
        }
      }
    }
  ],
  "dataset_metadata": {
    "fields": [
      {
        "name": "Age",
        "type": "integer",
        "metadata": {
          "description": "",
          "measure": "range",
          "modeling_role": "input"
        }
      },
      {
        "name": "Sex",
        "type": "string",
        "metadata": {
          "description": "",
          "measure": "discrete",
          "modeling_role": "input"
        }
      },
      {
        "name": "BP",
        "type": "string",
        "metadata": {
          "description": "",
          "measure": "discrete",
          "modeling_role": "input"
        }
      },
      {
        "name": "Cholesterol",
        "type": "string",
        "metadata": {
          "description": "",
          "measure": "discrete",
          "modeling_role": "input"
        }
      },
      {
        "name": "Na",
        "type": "double",
        "metadata": {
          "description": "",
          "measure": "range",
          "modeling_role": "input"
        }
      },
      {
        "name": "K",
        "type": "double",
        "metadata": {
          "description": "",
          "measure": "range",
          "modeling_role": "input"
        }
      },
      {
        "name": "Drug",
        "type": "string",
        "metadata": {
          "description": "",
          "measure": "discrete",
          "modeling_role": "input"
        }
      }
    ]
  },
  "resources": {
    "org.apache.spark.ml.ibm.transformers.Sample.label": "Sample Rows",
    "org.apache.spark.ml.ibm.transformers.Sample.desc": "Perform a simple sample operation on the data, with or without replacement",
    "withReplacement.label": "Sample",
    "withReplacement.desc": "Indicate that sampling be performed with replacement",
    "withReplace.true.label": "With replacement",
    "withReplace.false.label": "Without replacement",
    "sample-size.label": "Use maximum sample size",
    "sample-seed.label": "Repeatable partition assignment",
    "samplingSize.label": "Maximum sample size",
    "samplingSize.desc": "Maximum number of rows in the sample",
    "samplingRatio.label": "Sample Ratio",
    "samplingRatio.desc": "Fraction of rows to include in sample",
    "samplingSeed.label": "Seed",
    "samplingSeed.desc": "Seed for the sample random number generator",
    "numberGenerator.label": "Generate",
    "numberGenerator.desc": "Generate a random number for use as a seed value",
    "settings.label": "Settings",
    "sampling-size_not_empty": "Select a sampling size",
    "sampling-ratio_not_empty": "Select a sampling ratio"
  }
}
