spox.opset.ai.onnx.ml.v4 module

spox.opset.ai.onnx.ml.v4.array_feature_extractor(X: Var, Y: Var) Var[source]

Select elements of the input tensor based on the indices passed. The indices are applied to the last axes of the tensor.

Parameters:
X

Type T. Data to be selected

Y

Type tensor(int64). The indices, based on 0 as the first index of any dimension.

Returns:
ZVar

Type T. Selected output data as an array

Notes

Signature: ai.onnx.ml@1::ArrayFeatureExtractor.

Type constraints:
  • T: tensor(double), tensor(float), tensor(int32), tensor(int64), tensor(string)

spox.opset.ai.onnx.ml.v4.binarizer(X: Var, *, threshold: float = 0.0) Var[source]

Maps the values of the input tensor to either 0 or 1, element-wise, based on the outcome of a comparison against a threshold value.

Parameters:
X

Type T. Data to be binarized

threshold

Attribute. Values greater than this are mapped to 1, others to 0.

Returns:
YVar

Type T. Binarized output data

Notes

Signature: ai.onnx.ml@1::Binarizer.

Type constraints:
  • T: tensor(double), tensor(float), tensor(int32), tensor(int64)

spox.opset.ai.onnx.ml.v4.cast_map(X: Var, *, cast_to: str = 'TO_FLOAT', map_form: str = 'DENSE', max_map: int = 1) Var[source]

Converts a map to a tensor.The map key must be an int64 and the values will be ordered in ascending order based on this key.The operator supports dense packing or sparse packing. If using sparse packing, the key cannot exceed the max_map-1 value.

Parameters:
X

Type T1. The input map that is to be cast to a tensor

cast_to

Attribute. A string indicating the desired element type of the output tensor, one of ‘TO_FLOAT’, ‘TO_STRING’, ‘TO_INT64’.

map_form

Attribute. Indicates whether to only output as many values as are in the input (dense), or position the input based on using the key of the map as the index of the output (sparse).One of ‘DENSE’, ‘SPARSE’.

max_map

Attribute. If the value of map_form is ‘SPARSE,’ this attribute indicates the total length of the output tensor.

Returns:
YVar

Type T2. A tensor representing the same data as the input map, ordered by their keys

Notes

Signature: ai.onnx.ml@1::CastMap.

Type constraints:
  • T1: map(int64,tensor(float)), map(int64,tensor(string))

  • T2: tensor(float), tensor(int64), tensor(string)

spox.opset.ai.onnx.ml.v4.category_mapper(X: Var, *, cats_int64s: Iterable[int] | None = None, cats_strings: Iterable[str] | None = None, default_int64: int = -1, default_string: str = '_Unused') Var[source]

Converts strings to integers and vice versa. Two sequences of equal length are used to map between integers and strings, with strings and integers at the same index detailing the mapping. Each operator converts either integers to strings or strings to integers, depending on which default value attribute is provided. Only one default value attribute should be defined. If the string default value is set, it will convert integers to strings. If the int default value is set, it will convert strings to integers.

Parameters:
X

Type T1. Input data

cats_int64s

Attribute. The integers of the map. This sequence must be the same length as the ‘cats_strings’ sequence.

cats_strings

Attribute. The strings of the map. This sequence must be the same length as the ‘cats_int64s’ sequence

default_int64

Attribute. An integer to use when an input string value is not found in the map.One and only one of the ‘default_*’ attributes must be defined.

default_string

Attribute. A string to use when an input integer value is not found in the map.One and only one of the ‘default_*’ attributes must be defined.

Returns:
YVar

Type T2. Output data. If strings are input, the output values are integers, and vice versa.

Notes

Signature: ai.onnx.ml@1::CategoryMapper.

Type constraints:
  • T1: tensor(int64), tensor(string)

  • T2: tensor(int64), tensor(string)

spox.opset.ai.onnx.ml.v4.dict_vectorizer(X: Var, *, int64_vocabulary: Iterable[int] | None = None, string_vocabulary: Iterable[str] | None = None) Var[source]

Uses an index mapping to convert a dictionary to an array. Given a dictionary, each key is looked up in the vocabulary attribute corresponding to the key type. The index into the vocabulary array at which the key is found is then used to index the output 1-D tensor ‘Y’ and insert into it the value found in the dictionary ‘X’. The key type of the input map must correspond to the element type of the defined vocabulary attribute. Therefore, the output array will be equal in length to the index mapping vector parameter. All keys in the input dictionary must be present in the index mapping vector. For each item in the input dictionary, insert its value in the output array. Any keys not present in the input dictionary, will be zero in the output array. For example: if the string_vocabulary parameter is set to ["a", "c", "b", "z"], then an input of {"a": 4, "c": 8} will produce an output of [4, 8, 0, 0].

Parameters:
X

Type T1. A dictionary.

int64_vocabulary

Attribute. An integer vocabulary array.One and only one of the vocabularies must be defined.

string_vocabulary

Attribute. A string vocabulary array.One and only one of the vocabularies must be defined.

Returns:
YVar

Type T2. A 1-D tensor holding values from the input dictionary.

Notes

Signature: ai.onnx.ml@1::DictVectorizer.

Type constraints:
  • T1: map(int64,tensor(double)), map(int64,tensor(float)), map(int64,tensor(string)), map(string,tensor(double)), map(string,tensor(float)), map(string,tensor(int64))

  • T2: tensor(double), tensor(float), tensor(int64), tensor(string)

spox.opset.ai.onnx.ml.v4.feature_vectorizer(X: Sequence[Var], *, inputdimensions: Iterable[int] | None = None) Var[source]

Concatenates input tensors into one continuous output. All input shapes are 2-D and are concatenated along the second dimension. 1-D tensors are treated as [1,C]. Inputs are copied to the output maintaining the order of the input arguments. All inputs must be integers or floats, while the output will be all floating point values.

Parameters:
X

Type T1. An ordered collection of tensors, all with the same element type.

inputdimensions

Attribute. The size of each input in the input list

Returns:
YVar

Type tensor(float). The output array, elements ordered as the inputs.

Notes

Signature: ai.onnx.ml@1::FeatureVectorizer.

Type constraints:
  • T1: tensor(double), tensor(float), tensor(int32), tensor(int64)

spox.opset.ai.onnx.ml.v4.imputer(X: Var, *, imputed_value_floats: Iterable[float] | None = None, imputed_value_int64s: Iterable[int] | None = None, replaced_value_float: float = 0.0, replaced_value_int64: int = 0) Var[source]

Replaces inputs that equal one value with another, leaving all other elements alone. This operator is typically used to replace missing values in situations where they have a canonical representation, such as -1, 0, NaN, or some extreme value. One and only one of imputed_value_floats or imputed_value_int64s should be defined – floats if the input tensor holds floats, integers if the input tensor holds integers. The imputed values must all fit within the width of the tensor element type. One and only one of the replaced_value_float or replaced_value_int64 should be defined, which one depends on whether floats or integers are being processed. The imputed_value attribute length can be 1 element, or it can have one element per input feature.In other words, if the input tensor has the shape [*,F], then the length of the attribute array may be 1 or F. If it is 1, then it is broadcast along the last dimension and applied to each feature.

Parameters:
X

Type T. Data to be processed.

imputed_value_floats

Attribute. Value(s) to change to

imputed_value_int64s

Attribute. Value(s) to change to.

replaced_value_float

Attribute. A value that needs replacing.

replaced_value_int64

Attribute. A value that needs replacing.

Returns:
YVar

Type T. Imputed output data

Notes

Signature: ai.onnx.ml@1::Imputer.

Type constraints:
  • T: tensor(double), tensor(float), tensor(int32), tensor(int64)

spox.opset.ai.onnx.ml.v4.label_encoder(X: Var, *, default_float: float = -0.0, default_int64: int = -1, default_string: str = '_Unused', default_tensor: ndarray | None = None, keys_floats: Iterable[float] | None = None, keys_int64s: Iterable[int] | None = None, keys_strings: Iterable[str] | None = None, keys_tensor: ndarray | None = None, values_floats: Iterable[float] | None = None, values_int64s: Iterable[int] | None = None, values_strings: Iterable[str] | None = None, values_tensor: ndarray | None = None) Var[source]

Maps each element in the input tensor to another value. The mapping is determined by the two parallel attributes, ‘keys_‘ and ‘values_’ attribute. The i-th value in the specified ‘keys_‘ attribute would be mapped to the i-th value in the specified ‘values_’ attribute. It implies that input’s element type and the element type of the specified ‘keys_‘ should be identical while the output type is identical to the specified ‘values_’ attribute. Note that the ‘keys_‘ and ‘values_’ attributes must have the same length. If an input element can not be found in the specified ‘keys_‘ attribute, the ‘default_’ that matches the specified ‘values_‘ attribute may be used as its output value. The type of the ‘default_’ attribute must match the ‘values_‘ attribute chosen. Let’s consider an example which maps a string tensor to an integer tensor. Assume and ‘keys_strings’ is [“Amy”, “Sally”], ‘values_int64s’ is [5, 6], and ‘default_int64’ is ‘-1’. The input [“Dori”, “Amy”, “Amy”, “Sally”, “Sally”] would be mapped to [-1, 5, 5, 6, 6]. Since this operator is an one-to-one mapping, its input and output shapes are the same. Notice that only one of ‘keys_’/’values_*’ can be set. Float keys with value ‘NaN’ match any input ‘NaN’ value regardless of bit value. If a key is repeated, the last key takes precedence.

Parameters:
X

Type T1. Input data. It must have the same element type as the keys_* attribute set.

default_float

Attribute. A float.

default_int64

Attribute. An integer.

default_string

Attribute. A string.

default_tensor

Attribute. A default tensor. {”Unused”} if values* has string type, {-1} if values_* has integral type, and {-0.f} if values_* has float type.

keys_floats

Attribute. A list of floats.

keys_int64s

Attribute. A list of ints.

keys_strings

Attribute. A list of strings.

keys_tensor

Attribute. Keys encoded as a 1D tensor. One and only one of ‘keys_*’s should be set.

values_floats

Attribute. A list of floats.

values_int64s

Attribute. A list of ints.

values_strings

Attribute. A list of strings.

values_tensor

Attribute. Values encoded as a 1D tensor. One and only one of ‘values_*’s should be set.

Returns:
YVar

Type T2. Output data. This tensor’s element type is based on the values_* attribute set.

Notes

Signature: ai.onnx.ml@4::LabelEncoder.

Type constraints:
  • T1: tensor(double), tensor(float), tensor(int16), tensor(int32), tensor(int64), tensor(string)

  • T2: tensor(double), tensor(float), tensor(int16), tensor(int32), tensor(int64), tensor(string)

spox.opset.ai.onnx.ml.v4.linear_classifier(X: Var, *, classlabels_ints: Iterable[int] | None = None, classlabels_strings: Iterable[str] | None = None, coefficients: Iterable[float], intercepts: Iterable[float] | None = None, multi_class: int = 0, post_transform: str = 'NONE') tuple[Var, Var][source]

Linear classifier

Parameters:
X

Type T1. Data to be classified.

classlabels_ints

Attribute. Class labels when using integer labels. One and only one ‘classlabels’ attribute must be defined.

classlabels_strings

Attribute. Class labels when using string labels. One and only one ‘classlabels’ attribute must be defined.

coefficients

Attribute. A collection of weights of the model(s).

intercepts

Attribute. A collection of intercepts.

multi_class

Attribute. Indicates whether to do OvR or multinomial (0=OvR is the default).

post_transform

Attribute. Indicates the transform to apply to the scores vector.One of ‘NONE,’ ‘SOFTMAX,’ ‘LOGISTIC,’ ‘SOFTMAX_ZERO,’ or ‘PROBIT’

Returns:
YVar

Type T2. Classification outputs (one class per example).

ZVar

Type tensor(float). Classification scores ([N,E] - one score for each class and example

Notes

Signature: ai.onnx.ml@1::LinearClassifier.

Type constraints:
  • T1: tensor(double), tensor(float), tensor(int32), tensor(int64)

  • T2: tensor(int64), tensor(string)

spox.opset.ai.onnx.ml.v4.linear_regressor(X: Var, *, coefficients: Iterable[float] | None = None, intercepts: Iterable[float] | None = None, post_transform: str = 'NONE', targets: int = 1) Var[source]

Generalized linear regression evaluation. If targets is set to 1 (default) then univariate regression is performed. If targets is set to M then M sets of coefficients must be passed in as a sequence and M results will be output for each input n in N. The coefficients array is of length n, and the coefficients for each target are contiguous. Intercepts are optional but if provided must match the number of targets.

Parameters:
X

Type T. Data to be regressed.

coefficients

Attribute. Weights of the model(s).

intercepts

Attribute. Weights of the intercepts, if used.

post_transform

Attribute. Indicates the transform to apply to the regression output vector.One of ‘NONE,’ ‘SOFTMAX,’ ‘LOGISTIC,’ ‘SOFTMAX_ZERO,’ or ‘PROBIT’

targets

Attribute. The total number of regression targets, 1 if not defined.

Returns:
YVar

Type tensor(float). Regression outputs (one per target, per example).

Notes

Signature: ai.onnx.ml@1::LinearRegressor.

Type constraints:
  • T: tensor(double), tensor(float), tensor(int32), tensor(int64)

spox.opset.ai.onnx.ml.v4.normalizer(X: Var, *, norm: str = 'MAX') Var[source]

Normalize the input. There are three normalization modes, which have the corresponding formulas, defined using element-wise infix operators ‘/’ and ‘^’ and tensor-wide functions ‘max’ and ‘sum’: Max: Y = X / max(X) L1: Y = X / sum(X) L2: Y = sqrt(X^2 / sum(X^2)} In all modes, if the divisor is zero, Y == X. For batches, that is, [N,C] tensors, normalization is done along the C axis. In other words, each row of the batch is normalized independently.

Parameters:
X

Type T. Data to be encoded, a tensor of shape [N,C] or [C]

norm

Attribute. One of ‘MAX,’ ‘L1,’ ‘L2’

Returns:
YVar

Type tensor(float). Encoded output data

Notes

Signature: ai.onnx.ml@1::Normalizer.

Type constraints:
  • T: tensor(double), tensor(float), tensor(int32), tensor(int64)

spox.opset.ai.onnx.ml.v4.one_hot_encoder(X: Var, *, cats_int64s: Iterable[int] | None = None, cats_strings: Iterable[str] | None = None, zeros: int = 1) Var[source]

Replace each input element with an array of ones and zeros, where a single one is placed at the index of the category that was passed in. The total category count will determine the size of the extra dimension of the output array Y. For example, if we pass a tensor with a single value of 4, and a category count of 8, the output will be a tensor with [0,0,0,0,1,0,0,0]. This operator assumes every input feature is from the same set of categories. If the input is a tensor of float, int32, or double, the data will be cast to integers and the cats_int64s category list will be used for the lookups.

Parameters:
X

Type T. Data to be encoded.

cats_int64s

Attribute. List of categories, ints.One and only one of the ‘cats_*’ attributes must be defined.

cats_strings

Attribute. List of categories, strings.One and only one of the ‘cats_*’ attributes must be defined.

zeros

Attribute. If true and category is not present, will return all zeros; if false and a category if not found, the operator will fail.

Returns:
YVar

Type tensor(float). Encoded output data, having one more dimension than X.

Notes

Signature: ai.onnx.ml@1::OneHotEncoder.

Type constraints:
  • T: tensor(double), tensor(float), tensor(int32), tensor(int64), tensor(string)

spox.opset.ai.onnx.ml.v4.scaler(X: Var, *, offset: Iterable[float] | None = None, scale: Iterable[float] | None = None) Var[source]

Rescale input data, for example to standardize features by removing the mean and scaling to unit variance.

Parameters:
X

Type T. Data to be scaled.

offset

Attribute. First, offset by this.Can be length of features in an [N,F] tensor or length 1, in which case it applies to all features, regardless of dimension count.

scale

Attribute. Second, multiply by this.Can be length of features in an [N,F] tensor or length 1, in which case it applies to all features, regardless of dimension count.Must be same length as ‘offset’

Returns:
YVar

Type tensor(float). Scaled output data.

Notes

Signature: ai.onnx.ml@1::Scaler.

Type constraints:
  • T: tensor(double), tensor(float), tensor(int32), tensor(int64)

spox.opset.ai.onnx.ml.v4.svmclassifier(X: Var, *, classlabels_ints: Iterable[int] | None = None, classlabels_strings: Iterable[str] | None = None, coefficients: Iterable[float] | None = None, kernel_params: Iterable[float] | None = None, kernel_type: str = 'LINEAR', post_transform: str = 'NONE', prob_a: Iterable[float] | None = None, prob_b: Iterable[float] | None = None, rho: Iterable[float] | None = None, support_vectors: Iterable[float] | None = None, vectors_per_class: Iterable[int] | None = None) tuple[Var, Var][source]

Support Vector Machine classifier

Parameters:
X

Type T1. Data to be classified.

classlabels_ints

Attribute. Class labels if using integer labels.One and only one of the ‘classlabels_*’ attributes must be defined.

classlabels_strings

Attribute. Class labels if using string labels.One and only one of the ‘classlabels_*’ attributes must be defined.

coefficients

Attribute.

kernel_params

Attribute. List of 3 elements containing gamma, coef0, and degree, in that order. Zero if unused for the kernel.

kernel_type

Attribute. The kernel type, one of ‘LINEAR,’ ‘POLY,’ ‘RBF,’ ‘SIGMOID’.

post_transform

Attribute. Indicates the transform to apply to the score. One of ‘NONE,’ ‘SOFTMAX,’ ‘LOGISTIC,’ ‘SOFTMAX_ZERO,’ or ‘PROBIT’

prob_a

Attribute. First set of probability coefficients.

prob_b

Attribute. Second set of probability coefficients. This array must be same size as prob_a.If these are provided then output Z are probability estimates, otherwise they are raw scores.

rho

Attribute.

support_vectors

Attribute.

vectors_per_class

Attribute.

Returns:
YVar

Type T2. Classification outputs (one class per example).

ZVar

Type tensor(float). Class scores (one per class per example), if prob_a and prob_b are provided they are probabilities for each class, otherwise they are raw scores.

Notes

Signature: ai.onnx.ml@1::SVMClassifier.

Type constraints:
  • T1: tensor(double), tensor(float), tensor(int32), tensor(int64)

  • T2: tensor(int64), tensor(string)

spox.opset.ai.onnx.ml.v4.svmregressor(X: Var, *, coefficients: Iterable[float] | None = None, kernel_params: Iterable[float] | None = None, kernel_type: str = 'LINEAR', n_supports: int = 0, one_class: int = 0, post_transform: str = 'NONE', rho: Iterable[float] | None = None, support_vectors: Iterable[float] | None = None) Var[source]

Support Vector Machine regression prediction and one-class SVM anomaly detection.

Parameters:
X

Type T. Data to be regressed.

coefficients

Attribute. Support vector coefficients.

kernel_params

Attribute. List of 3 elements containing gamma, coef0, and degree, in that order. Zero if unused for the kernel.

kernel_type

Attribute. The kernel type, one of ‘LINEAR,’ ‘POLY,’ ‘RBF,’ ‘SIGMOID’.

n_supports

Attribute. The number of support vectors.

one_class

Attribute. Flag indicating whether the regression is a one-class SVM or not.

post_transform

Attribute. Indicates the transform to apply to the score. One of ‘NONE,’ ‘SOFTMAX,’ ‘LOGISTIC,’ ‘SOFTMAX_ZERO,’ or ‘PROBIT.’

rho

Attribute.

support_vectors

Attribute. Chosen support vectors

Returns:
YVar

Type tensor(float). Regression outputs (one score per target per example).

Notes

Signature: ai.onnx.ml@1::SVMRegressor.

Type constraints:
  • T: tensor(double), tensor(float), tensor(int32), tensor(int64)

spox.opset.ai.onnx.ml.v4.tree_ensemble_classifier(X: Var, *, base_values: Iterable[float] | None = None, base_values_as_tensor: ndarray | None = None, class_ids: Iterable[int] | None = None, class_nodeids: Iterable[int] | None = None, class_treeids: Iterable[int] | None = None, class_weights: Iterable[float] | None = None, class_weights_as_tensor: ndarray | None = None, classlabels_int64s: Iterable[int] | None = None, classlabels_strings: Iterable[str] | None = None, nodes_falsenodeids: Iterable[int] | None = None, nodes_featureids: Iterable[int] | None = None, nodes_hitrates: Iterable[float] | None = None, nodes_hitrates_as_tensor: ndarray | None = None, nodes_missing_value_tracks_true: Iterable[int] | None = None, nodes_modes: Iterable[str] | None = None, nodes_nodeids: Iterable[int] | None = None, nodes_treeids: Iterable[int] | None = None, nodes_truenodeids: Iterable[int] | None = None, nodes_values: Iterable[float] | None = None, nodes_values_as_tensor: ndarray | None = None, post_transform: str = 'NONE') tuple[Var, Var][source]

Tree Ensemble classifier. Returns the top class for each of N inputs. The attributes named ‘nodes_X’ form a sequence of tuples, associated by index into the sequences, which must all be of equal length. These tuples define the nodes. Similarly, all fields prefixed with ‘class_’ are tuples of votes at the leaves. A leaf may have multiple votes, where each vote is weighted by the associated class_weights index. One and only one of classlabels_strings or classlabels_int64s will be defined. The class_ids are indices into this list. All fields ending with _as_tensor can be used instead of the same parameter without the suffix if the element type is double and not float.

Parameters:
X

Type T1. Input of shape [N,F]

base_values

Attribute. Base values for classification, added to final class score; the size must be the same as the classes or can be left unassigned (assumed 0)

base_values_as_tensor

Attribute. Base values for classification, added to final class score; the size must be the same as the classes or can be left unassigned (assumed 0)

class_ids

Attribute. The index of the class list that each weight is for.

class_nodeids

Attribute. node id that this weight is for.

class_treeids

Attribute. The id of the tree that this node is in.

class_weights

Attribute. The weight for the class in class_id.

class_weights_as_tensor

Attribute. The weight for the class in class_id.

classlabels_int64s

Attribute. Class labels if using integer labels.One and only one of the ‘classlabels_*’ attributes must be defined.

classlabels_strings

Attribute. Class labels if using string labels.One and only one of the ‘classlabels_*’ attributes must be defined.

nodes_falsenodeids

Attribute. Child node if expression is false.

nodes_featureids

Attribute. Feature id for each node.

nodes_hitrates

Attribute. Popularity of each node, used for performance and may be omitted.

nodes_hitrates_as_tensor

Attribute. Popularity of each node, used for performance and may be omitted.

nodes_missing_value_tracks_true

Attribute. For each node, define what to do in the presence of a missing value: if a value is missing (NaN), use the ‘true’ or ‘false’ branch based on the value in this array.This attribute may be left undefined, and the default value is false (0) for all nodes.

nodes_modes

Attribute. The node kind, that is, the comparison to make at the node. There is no comparison to make at a leaf node.One of ‘BRANCH_LEQ’, ‘BRANCH_LT’, ‘BRANCH_GTE’, ‘BRANCH_GT’, ‘BRANCH_EQ’, ‘BRANCH_NEQ’, ‘LEAF’

nodes_nodeids

Attribute. Node id for each node. Ids may restart at zero for each tree, but it not required to.

nodes_treeids

Attribute. Tree id for each node.

nodes_truenodeids

Attribute. Child node if expression is true.

nodes_values

Attribute. Thresholds to do the splitting on for each node.

nodes_values_as_tensor

Attribute. Thresholds to do the splitting on for each node.

post_transform

Attribute. Indicates the transform to apply to the score. One of ‘NONE,’ ‘SOFTMAX,’ ‘LOGISTIC,’ ‘SOFTMAX_ZERO,’ or ‘PROBIT.’

Returns:
YVar

Type T2. N, Top class for each point

ZVar

Type tensor(float). The class score for each class, for each point, a tensor of shape [N,E].

Notes

Signature: ai.onnx.ml@3::TreeEnsembleClassifier.

Type constraints:
  • T1: tensor(double), tensor(float), tensor(int32), tensor(int64)

  • T2: tensor(int64), tensor(string)

spox.opset.ai.onnx.ml.v4.tree_ensemble_regressor(X: Var, *, aggregate_function: str = 'SUM', base_values: Iterable[float] | None = None, base_values_as_tensor: ndarray | None = None, n_targets: int | None = None, nodes_falsenodeids: Iterable[int] | None = None, nodes_featureids: Iterable[int] | None = None, nodes_hitrates: Iterable[float] | None = None, nodes_hitrates_as_tensor: ndarray | None = None, nodes_missing_value_tracks_true: Iterable[int] | None = None, nodes_modes: Iterable[str] | None = None, nodes_nodeids: Iterable[int] | None = None, nodes_treeids: Iterable[int] | None = None, nodes_truenodeids: Iterable[int] | None = None, nodes_values: Iterable[float] | None = None, nodes_values_as_tensor: ndarray | None = None, post_transform: str = 'NONE', target_ids: Iterable[int] | None = None, target_nodeids: Iterable[int] | None = None, target_treeids: Iterable[int] | None = None, target_weights: Iterable[float] | None = None, target_weights_as_tensor: ndarray | None = None) Var[source]

Tree Ensemble regressor. Returns the regressed values for each input in N. All args with nodes_ are fields of a tuple of tree nodes, and it is assumed they are the same length, and an index i will decode the tuple across these inputs. Each node id can appear only once for each tree id. All fields prefixed with target_ are tuples of votes at the leaves. A leaf may have multiple votes, where each vote is weighted by the associated target_weights index. All fields ending with _as_tensor can be used instead of the same parameter without the suffix if the element type is double and not float. All trees must have their node ids start at 0 and increment by 1. Mode enum is BRANCH_LEQ, BRANCH_LT, BRANCH_GTE, BRANCH_GT, BRANCH_EQ, BRANCH_NEQ, LEAF

Parameters:
X

Type T. Input of shape [N,F]

aggregate_function

Attribute. Defines how to aggregate leaf values within a target. One of ‘AVERAGE,’ ‘SUM,’ ‘MIN,’ ‘MAX.’

base_values

Attribute. Base values for regression, added to final prediction after applying aggregate_function; the size must be the same as the classes or can be left unassigned (assumed 0)

base_values_as_tensor

Attribute. Base values for regression, added to final prediction after applying aggregate_function; the size must be the same as the classes or can be left unassigned (assumed 0)

n_targets

Attribute. The total number of targets.

nodes_falsenodeids

Attribute. Child node if expression is false

nodes_featureids

Attribute. Feature id for each node.

nodes_hitrates

Attribute. Popularity of each node, used for performance and may be omitted.

nodes_hitrates_as_tensor

Attribute. Popularity of each node, used for performance and may be omitted.

nodes_missing_value_tracks_true

Attribute. For each node, define what to do in the presence of a NaN: use the ‘true’ (if the attribute value is 1) or ‘false’ (if the attribute value is 0) branch based on the value in this array.This attribute may be left undefined and the default value is false (0) for all nodes.

nodes_modes

Attribute. The node kind, that is, the comparison to make at the node. There is no comparison to make at a leaf node.One of ‘BRANCH_LEQ’, ‘BRANCH_LT’, ‘BRANCH_GTE’, ‘BRANCH_GT’, ‘BRANCH_EQ’, ‘BRANCH_NEQ’, ‘LEAF’

nodes_nodeids

Attribute. Node id for each node. Node ids must restart at zero for each tree and increase sequentially.

nodes_treeids

Attribute. Tree id for each node.

nodes_truenodeids

Attribute. Child node if expression is true

nodes_values

Attribute. Thresholds to do the splitting on for each node.

nodes_values_as_tensor

Attribute. Thresholds to do the splitting on for each node.

post_transform

Attribute. Indicates the transform to apply to the score. One of ‘NONE,’ ‘SOFTMAX,’ ‘LOGISTIC,’ ‘SOFTMAX_ZERO,’ or ‘PROBIT’

target_ids

Attribute. The index of the target that each weight is for

target_nodeids

Attribute. The node id of each weight

target_treeids

Attribute. The id of the tree that each node is in.

target_weights

Attribute. The weight for each target

target_weights_as_tensor

Attribute. The weight for each target

Returns:
YVar

Type tensor(float). N classes

Notes

Signature: ai.onnx.ml@3::TreeEnsembleRegressor.

Type constraints:
  • T: tensor(double), tensor(float), tensor(int32), tensor(int64)

spox.opset.ai.onnx.ml.v4.zip_map(X: Var, *, classlabels_int64s: Iterable[int] | None = None, classlabels_strings: Iterable[str] | None = None) Var[source]

Creates a map from the input and the attributes. The values are provided by the input tensor, while the keys are specified by the attributes. Must provide keys in either classlabels_strings or classlabels_int64s (but not both). The columns of the tensor correspond one-by-one to the keys specified by the attributes. There must be as many columns as keys.

Parameters:
X

Type tensor(float). The input values

classlabels_int64s

Attribute. The keys when using int keys.One and only one of the ‘classlabels_*’ attributes must be defined.

classlabels_strings

Attribute. The keys when using string keys.One and only one of the ‘classlabels_*’ attributes must be defined.

Returns:
ZVar

Type T. The output map

Notes

Signature: ai.onnx.ml@1::ZipMap.

Type constraints:
  • T: seq(map(int64,tensor(float))), seq(map(string,tensor(float)))