Commands frame/assign_sample¶
Randomly group rows into user-defined classes.
POST /v1/commands/¶
GET /v1/commands/:id¶
Request¶
Route
POST /v1/commands/
Body
name: | frame/assign_sample |
---|---|
arguments: | frame : Frame
sample_percentages : list
sample_labels : list (default=None)
output_column : unicode (default=None)
random_seed : int32 (default=None)
|
Headers
Authorization: test_api_key_1
Content-type: application/json
Description
Randomly assign classes to rows given a vector of percentages. The table receives an additional column that contains a random label. The random label is generated by a probability distribution function. The distribution function is specified by the sample_percentages, a list of floating point values, which add up to 1. The labels are non-negative integers drawn from the range where is the sample_percentages.
Notes
The sample percentages provided by the user are preserved to at least eight decimal places, but beyond this there may be small changes due to floating point imprecision.
In particular:
- The engine validates that the sum of probabilities sums to 1.0 within eight decimal places and returns an error if the sum falls outside of this range.
- The probability of the final class is clamped so that each row receives a valid label with probability one.
Response¶
Status
200 OK
Body
Returns information about the command. See the Response Body for Get Command here below. It is the same.