saealib.CategoricalVariable#
- class saealib.CategoricalVariable(categories)[ソース]#
ベースクラス:
VariableCategorical variable; stored internally as integer index.
Values are encoded as indices in
[0, n_categories - 1]and stored asfloat64in population arrays. Useencode()/decode()to convert between category values and their integer indices.- パラメータ:
categories (list) -- Ordered list of category values. Must be non-empty.
サンプル
>>> v = CategoricalVariable(["red", "green", "blue"]) >>> v.encode("green") 1 >>> v.decode(1) 'green'
Methods
Return the category value for index. |
|
Return the integer index for category. |
|
Round x and clip to a valid category index. |
Method Details
- CategoricalVariable.decode(index)[ソース]#
Return the category value for index.
- パラメータ:
index (int or float) -- Index into
categories; rounded to nearest integer.- 戻り値の型:
category value