def calculate_sparkml_scaler_output_shapes(operator): check_input_and_output_numbers(operator, output_count_range=1) check_input_and_output_types( operator, good_input_types=[FloatTensorType, Int64TensorType]) input_shape = copy.deepcopy(operator.inputs[0].type.shape) operator.outputs[0].type = FloatTensorType(input_shape)
def calculate_one_vs_rest_output_shapes(operator): check_input_and_output_numbers(operator, input_count_range=1, output_count_range=1) check_input_and_output_types(operator, good_input_types=[FloatTensorType, Int64TensorType]) if len(operator.inputs[0].type.shape) != 2: raise RuntimeError('Input must be a [N, C]-tensor') N = operator.inputs[0].type.shape[0] operator.outputs[0].type = Int64TensorType(shape=[N])
def calculate_sparkml_naive_bayes_output_shapes(operator): check_input_and_output_numbers(operator, output_count_range=2) check_input_and_output_types(operator, good_input_types=[FloatTensorType], good_output_types=[FloatTensorType,FloatTensorType]) N = operator.inputs[0].type.shape[0] C = operator.raw_operator.numClasses operator.outputs[0].type = FloatTensorType([N, 1]) operator.outputs[1].type = FloatTensorType([N, C])
def calculate_bucketizer_output_shapes(operator): check_input_and_output_numbers(operator, input_count_range=1, output_count_range=1) check_input_and_output_types(operator, good_input_types=[FloatTensorType], good_output_types=[FloatTensorType]) input_type = copy.deepcopy(operator.inputs[0].type) for output in operator.outputs: output.type = input_type
def calculate_sparkml_polynomial_expansion_output_shapes(operator): check_input_and_output_numbers(operator, output_count_range=1) check_input_and_output_types( operator, good_input_types=[FloatTensorType, Int64TensorType]) N = operator.inputs[0].type.shape[0] C = get_combinations_count(operator.inputs[0].type.shape[1], operator.raw_operator.getDegree()) operator.outputs[0].type = copy.deepcopy(operator.inputs[0].type) operator.outputs[0].type.shape = [N, C]
def calculate_imputer_output_shapes(operator): check_input_and_output_numbers( operator, output_count_range=[1, len(operator.outputs)]) check_input_and_output_types( operator, good_input_types=[FloatTensorType, Int64TensorType], good_output_types=[FloatTensorType, Int64TensorType]) input_type = copy.deepcopy(operator.inputs[0].type) for output in operator.outputs: output.type = input_type
def calculate_gbt_classifier_output_shapes(operator): check_input_and_output_numbers(operator, input_count_range=1, output_count_range=[1, 2]) check_input_and_output_types( operator, good_input_types=[FloatTensorType, Int64TensorType]) if len(operator.inputs[0].type.shape) != 2: raise RuntimeError('Input must be a [N, C]-tensor') N = operator.inputs[0].type.shape[0] operator.outputs[0].type = Int64TensorType(shape=[N]) if isinstance(operator.raw_operator, GBTClassificationModel): class_count = 2 operator.outputs[1].type = FloatTensorType([N, class_count])
def calculate_decision_tree_classifier_output_shapes(operator): check_input_and_output_numbers(operator, input_count_range=1, output_count_range=[1, 2]) check_input_and_output_types( operator, good_input_types=[FloatTensorType, Int64TensorType]) if len(operator.inputs[0].type.shape) != 2: raise RuntimeError('Input must be a [N, C]-tensor') N = operator.inputs[0].type.shape[0] class_count = operator.raw_operator.numClasses operator.outputs[0].type = Int64TensorType(shape=[N]) operator.outputs[1].type = FloatTensorType([N, class_count])
def calculate_sparkml_tokenizer_output_shapes(operator): check_input_and_output_numbers(operator, output_count_range=1) check_input_and_output_types(operator, good_input_types=[StringTensorType]) operator.outputs[0].type = StringTensorType()
def calculate_sparkml_pca_output_shapes(operator): check_input_and_output_numbers(operator, output_count_range=1) check_input_and_output_types(operator, good_input_types=[FloatTensorType]) N = operator.inputs[0].type.shape[0] operator.outputs[0].type = FloatTensorType([N, operator.raw_operator.getOrDefault('k')])
def calculate_element_wise_product_output_shapes(operator): check_input_and_output_numbers(operator, output_count_range=1) check_input_and_output_types(operator, good_input_types=[FloatTensorType]) N = operator.inputs[0].type.shape[0] operator.outputs[0].type = FloatTensorType( [N, operator.inputs[0].type.shape[1]])
def calculate_decision_tree_regressor_output_shapes(operator): check_input_and_output_numbers(operator, input_count_range=1, output_count_range=1) N = operator.inputs[0].type.shape[0] operator.outputs[0].type = FloatTensorType(shape=[N, 1])
def calculate_sparkml_stop_words_remover_output_shapes(operator): check_input_and_output_numbers(operator, output_count_range=1) check_input_and_output_types(operator, good_input_types=[StringTensorType]) input_shape = copy.deepcopy(operator.inputs[0].type.shape) operator.outputs[0].type = StringTensorType(input_shape)