This is an automated email from the ASF dual-hosted git repository. baunsgaard pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/systemds.git
commit dbcce57719e0cc802bdd2da80463ebc2435d5004 Author: baunsgaard <[email protected]> AuthorDate: Thu Jun 3 12:33:45 2021 +0200 [SYSTEMDS-3005] Python Multi Return in AutoGenerator This commit change the auto-generator to return multi return nodes, in case of multiple returns from function calls. It is implemented such that returns can be iterated in a python like fashion. Get Nodes Back x,y = f(b,c) t = f(b,c) x = t[0] y = t[1] Get results Back x, y = f(b,c).compute() --- src/main/python/generator/generator.py | 117 ++++++++++++--------- .../resources/template_python_script_imports | 2 +- .../python/systemds/operator/algorithm/__init__.py | 13 ++- .../systemds/operator/algorithm/builtin/abstain.py | 6 +- .../systemds/operator/algorithm/builtin/als.py | 14 ++- .../systemds/operator/algorithm/builtin/alsCG.py | 14 ++- .../systemds/operator/algorithm/builtin/alsDS.py | 14 ++- .../operator/algorithm/builtin/alsPredict.py | 6 +- .../operator/algorithm/builtin/alsTopkPredict.py | 14 ++- .../systemds/operator/algorithm/builtin/arima.py | 6 +- .../systemds/operator/algorithm/builtin/bandit.py | 18 +++- .../systemds/operator/algorithm/builtin/bivar.py | 18 +++- .../operator/algorithm/builtin/components.py | 6 +- .../operator/algorithm/builtin/confusionMatrix.py | 14 ++- .../systemds/operator/algorithm/builtin/cor.py | 6 +- .../systemds/operator/algorithm/builtin/cox.py | 22 +++- .../systemds/operator/algorithm/builtin/cspline.py | 14 ++- .../operator/algorithm/builtin/csplineDS.py | 14 ++- .../systemds/operator/algorithm/builtin/cvlm.py | 14 ++- .../systemds/operator/algorithm/builtin/dbscan.py | 6 +- .../operator/algorithm/builtin/decisionTree.py | 6 +- .../operator/algorithm/builtin/discoverFD.py | 6 +- .../systemds/operator/algorithm/builtin/dist.py | 6 +- .../builtin/{dbscan.py => executePipeline.py} | 14 ++- .../algorithm/builtin/gaussianClassifier.py | 17 ++- .../operator/algorithm/builtin/getAccuracy.py | 6 +- .../systemds/operator/algorithm/builtin/glm.py | 6 +- .../systemds/operator/algorithm/builtin/gmm.py | 24 ++++- .../operator/algorithm/builtin/gmmPredict.py | 14 ++- .../systemds/operator/algorithm/builtin/gnmf.py | 14 ++- .../operator/algorithm/builtin/hyperband.py | 14 ++- .../operator/algorithm/builtin/img_brightness.py | 6 +- .../operator/algorithm/builtin/img_crop.py | 6 +- .../algorithm/builtin/{arima.py => img_cutout.py} | 32 +++--- .../builtin/{tomeklink.py => img_invert.py} | 16 +-- .../operator/algorithm/builtin/img_mirror.py | 6 +- .../builtin/{tomeklink.py => img_posterize.py} | 17 +-- .../algorithm/builtin/{bivar.py => img_rotate.py} | 18 ++-- .../builtin/{bivar.py => img_sample_pairing.py} | 17 +-- .../algorithm/builtin/{bivar.py => img_shear.py} | 19 ++-- .../builtin/{arima.py => img_transform.py} | 31 +++--- .../builtin/{arima.py => img_translate.py} | 32 +++--- .../operator/algorithm/builtin/imputeByFD.py | 6 +- .../operator/algorithm/builtin/imputeByMean.py | 6 +- .../operator/algorithm/builtin/imputeByMedian.py | 6 +- .../operator/algorithm/builtin/imputeByMode.py | 6 +- .../operator/algorithm/builtin/intersect.py | 6 +- .../systemds/operator/algorithm/builtin/km.py | 18 +++- .../systemds/operator/algorithm/builtin/kmeans.py | 14 ++- .../operator/algorithm/builtin/kmeansPredict.py | 6 +- .../systemds/operator/algorithm/builtin/knnbf.py | 6 +- .../systemds/operator/algorithm/builtin/l2svm.py | 6 +- .../operator/algorithm/builtin/l2svmPredict.py | 14 ++- .../systemds/operator/algorithm/builtin/lasso.py | 6 +- .../systemds/operator/algorithm/builtin/lm.py | 6 +- .../systemds/operator/algorithm/builtin/lmCG.py | 6 +- .../systemds/operator/algorithm/builtin/lmDS.py | 6 +- .../operator/algorithm/builtin/lmPredict.py | 6 +- .../operator/algorithm/builtin/logSumExp.py | 6 +- .../systemds/operator/algorithm/builtin/msvm.py | 6 +- .../operator/algorithm/builtin/msvmPredict.py | 14 ++- .../operator/algorithm/builtin/multiLogReg.py | 6 +- .../algorithm/builtin/multiLogRegPredict.py | 16 ++- .../systemds/operator/algorithm/builtin/na_locf.py | 6 +- .../operator/algorithm/builtin/naiveBayes.py | 16 ++- .../algorithm/builtin/naiveBayesPredict.py | 14 ++- .../operator/algorithm/builtin/normalize.py | 6 +- .../systemds/operator/algorithm/builtin/outlier.py | 6 +- .../operator/algorithm/builtin/outlierByArima.py | 6 +- .../operator/algorithm/builtin/outlierByIQR.py | 6 +- .../operator/algorithm/builtin/outlierBySd.py | 6 +- .../systemds/operator/algorithm/builtin/pca.py | 18 +++- .../systemds/operator/algorithm/builtin/pnmf.py | 14 ++- .../systemds/operator/algorithm/builtin/ppca.py | 14 ++- .../operator/algorithm/builtin/randomForest.py | 18 +++- .../systemds/operator/algorithm/builtin/scale.py | 16 ++- .../operator/algorithm/builtin/scaleApply.py | 6 +- .../operator/algorithm/builtin/sherlock.py | 70 +++++++++++- .../operator/algorithm/builtin/sherlockPredict.py | 6 +- .../systemds/operator/algorithm/builtin/sigmoid.py | 6 +- .../operator/algorithm/builtin/slicefinder.py | 16 ++- .../systemds/operator/algorithm/builtin/smote.py | 6 +- .../systemds/operator/algorithm/builtin/split.py | 18 +++- .../operator/algorithm/builtin/splitBalanced.py | 18 +++- .../operator/algorithm/builtin/stableMarriage.py | 6 +- .../systemds/operator/algorithm/builtin/statsNA.py | 6 +- .../systemds/operator/algorithm/builtin/steplm.py | 14 ++- .../operator/algorithm/builtin/toOneHot.py | 6 +- .../operator/algorithm/builtin/tomeklink.py | 16 ++- .../systemds/operator/algorithm/builtin/univar.py | 6 +- .../operator/algorithm/builtin/vectorToCsv.py | 6 +- .../operator/algorithm/builtin/winsorize.py | 6 +- .../systemds/operator/algorithm/builtin/xdummy1.py | 6 +- .../systemds/operator/algorithm/builtin/xdummy2.py | 14 ++- src/main/python/systemds/operator/nodes/frame.py | 2 +- .../python/systemds/operator/operation_node.py | 7 +- .../python/tests/frame/test_transform_encode.py | 5 +- 97 files changed, 916 insertions(+), 313 deletions(-) diff --git a/src/main/python/generator/generator.py b/src/main/python/generator/generator.py index bca008a..7ee39e3 100644 --- a/src/main/python/generator/generator.py +++ b/src/main/python/generator/generator.py @@ -97,14 +97,12 @@ class PythonAPIFunctionGenerator(object): api_template = u"""def {function_name}({parameters}): {header} {params_dict} - return {api_call}\n\n + {api_call}\n\n """ kwargs_parameter_string = u"**kwargs: Dict[str, VALID_INPUT_TYPES]" kwargs_result = u"params_dict.update(kwargs)" - matrix_check_template = u"\n {param}._check_matrix_op()" - type_mapping_file = os.path.join('resources', 'type_mapping.json') type_mapping_pattern = r"^([^\[\s]+)" @@ -112,8 +110,8 @@ class PythonAPIFunctionGenerator(object): path = os.path.dirname(__file__) type_mapping_path = os.path.join(path, type_mapping_file) - with open(type_mapping_path, 'r') as megamap: - type_mapping = json.load(megamap) + with open(type_mapping_path, 'r') as mapping: + type_mapping = json.load(mapping) def __init__(self): super(PythonAPIFunctionGenerator, self).__init__() @@ -201,47 +199,27 @@ class PythonAPIFunctionGenerator(object): ) return result - def format_api_call( - self, - parameters: List[Tuple[str]], - return_values: List[Tuple[str]], - function_name: str - ) -> str: + def format_api_call(self, + parameters: List[Tuple[str]], + return_values: List[Tuple[str]], + function_name: str + ) -> str: + nl = "\n\t\t" length = len(return_values) - result = "Matrix({params})" param_string = "" param = parameters[0] + sds_context = "{param}.sds_context".format(param=param[0]) pattern = r"^[^\[]+" if length > 1: - output_type_list = "" - for value in return_values: - output_type = re.search(pattern, value[1])[0].upper() - - if len(output_type_list): - output_type_list = "{output_type_list}, ".format( - output_type_list=output_type_list - ) - else: - output_type_list = "output_types=[" - - output_type_list = "{output_type_list}OutputType.{typ}".format( - output_type_list=output_type_list, - typ=output_type - ) - output_type_list = "{output_type_list}]".format( - output_type_list=output_type_list - ) - output_type = "LIST, number_of_outputs={n}, {output_type_list}".format( - n=length, - output_type_list=output_type_list + output_nodes_str, op_assignments = self.generate_output_nodes( + return_values, pattern, sds_context) + multi_return_str = self.generate_multireturn( + sds_context, function_name) + result = "\n{out_nodes}\n\n{multi_return}\n\n{op_assign}\n\n return op".format( + out_nodes=output_nodes_str, + multi_return=multi_return_str, + op_assign=op_assignments ) - result = "{param}.sds_context, \'{function_name}\', named_input_nodes=params_dict, " \ - "output_type=OutputType.{output_type}".format( - param=param[0], - function_name=function_name, - output_type=output_type - ) - result = "OperationNode({params})".format(params=result) return result else: value = return_values[0] @@ -250,13 +228,51 @@ class PythonAPIFunctionGenerator(object): output_type = output_type[0].upper() else: raise AttributeError("Error in pattern match") - result = "{param}.sds_context, \'{function_name}\', named_input_nodes=params_dict".format( - param=param[0], - function_name=function_name, + result = ("{sds_context}," + + "{nl}\'{function_name}\'," + + "{nl}named_input_nodes=params_dict").format( + sds_context=sds_context, + function_name=function_name, + nl=nl ) - result = "Matrix({params})".format(params=result) + result = "return Matrix({params})".format(params=result) return result + def generate_output_nodes(self, return_values, pattern, sds_context): + lines = [] + op_assignment = [] + output_nodes = "\n output_nodes = [" + for idx, value in enumerate(return_values): + output_type = re.search(pattern, value[1])[0].upper() + # print(output_type) + output_type = output_type.lower() + if output_type == "matrix": + object_type= "Matrix" + elif output_type == "frame": + object_type = "Frame" + elif output_type == "double": + object_type = "Scalar" + elif output_type == "boolean": + object_type = "Scalar" + elif output_type == "integer": + object_type = "Scalar" + else: + raise ValueError("Unknown type " + object_type) + lines.append(" vX_{idx} = {obj}({sds}, '')".format( + idx=idx,obj = object_type, sds=sds_context)) + output_nodes += "vX_{idx}, ".format(idx=idx) + op_assignment.append( + " vX_{idx}._unnamed_input_nodes = [op]".format(idx=idx)) + output_nodes += "]" + lines = "\n".join(lines) + output_nodes + op_assignment = "\n".join(op_assignment) + return lines, op_assignment + + def generate_multireturn(self, sds_context, function_name): + return (" op = MultiReturn({sds}, \'{function_name}\', output_nodes," + + " named_input_nodes=params_dict)").format( + sds=sds_context, function_name=function_name) + class PythonAPIDocumentationGenerator(object): @@ -316,8 +332,8 @@ if __name__ == "__main__": fun_generator = PythonAPIFunctionGenerator() f_parser = FunctionParser(source_path) doc_generator = PythonAPIDocumentationGenerator() - - for dml_file in f_parser.files(): + files = f_parser.files() + for dml_file in files: try: header_data = f_parser.parse_header(dml_file) data = f_parser.parse_function(dml_file) @@ -332,5 +348,12 @@ if __name__ == "__main__": continue file_generator.generate_file( data["function_name"], script_content, dml_file) - + # [print(x) for x in enumerate(files)] + # dml_file = next(x for i, x in enumerate(files) if i == 80) + # header_data = f_parser.parse_header(dml_file) + # data = f_parser.parse_function(dml_file) + # f_parser.check_parameters(header_data, data) + # data['function_header'] = doc_generator.generate_documentation( + # header_data) + # script_content = fun_generator.generate_function(data) file_generator.generate_init_file() diff --git a/src/main/python/generator/resources/template_python_script_imports b/src/main/python/generator/resources/template_python_script_imports index adf6c30..fdc16c7 100644 --- a/src/main/python/generator/resources/template_python_script_imports +++ b/src/main/python/generator/resources/template_python_script_imports @@ -1,7 +1,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES diff --git a/src/main/python/systemds/operator/algorithm/__init__.py b/src/main/python/systemds/operator/algorithm/__init__.py index 448f51b..d6f281b 100644 --- a/src/main/python/systemds/operator/algorithm/__init__.py +++ b/src/main/python/systemds/operator/algorithm/__init__.py @@ -41,17 +41,24 @@ from .builtin.dbscan import dbscan from .builtin.decisionTree import decisionTree from .builtin.discoverFD import discoverFD from .builtin.dist import dist -from .builtin.gaussianClassifier import gaussianClassifier +from .builtin.executePipeline import executePipeline from .builtin.getAccuracy import getAccuracy from .builtin.glm import glm from .builtin.gmm import gmm from .builtin.gmmPredict import gmmPredict from .builtin.gnmf import gnmf -from .builtin.gridSearch import gridSearch from .builtin.hyperband import hyperband from .builtin.img_brightness import img_brightness from .builtin.img_crop import img_crop +from .builtin.img_cutout import img_cutout +from .builtin.img_invert import img_invert from .builtin.img_mirror import img_mirror +from .builtin.img_posterize import img_posterize +from .builtin.img_rotate import img_rotate +from .builtin.img_sample_pairing import img_sample_pairing +from .builtin.img_shear import img_shear +from .builtin.img_transform import img_transform +from .builtin.img_translate import img_translate from .builtin.imputeByFD import imputeByFD from .builtin.imputeByMean import imputeByMean from .builtin.imputeByMedian import imputeByMedian @@ -105,4 +112,4 @@ from .builtin.winsorize import winsorize from .builtin.xdummy1 import xdummy1 from .builtin.xdummy2 import xdummy2 -__all__ = [abstain, als, alsCG, alsDS, alsPredict, alsTopkPredict, arima, bandit, bivar, components, confusionMatrix, cor, cox, cspline, csplineDS, cvlm, dbscan, decisionTree, discoverFD, dist, gaussianClassifier, getAccuracy, glm, gmm, gmmPredict, gnmf, gridSearch, hyperband, img_brightness, img_crop, img_mirror, imputeByFD, imputeByMean, imputeByMedian, imputeByMode, intersect, km, kmeans, kmeansPredict, knnbf, l2svm, l2svmPredict, lasso, lm, lmCG, lmDS, lmPredict, logSumExp, msvm, msv [...] +__all__ = [abstain, als, alsCG, alsDS, alsPredict, alsTopkPredict, arima, bandit, bivar, components, confusionMatrix, cor, cox, cspline, csplineDS, cvlm, dbscan, decisionTree, discoverFD, dist, executePipeline, getAccuracy, glm, gmm, gmmPredict, gnmf, hyperband, img_brightness, img_crop, img_cutout, img_invert, img_mirror, img_posterize, img_rotate, img_sample_pairing, img_shear, img_transform, img_translate, imputeByFD, imputeByMean, imputeByMedian, imputeByMode, intersect, km, kmeans, [...] diff --git a/src/main/python/systemds/operator/algorithm/builtin/abstain.py b/src/main/python/systemds/operator/algorithm/builtin/abstain.py index bcc1267..26e8b27 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/abstain.py +++ b/src/main/python/systemds/operator/algorithm/builtin/abstain.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,9 @@ def abstain(X: OperationNode, Y: OperationNode, threshold: float, **kwargs: Dict params_dict = {'X':X, 'Y':Y, 'threshold':threshold} params_dict.update(kwargs) - return Matrix(X.sds_context, 'abstain', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'abstain', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/als.py b/src/main/python/systemds/operator/algorithm/builtin/als.py index b7147ad..f57630b 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/als.py +++ b/src/main/python/systemds/operator/algorithm/builtin/als.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -43,7 +43,17 @@ def als(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): """ params_dict = {'X':X} params_dict.update(kwargs) - return OperationNode(X.sds_context, 'als', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(X.sds_context, 'als', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/alsCG.py b/src/main/python/systemds/operator/algorithm/builtin/alsCG.py index 40589b9..6a43aaa 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/alsCG.py +++ b/src/main/python/systemds/operator/algorithm/builtin/alsCG.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -43,7 +43,17 @@ def alsCG(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): """ params_dict = {'X':X} params_dict.update(kwargs) - return OperationNode(X.sds_context, 'alsCG', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(X.sds_context, 'alsCG', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/alsDS.py b/src/main/python/systemds/operator/algorithm/builtin/alsDS.py index f4ca722..e543493 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/alsDS.py +++ b/src/main/python/systemds/operator/algorithm/builtin/alsDS.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -44,7 +44,17 @@ def alsDS(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): """ params_dict = {'X':X} params_dict.update(kwargs) - return OperationNode(X.sds_context, 'alsDS', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(X.sds_context, 'alsDS', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/alsPredict.py b/src/main/python/systemds/operator/algorithm/builtin/alsPredict.py index d22dbc6..26a4e16 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/alsPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/alsPredict.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def alsPredict(userIDs: OperationNode, I: OperationNode, L: OperationNode, R: OperationNode): params_dict = {'userIDs':userIDs, 'I':I, 'L':L, 'R':R} - return Matrix(userIDs.sds_context, 'alsPredict', named_input_nodes=params_dict) + return Matrix(userIDs.sds_context, + 'alsPredict', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/alsTopkPredict.py b/src/main/python/systemds/operator/algorithm/builtin/alsTopkPredict.py index afd560b..b7cb189 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/alsTopkPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/alsTopkPredict.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -39,7 +39,17 @@ def alsTopkPredict(userIDs: OperationNode, I: OperationNode, L: OperationNode, R """ params_dict = {'userIDs':userIDs, 'I':I, 'L':L, 'R':R} params_dict.update(kwargs) - return OperationNode(userIDs.sds_context, 'alsTopkPredict', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(userIDs.sds_context, '') + vX_1 = Matrix(userIDs.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(userIDs.sds_context, 'alsTopkPredict', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/arima.py b/src/main/python/systemds/operator/algorithm/builtin/arima.py index 892cc5a..decc43c 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/arima.py +++ b/src/main/python/systemds/operator/algorithm/builtin/arima.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -45,7 +45,9 @@ def arima(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): """ params_dict = {'X':X} params_dict.update(kwargs) - return Matrix(X.sds_context, 'arima', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'arima', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/bandit.py b/src/main/python/systemds/operator/algorithm/builtin/bandit.py index 02a2107..cd866c3 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/bandit.py +++ b/src/main/python/systemds/operator/algorithm/builtin/bandit.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,21 @@ def bandit(X_train: OperationNode, Y_train: OperationNode, metaList: Iterable, t params_dict = {'X_train':X_train, 'Y_train':Y_train, 'metaList':metaList, 'targetList':targetList, 'lp':lp, 'primitives':primitives, 'param':param} params_dict.update(kwargs) - return OperationNode(X_train.sds_context, 'bandit', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=4, output_types=[OutputType.FRAME, OutputType.MATRIX, OutputType.MATRIX, OutputType.FRAME]) + + vX_0 = Frame(X_train.sds_context, '') + vX_1 = Matrix(X_train.sds_context, '') + vX_2 = Matrix(X_train.sds_context, '') + vX_3 = Frame(X_train.sds_context, '') + output_nodes = [vX_0, vX_1, vX_2, vX_3, ] + + op = MultiReturn(X_train.sds_context, 'bandit', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + vX_2._unnamed_input_nodes = [op] + vX_3._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/bivar.py b/src/main/python/systemds/operator/algorithm/builtin/bivar.py index 6f2bcec..9a9a04d 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/bivar.py +++ b/src/main/python/systemds/operator/algorithm/builtin/bivar.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -34,7 +34,21 @@ def bivar(X: OperationNode, S1: OperationNode, S2: OperationNode, T1: OperationN :return: 'OperationNode' containing """ params_dict = {'X':X, 'S1':S1, 'S2':S2, 'T1':T1, 'T2':T2, 'verbose':verbose} - return OperationNode(X.sds_context, 'bivar', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=4, output_types=[OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + vX_2 = Matrix(X.sds_context, '') + vX_3 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, vX_2, vX_3, ] + + op = MultiReturn(X.sds_context, 'bivar', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + vX_2._unnamed_input_nodes = [op] + vX_3._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/components.py b/src/main/python/systemds/operator/algorithm/builtin/components.py index 111da45..386db83 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/components.py +++ b/src/main/python/systemds/operator/algorithm/builtin/components.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,9 @@ def components(G: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): params_dict = {'G':G} params_dict.update(kwargs) - return Matrix(G.sds_context, 'components', named_input_nodes=params_dict) + return Matrix(G.sds_context, + 'components', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/confusionMatrix.py b/src/main/python/systemds/operator/algorithm/builtin/confusionMatrix.py index 5e57fde..d124936 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/confusionMatrix.py +++ b/src/main/python/systemds/operator/algorithm/builtin/confusionMatrix.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -35,7 +35,17 @@ def confusionMatrix(P: OperationNode, Y: OperationNode): :return: 'OperationNode' containing the confusion matrix sums of classifications & the confusion matrix averages of each true class """ params_dict = {'P':P, 'Y':Y} - return OperationNode(P.sds_context, 'confusionMatrix', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(P.sds_context, '') + vX_1 = Matrix(P.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(P.sds_context, 'confusionMatrix', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/cor.py b/src/main/python/systemds/operator/algorithm/builtin/cor.py index 33e6ddd..9c0d632 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/cor.py +++ b/src/main/python/systemds/operator/algorithm/builtin/cor.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def cor(X: OperationNode): params_dict = {'X':X} - return Matrix(X.sds_context, 'cor', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'cor', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/cox.py b/src/main/python/systemds/operator/algorithm/builtin/cox.py index 1bfe85c..ebc12c7 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/cox.py +++ b/src/main/python/systemds/operator/algorithm/builtin/cox.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -48,7 +48,25 @@ def cox(X: OperationNode, TE: OperationNode, F: OperationNode, R: OperationNode, """ params_dict = {'X':X, 'TE':TE, 'F':F, 'R':R} params_dict.update(kwargs) - return OperationNode(X.sds_context, 'cox', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=6, output_types=[OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + vX_2 = Matrix(X.sds_context, '') + vX_3 = Matrix(X.sds_context, '') + vX_4 = Matrix(X.sds_context, '') + vX_5 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, vX_2, vX_3, vX_4, vX_5, ] + + op = MultiReturn(X.sds_context, 'cox', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + vX_2._unnamed_input_nodes = [op] + vX_3._unnamed_input_nodes = [op] + vX_4._unnamed_input_nodes = [op] + vX_5._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/cspline.py b/src/main/python/systemds/operator/algorithm/builtin/cspline.py index d60bf4f..8c2af13 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/cspline.py +++ b/src/main/python/systemds/operator/algorithm/builtin/cspline.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,17 @@ def cspline(X: OperationNode, Y: OperationNode, inp_x: float, **kwargs: Dict[str params_dict = {'X':X, 'Y':Y, 'inp_x':inp_x} params_dict.update(kwargs) - return OperationNode(X.sds_context, 'cspline', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(X.sds_context, 'cspline', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/csplineDS.py b/src/main/python/systemds/operator/algorithm/builtin/csplineDS.py index 34d0d13..b4a3d6c 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/csplineDS.py +++ b/src/main/python/systemds/operator/algorithm/builtin/csplineDS.py @@ -24,14 +24,24 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def csplineDS(X: OperationNode, Y: OperationNode, inp_x: float): params_dict = {'X':X, 'Y':Y, 'inp_x':inp_x} - return OperationNode(X.sds_context, 'csplineDS', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(X.sds_context, 'csplineDS', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/cvlm.py b/src/main/python/systemds/operator/algorithm/builtin/cvlm.py index 72d5159..410910f 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/cvlm.py +++ b/src/main/python/systemds/operator/algorithm/builtin/cvlm.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,17 @@ def cvlm(X: OperationNode, y: OperationNode, k: int, **kwargs: Dict[str, VALID_I params_dict = {'X':X, 'y':y, 'k':k} params_dict.update(kwargs) - return OperationNode(X.sds_context, 'cvlm', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(X.sds_context, 'cvlm', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/dbscan.py b/src/main/python/systemds/operator/algorithm/builtin/dbscan.py index a2bb947..477510b 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/dbscan.py +++ b/src/main/python/systemds/operator/algorithm/builtin/dbscan.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,9 @@ def dbscan(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): params_dict = {'X':X} params_dict.update(kwargs) - return Matrix(X.sds_context, 'dbscan', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'dbscan', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/decisionTree.py b/src/main/python/systemds/operator/algorithm/builtin/decisionTree.py index dbd7523..5bc433f 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/decisionTree.py +++ b/src/main/python/systemds/operator/algorithm/builtin/decisionTree.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -39,7 +39,9 @@ def decisionTree(X: OperationNode, Y: OperationNode, R: OperationNode, verbose: """ params_dict = {'X':X, 'Y':Y, 'R':R, 'verbose':verbose} params_dict.update(kwargs) - return Matrix(X.sds_context, 'decisionTree', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'decisionTree', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/discoverFD.py b/src/main/python/systemds/operator/algorithm/builtin/discoverFD.py index b34e2bb..d5292e1 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/discoverFD.py +++ b/src/main/python/systemds/operator/algorithm/builtin/discoverFD.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def discoverFD(X: OperationNode, Mask: OperationNode, threshold: float): params_dict = {'X':X, 'Mask':Mask, 'threshold':threshold} - return Matrix(X.sds_context, 'discoverFD', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'discoverFD', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/dist.py b/src/main/python/systemds/operator/algorithm/builtin/dist.py index 47a0f22..02c7c6e 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/dist.py +++ b/src/main/python/systemds/operator/algorithm/builtin/dist.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def dist(X: OperationNode): params_dict = {'X':X} - return Matrix(X.sds_context, 'dist', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'dist', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/dbscan.py b/src/main/python/systemds/operator/algorithm/builtin/executePipeline.py similarity index 66% copy from src/main/python/systemds/operator/algorithm/builtin/dbscan.py copy to src/main/python/systemds/operator/algorithm/builtin/executePipeline.py index a2bb947..38d3ac1 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/dbscan.py +++ b/src/main/python/systemds/operator/algorithm/builtin/executePipeline.py @@ -20,19 +20,23 @@ # ------------------------------------------------------------- # Autogenerated By : src/main/python/generator/generator.py -# Autogenerated From : scripts/builtin/dbscan.dml +# Autogenerated From : scripts/builtin/executePipeline.dml from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def dbscan(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): - +def executePipeline(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + """ + :return: 'OperationNode' containing encoding of categorical features & features & ohe call, to call inside eval as a function & to call inside eval as a function & doing relative over-sampling & count & replace the null with default values & version of pca + """ params_dict = {'X':X} params_dict.update(kwargs) - return Matrix(X.sds_context, 'dbscan', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'executePipeline', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/gaussianClassifier.py b/src/main/python/systemds/operator/algorithm/builtin/gaussianClassifier.py index 8ce91e1..761e5c5 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/gaussianClassifier.py +++ b/src/main/python/systemds/operator/algorithm/builtin/gaussianClassifier.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -36,7 +36,20 @@ def gaussianClassifier(D: OperationNode, C: OperationNode, **kwargs: Dict[str, V """ params_dict = {'D':D, 'C':C} params_dict.update(kwargs) - return OperationNode(D.sds_context, 'gaussianClassifier', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=4, output_types=[OutputType.MATRIX, OutputType.MATRIX, OutputType.LIST, OutputType.MATRIX]) + + vX_0 = Matrix(D.sds_context, '') + vX_1 = Matrix(D.sds_context, '') + vX_3 = Matrix(D.sds_context, '') + output_nodes = [vX_0, vX_1, vX_2, vX_3, ] + + op = MultiReturn(D.sds_context, 'gaussianClassifier', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + vX_2._unnamed_input_nodes = [op] + vX_3._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/getAccuracy.py b/src/main/python/systemds/operator/algorithm/builtin/getAccuracy.py index 57ea544..736a9b3 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/getAccuracy.py +++ b/src/main/python/systemds/operator/algorithm/builtin/getAccuracy.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,9 @@ def getAccuracy(y: OperationNode, yhat: OperationNode, **kwargs: Dict[str, VALID params_dict = {'y':y, 'yhat':yhat} params_dict.update(kwargs) - return Matrix(y.sds_context, 'getAccuracy', named_input_nodes=params_dict) + return Matrix(y.sds_context, + 'getAccuracy', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/glm.py b/src/main/python/systemds/operator/algorithm/builtin/glm.py index 31c215c..b164815 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/glm.py +++ b/src/main/python/systemds/operator/algorithm/builtin/glm.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,9 @@ def glm(X: OperationNode, Y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPE params_dict = {'X':X, 'Y':Y} params_dict.update(kwargs) - return Matrix(X.sds_context, 'glm', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'glm', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/gmm.py b/src/main/python/systemds/operator/algorithm/builtin/gmm.py index 87f293c..f81ac4a 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/gmm.py +++ b/src/main/python/systemds/operator/algorithm/builtin/gmm.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,27 @@ def gmm(X: OperationNode, verbose: bool, **kwargs: Dict[str, VALID_INPUT_TYPES]) params_dict = {'X':X, 'verbose':verbose} params_dict.update(kwargs) - return OperationNode(X.sds_context, 'gmm', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=7, output_types=[OutputType.MATRIX, OutputType.MATRIX, OutputType.INTEGER, OutputType.DOUBLE, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + vX_2 = Scalar(X.sds_context, '') + vX_3 = Scalar(X.sds_context, '') + vX_4 = Matrix(X.sds_context, '') + vX_5 = Matrix(X.sds_context, '') + vX_6 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, vX_2, vX_3, vX_4, vX_5, vX_6, ] + + op = MultiReturn(X.sds_context, 'gmm', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + vX_2._unnamed_input_nodes = [op] + vX_3._unnamed_input_nodes = [op] + vX_4._unnamed_input_nodes = [op] + vX_5._unnamed_input_nodes = [op] + vX_6._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/gmmPredict.py b/src/main/python/systemds/operator/algorithm/builtin/gmmPredict.py index 773a803..2b5895a 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/gmmPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/gmmPredict.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -38,7 +38,17 @@ def gmmPredict(X: OperationNode, weight: OperationNode, mu: OperationNode, preci :return: 'OperationNode' containing predicted cluster labels & probabilities of belongingness & for new instances given the variance and mean of fitted data """ params_dict = {'X':X, 'weight':weight, 'mu':mu, 'precisions_cholesky':precisions_cholesky, 'model':model} - return OperationNode(X.sds_context, 'gmmPredict', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(X.sds_context, 'gmmPredict', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/gnmf.py b/src/main/python/systemds/operator/algorithm/builtin/gnmf.py index 2c548ff..ed69606 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/gnmf.py +++ b/src/main/python/systemds/operator/algorithm/builtin/gnmf.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,17 @@ def gnmf(X: OperationNode, rnk: int, **kwargs: Dict[str, VALID_INPUT_TYPES]): params_dict = {'X':X, 'rnk':rnk} params_dict.update(kwargs) - return OperationNode(X.sds_context, 'gnmf', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(X.sds_context, 'gnmf', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/hyperband.py b/src/main/python/systemds/operator/algorithm/builtin/hyperband.py index 6f67006..08d0bba 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/hyperband.py +++ b/src/main/python/systemds/operator/algorithm/builtin/hyperband.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,17 @@ def hyperband(X_train: OperationNode, y_train: OperationNode, X_val: OperationNo params_dict = {'X_train':X_train, 'y_train':y_train, 'X_val':X_val, 'y_val':y_val, 'params':params, 'paramRanges':paramRanges} params_dict.update(kwargs) - return OperationNode(X_train.sds_context, 'hyperband', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.FRAME]) + + vX_0 = Matrix(X_train.sds_context, '') + vX_1 = Frame(X_train.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(X_train.sds_context, 'hyperband', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/img_brightness.py b/src/main/python/systemds/operator/algorithm/builtin/img_brightness.py index d164682..171ecef 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/img_brightness.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_brightness.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def img_brightness(img_in: OperationNode, value: float, channel_max: int): params_dict = {'img_in':img_in, 'value':value, 'channel_max':channel_max} - return Matrix(img_in.sds_context, 'img_brightness', named_input_nodes=params_dict) + return Matrix(img_in.sds_context, + 'img_brightness', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/img_crop.py b/src/main/python/systemds/operator/algorithm/builtin/img_crop.py index 9800004..848dbdb 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/img_crop.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_crop.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def img_crop(img_in: OperationNode, w: int, h: int, x_offset: int, y_offset: int): params_dict = {'img_in':img_in, 'w':w, 'h':h, 'x_offset':x_offset, 'y_offset':y_offset} - return Matrix(img_in.sds_context, 'img_crop', named_input_nodes=params_dict) + return Matrix(img_in.sds_context, + 'img_crop', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/arima.py b/src/main/python/systemds/operator/algorithm/builtin/img_cutout.py similarity index 54% copy from src/main/python/systemds/operator/algorithm/builtin/arima.py copy to src/main/python/systemds/operator/algorithm/builtin/img_cutout.py index 892cc5a..60e55e8 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/arima.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_cutout.py @@ -20,32 +20,28 @@ # ------------------------------------------------------------- # Autogenerated By : src/main/python/generator/generator.py -# Autogenerated From : scripts/builtin/arima.dml +# Autogenerated From : scripts/builtin/img_cutout.dml from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def arima(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): +def img_cutout(img_in: OperationNode, x: int, y: int, width: int, height: int, fill_value: float): """ - :param X: The input Matrix to apply Arima on. - :param max_func_invoc: ? - :param p: non-seasonal AR order - :param d: non-seasonal differencing order - :param q: non-seasonal MA order - :param P: seasonal AR order - :param D: seasonal differencing order - :param Q: seasonal MA order - :param s: period in terms of number of time-steps - :param include_mean: center to mean 0, and include in result - :param solver: solver, is either "cg" or "jacobi" - :return: 'OperationNode' containing the calculated coefficients + :param img_in: Input image as 2D matrix with top left corner at [1, 1] + :param x: Column index of the top left corner of the rectangle (starting at 1) + :param y: Row index of the top left corner of the rectangle (starting at 1) + :param width: Width of the rectangle (must be positive) + :param height: Height of the rectangle (must be positive) + :param fill_value: The value to set for the rectangle + :return: 'OperationNode' containing output image as 2d matrix with top left corner at [1, 1] """ - params_dict = {'X':X} - params_dict.update(kwargs) - return Matrix(X.sds_context, 'arima', named_input_nodes=params_dict) + params_dict = {'img_in':img_in, 'x':x, 'y':y, 'width':width, 'height':height, 'fill_value':fill_value} + return Matrix(img_in.sds_context, + 'img_cutout', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/tomeklink.py b/src/main/python/systemds/operator/algorithm/builtin/img_invert.py similarity index 71% copy from src/main/python/systemds/operator/algorithm/builtin/tomeklink.py copy to src/main/python/systemds/operator/algorithm/builtin/img_invert.py index 499586e..76c9613 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/tomeklink.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_invert.py @@ -20,22 +20,24 @@ # ------------------------------------------------------------- # Autogenerated By : src/main/python/generator/generator.py -# Autogenerated From : scripts/builtin/tomeklink.dml +# Autogenerated From : scripts/builtin/img_invert.dml from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def tomeklink(X: OperationNode, y: OperationNode): +def img_invert(img_in: OperationNode, max_value: float): """ - :param X: Data Matrix (nxm) - :param y: Label Matrix (nx1) + :param img_in: Input image + :param max_value: The maximum value pixels can have :return: 'OperationNode' containing """ - params_dict = {'X':X, 'y':y} - return OperationNode(X.sds_context, 'tomeklink', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=3, output_types=[OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX]) + params_dict = {'img_in':img_in, 'max_value':max_value} + return Matrix(img_in.sds_context, + 'img_invert', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/img_mirror.py b/src/main/python/systemds/operator/algorithm/builtin/img_mirror.py index dff4c6c..3e1833e 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/img_mirror.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_mirror.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def img_mirror(img_in: OperationNode, horizontal_axis: bool): params_dict = {'img_in':img_in, 'horizontal_axis':horizontal_axis} - return Matrix(img_in.sds_context, 'img_mirror', named_input_nodes=params_dict) + return Matrix(img_in.sds_context, + 'img_mirror', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/tomeklink.py b/src/main/python/systemds/operator/algorithm/builtin/img_posterize.py similarity index 70% copy from src/main/python/systemds/operator/algorithm/builtin/tomeklink.py copy to src/main/python/systemds/operator/algorithm/builtin/img_posterize.py index 499586e..3595ea4 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/tomeklink.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_posterize.py @@ -20,22 +20,25 @@ # ------------------------------------------------------------- # Autogenerated By : src/main/python/generator/generator.py -# Autogenerated From : scripts/builtin/tomeklink.dml +# Autogenerated From : scripts/builtin/img_posterize.dml from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def tomeklink(X: OperationNode, y: OperationNode): +def img_posterize(img_in: OperationNode, bits: int): """ - :param X: Data Matrix (nxm) - :param y: Label Matrix (nx1) + :param img_in: Input image + :param bits: The number of bits keep for the values. + :param 1: and white, 8 means every integer between 0 and 255. :return: 'OperationNode' containing """ - params_dict = {'X':X, 'y':y} - return OperationNode(X.sds_context, 'tomeklink', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=3, output_types=[OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX]) + params_dict = {'img_in':img_in, 'bits':bits} + return Matrix(img_in.sds_context, + 'img_posterize', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/bivar.py b/src/main/python/systemds/operator/algorithm/builtin/img_rotate.py similarity index 62% copy from src/main/python/systemds/operator/algorithm/builtin/bivar.py copy to src/main/python/systemds/operator/algorithm/builtin/img_rotate.py index 6f2bcec..71ec866 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/bivar.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_rotate.py @@ -20,21 +20,25 @@ # ------------------------------------------------------------- # Autogenerated By : src/main/python/generator/generator.py -# Autogenerated From : scripts/builtin/bivar.dml +# Autogenerated From : scripts/builtin/img_rotate.dml from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def bivar(X: OperationNode, S1: OperationNode, S2: OperationNode, T1: OperationNode, T2: OperationNode, verbose: bool): +def img_rotate(img_in: OperationNode, radians: float, fill_value: float): """ - :param verbose: Print bivar stats - :return: 'OperationNode' containing + :param img_in: Input image as 2D matrix with top left corner at [1, 1] + :param radians: The value by which to rotate in radian. + :param fill_value: The background color revealed by the rotation + :return: 'OperationNode' containing output image as 2d matrix with top left corner at [1, 1] """ - params_dict = {'X':X, 'S1':S1, 'S2':S2, 'T1':T1, 'T2':T2, 'verbose':verbose} - return OperationNode(X.sds_context, 'bivar', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=4, output_types=[OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX]) + params_dict = {'img_in':img_in, 'radians':radians, 'fill_value':fill_value} + return Matrix(img_in.sds_context, + 'img_rotate', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/bivar.py b/src/main/python/systemds/operator/algorithm/builtin/img_sample_pairing.py similarity index 66% copy from src/main/python/systemds/operator/algorithm/builtin/bivar.py copy to src/main/python/systemds/operator/algorithm/builtin/img_sample_pairing.py index 6f2bcec..786d6a3 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/bivar.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_sample_pairing.py @@ -20,21 +20,26 @@ # ------------------------------------------------------------- # Autogenerated By : src/main/python/generator/generator.py -# Autogenerated From : scripts/builtin/bivar.dml +# Autogenerated From : scripts/builtin/img_sample_pairing.dml from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def bivar(X: OperationNode, S1: OperationNode, S2: OperationNode, T1: OperationNode, T2: OperationNode, verbose: bool): +def img_sample_pairing(img_in1: OperationNode, img_in2: OperationNode, weight: float): """ - :param verbose: Print bivar stats + :param img_in1: First input image + :param img_in2: Second input image + :param weight: The weight given to the second image. + :param 0: img_in1, 1 means only img_in2 will be visible :return: 'OperationNode' containing """ - params_dict = {'X':X, 'S1':S1, 'S2':S2, 'T1':T1, 'T2':T2, 'verbose':verbose} - return OperationNode(X.sds_context, 'bivar', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=4, output_types=[OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX]) + params_dict = {'img_in1':img_in1, 'img_in2':img_in2, 'weight':weight} + return Matrix(img_in1.sds_context, + 'img_sample_pairing', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/bivar.py b/src/main/python/systemds/operator/algorithm/builtin/img_shear.py similarity index 59% copy from src/main/python/systemds/operator/algorithm/builtin/bivar.py copy to src/main/python/systemds/operator/algorithm/builtin/img_shear.py index 6f2bcec..3844992 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/bivar.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_shear.py @@ -20,21 +20,26 @@ # ------------------------------------------------------------- # Autogenerated By : src/main/python/generator/generator.py -# Autogenerated From : scripts/builtin/bivar.dml +# Autogenerated From : scripts/builtin/img_shear.dml from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def bivar(X: OperationNode, S1: OperationNode, S2: OperationNode, T1: OperationNode, T2: OperationNode, verbose: bool): +def img_shear(img_in: OperationNode, shear_x: float, shear_y: float, fill_value: float): """ - :param verbose: Print bivar stats - :return: 'OperationNode' containing + :param img_in: Input image as 2D matrix with top left corner at [1, 1] + :param shear_x: Shearing factor for horizontal shearing + :param shear_y: Shearing factor for vertical shearing + :param fill_value: The background color revealed by the shearing + :return: 'OperationNode' containing output image as 2d matrix with top left corner at [1, 1] """ - params_dict = {'X':X, 'S1':S1, 'S2':S2, 'T1':T1, 'T2':T2, 'verbose':verbose} - return OperationNode(X.sds_context, 'bivar', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=4, output_types=[OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX]) + params_dict = {'img_in':img_in, 'shear_x':shear_x, 'shear_y':shear_y, 'fill_value':fill_value} + return Matrix(img_in.sds_context, + 'img_shear', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/arima.py b/src/main/python/systemds/operator/algorithm/builtin/img_transform.py similarity index 55% copy from src/main/python/systemds/operator/algorithm/builtin/arima.py copy to src/main/python/systemds/operator/algorithm/builtin/img_transform.py index 892cc5a..4a3e476 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/arima.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_transform.py @@ -20,32 +20,27 @@ # ------------------------------------------------------------- # Autogenerated By : src/main/python/generator/generator.py -# Autogenerated From : scripts/builtin/arima.dml +# Autogenerated From : scripts/builtin/img_transform.dml from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def arima(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): +def img_transform(img_in: OperationNode, out_w: int, out_h: int, a: float, b: float, c: float, d: float, e: float, f: float, fill_value: float): """ - :param X: The input Matrix to apply Arima on. - :param max_func_invoc: ? - :param p: non-seasonal AR order - :param d: non-seasonal differencing order - :param q: non-seasonal MA order - :param P: seasonal AR order - :param D: seasonal differencing order - :param Q: seasonal MA order - :param s: period in terms of number of time-steps - :param include_mean: center to mean 0, and include in result - :param solver: solver, is either "cg" or "jacobi" - :return: 'OperationNode' containing the calculated coefficients + :param img_in: Input image as 2D matrix with top left corner at [1, 1] + :param out_w: Width of the output image + :param out_h: Height of the output image + :param abcdef: The first two rows of the affine matrix in row-major order + :param fill_value: The background of the image + :return: 'OperationNode' containing output image as 2d matrix with top left corner at [1, 1] """ - params_dict = {'X':X} - params_dict.update(kwargs) - return Matrix(X.sds_context, 'arima', named_input_nodes=params_dict) + params_dict = {'img_in':img_in, 'out_w':out_w, 'out_h':out_h, 'a':a, 'b':b, 'c':c, 'd':d, 'e':e, 'f':f, 'fill_value':fill_value} + return Matrix(img_in.sds_context, + 'img_transform', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/arima.py b/src/main/python/systemds/operator/algorithm/builtin/img_translate.py similarity index 54% copy from src/main/python/systemds/operator/algorithm/builtin/arima.py copy to src/main/python/systemds/operator/algorithm/builtin/img_translate.py index 892cc5a..8725b14 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/arima.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_translate.py @@ -20,32 +20,28 @@ # ------------------------------------------------------------- # Autogenerated By : src/main/python/generator/generator.py -# Autogenerated From : scripts/builtin/arima.dml +# Autogenerated From : scripts/builtin/img_translate.dml from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def arima(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): +def img_translate(img_in: OperationNode, offset_x: float, offset_y: float, out_w: int, out_h: int, fill_value: float): """ - :param X: The input Matrix to apply Arima on. - :param max_func_invoc: ? - :param p: non-seasonal AR order - :param d: non-seasonal differencing order - :param q: non-seasonal MA order - :param P: seasonal AR order - :param D: seasonal differencing order - :param Q: seasonal MA order - :param s: period in terms of number of time-steps - :param include_mean: center to mean 0, and include in result - :param solver: solver, is either "cg" or "jacobi" - :return: 'OperationNode' containing the calculated coefficients + :param img_in: Input image as 2D matrix with top left corner at [1, 1] + :param offset_x: The distance to move the image in x direction + :param offset_y: The distance to move the image in y direction + :param out_w: Width of the output image + :param out_h: Height of the output image + :param fill_value: The background of the image + :return: 'OperationNode' containing output image as 2d matrix with top left corner at [1, 1] """ - params_dict = {'X':X} - params_dict.update(kwargs) - return Matrix(X.sds_context, 'arima', named_input_nodes=params_dict) + params_dict = {'img_in':img_in, 'offset_x':offset_x, 'offset_y':offset_y, 'out_w':out_w, 'out_h':out_h, 'fill_value':fill_value} + return Matrix(img_in.sds_context, + 'img_translate', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/imputeByFD.py b/src/main/python/systemds/operator/algorithm/builtin/imputeByFD.py index 38d4897..fc306bf 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/imputeByFD.py +++ b/src/main/python/systemds/operator/algorithm/builtin/imputeByFD.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,9 @@ def imputeByFD(X: OperationNode, sourceAttribute: int, targetAttribute: int, thr params_dict = {'X':X, 'sourceAttribute':sourceAttribute, 'targetAttribute':targetAttribute, 'threshold':threshold} params_dict.update(kwargs) - return Matrix(X.sds_context, 'imputeByFD', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'imputeByFD', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/imputeByMean.py b/src/main/python/systemds/operator/algorithm/builtin/imputeByMean.py index d29cb5f..5f6e5dc 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/imputeByMean.py +++ b/src/main/python/systemds/operator/algorithm/builtin/imputeByMean.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def imputeByMean(X: OperationNode, mask: OperationNode): params_dict = {'X':X, 'mask':mask} - return Matrix(X.sds_context, 'imputeByMean', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'imputeByMean', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/imputeByMedian.py b/src/main/python/systemds/operator/algorithm/builtin/imputeByMedian.py index 7afc3c9..3aa3103 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/imputeByMedian.py +++ b/src/main/python/systemds/operator/algorithm/builtin/imputeByMedian.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def imputeByMedian(X: OperationNode, mask: OperationNode): params_dict = {'X':X, 'mask':mask} - return Matrix(X.sds_context, 'imputeByMedian', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'imputeByMedian', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/imputeByMode.py b/src/main/python/systemds/operator/algorithm/builtin/imputeByMode.py index 1bfc787..dc613fc 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/imputeByMode.py +++ b/src/main/python/systemds/operator/algorithm/builtin/imputeByMode.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def imputeByMode(X: OperationNode): params_dict = {'X':X} - return Matrix(X.sds_context, 'imputeByMode', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'imputeByMode', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/intersect.py b/src/main/python/systemds/operator/algorithm/builtin/intersect.py index 4320885..b0c2c80 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/intersect.py +++ b/src/main/python/systemds/operator/algorithm/builtin/intersect.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def intersect(X: OperationNode, Y: OperationNode): params_dict = {'X':X, 'Y':Y} - return Matrix(X.sds_context, 'intersect', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'intersect', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/km.py b/src/main/python/systemds/operator/algorithm/builtin/km.py index 4009d5b..ef5ea84 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/km.py +++ b/src/main/python/systemds/operator/algorithm/builtin/km.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -47,7 +47,21 @@ def km(X: OperationNode, TE: OperationNode, GI: OperationNode, SI: OperationNode """ params_dict = {'X':X, 'TE':TE, 'GI':GI, 'SI':SI} params_dict.update(kwargs) - return OperationNode(X.sds_context, 'km', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=4, output_types=[OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + vX_2 = Matrix(X.sds_context, '') + vX_3 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, vX_2, vX_3, ] + + op = MultiReturn(X.sds_context, 'km', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + vX_2._unnamed_input_nodes = [op] + vX_3._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/kmeans.py b/src/main/python/systemds/operator/algorithm/builtin/kmeans.py index b929979..82c2a3f 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/kmeans.py +++ b/src/main/python/systemds/operator/algorithm/builtin/kmeans.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -42,7 +42,17 @@ def kmeans(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): """ params_dict = {'X':X} params_dict.update(kwargs) - return OperationNode(X.sds_context, 'kmeans', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(X.sds_context, 'kmeans', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/kmeansPredict.py b/src/main/python/systemds/operator/algorithm/builtin/kmeansPredict.py index 31056ee..ef85ff7 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/kmeansPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/kmeansPredict.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -35,7 +35,9 @@ def kmeansPredict(X: OperationNode, C: OperationNode): :return: 'OperationNode' containing the mapping of records to centroids """ params_dict = {'X':X, 'C':C} - return Matrix(X.sds_context, 'kmeansPredict', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'kmeansPredict', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/knnbf.py b/src/main/python/systemds/operator/algorithm/builtin/knnbf.py index 185e8ea..2a7411e 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/knnbf.py +++ b/src/main/python/systemds/operator/algorithm/builtin/knnbf.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def knnbf(X: OperationNode, T: OperationNode, k_value: int): params_dict = {'X':X, 'T':T, 'k_value':k_value} - return Matrix(X.sds_context, 'knnbf', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'knnbf', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/l2svm.py b/src/main/python/systemds/operator/algorithm/builtin/l2svm.py index ca0d2a0..3e7d0e6 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/l2svm.py +++ b/src/main/python/systemds/operator/algorithm/builtin/l2svm.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -43,7 +43,9 @@ def l2svm(X: OperationNode, Y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TY """ params_dict = {'X':X, 'Y':Y} params_dict.update(kwargs) - return Matrix(X.sds_context, 'l2svm', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'l2svm', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/l2svmPredict.py b/src/main/python/systemds/operator/algorithm/builtin/l2svmPredict.py index 58bbaa9..dd0ea44 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/l2svmPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/l2svmPredict.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -37,7 +37,17 @@ def l2svmPredict(X: OperationNode, W: OperationNode, **kwargs: Dict[str, VALID_I """ params_dict = {'X':X, 'W':W} params_dict.update(kwargs) - return OperationNode(X.sds_context, 'l2svmPredict', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(X.sds_context, 'l2svmPredict', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/lasso.py b/src/main/python/systemds/operator/algorithm/builtin/lasso.py index ba8c805..a299180 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/lasso.py +++ b/src/main/python/systemds/operator/algorithm/builtin/lasso.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -40,7 +40,9 @@ def lasso(X: OperationNode, y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TY """ params_dict = {'X':X, 'y':y} params_dict.update(kwargs) - return Matrix(X.sds_context, 'lasso', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'lasso', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/lm.py b/src/main/python/systemds/operator/algorithm/builtin/lm.py index c341efc..7400c25 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/lm.py +++ b/src/main/python/systemds/operator/algorithm/builtin/lm.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -41,7 +41,9 @@ def lm(X: OperationNode, y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES """ params_dict = {'X':X, 'y':y} params_dict.update(kwargs) - return Matrix(X.sds_context, 'lm', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'lm', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/lmCG.py b/src/main/python/systemds/operator/algorithm/builtin/lmCG.py index 0de47fa..7d9ef78 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/lmCG.py +++ b/src/main/python/systemds/operator/algorithm/builtin/lmCG.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,9 @@ def lmCG(X: OperationNode, y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYP params_dict = {'X':X, 'y':y} params_dict.update(kwargs) - return Matrix(X.sds_context, 'lmCG', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'lmCG', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/lmDS.py b/src/main/python/systemds/operator/algorithm/builtin/lmDS.py index 1cd29a2..de6bbee 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/lmDS.py +++ b/src/main/python/systemds/operator/algorithm/builtin/lmDS.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,9 @@ def lmDS(X: OperationNode, y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYP params_dict = {'X':X, 'y':y} params_dict.update(kwargs) - return Matrix(X.sds_context, 'lmDS', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'lmDS', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/lmPredict.py b/src/main/python/systemds/operator/algorithm/builtin/lmPredict.py index f931467..28bf6fe 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/lmPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/lmPredict.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,9 @@ def lmPredict(X: OperationNode, B: OperationNode, ytest: OperationNode, **kwargs params_dict = {'X':X, 'B':B, 'ytest':ytest} params_dict.update(kwargs) - return Matrix(X.sds_context, 'lmPredict', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'lmPredict', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/logSumExp.py b/src/main/python/systemds/operator/algorithm/builtin/logSumExp.py index 2db1b6c..ddd0a20 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/logSumExp.py +++ b/src/main/python/systemds/operator/algorithm/builtin/logSumExp.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,9 @@ def logSumExp(M: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): params_dict = {'M':M} params_dict.update(kwargs) - return Matrix(M.sds_context, 'logSumExp', named_input_nodes=params_dict) + return Matrix(M.sds_context, + 'logSumExp', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/msvm.py b/src/main/python/systemds/operator/algorithm/builtin/msvm.py index 018182f..5fca57c 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/msvm.py +++ b/src/main/python/systemds/operator/algorithm/builtin/msvm.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,9 @@ def msvm(X: OperationNode, Y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYP params_dict = {'X':X, 'Y':Y} params_dict.update(kwargs) - return Matrix(X.sds_context, 'msvm', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'msvm', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/msvmPredict.py b/src/main/python/systemds/operator/algorithm/builtin/msvmPredict.py index 77a2e53..8b061cc 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/msvmPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/msvmPredict.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -35,7 +35,17 @@ def msvmPredict(X: OperationNode, W: OperationNode): :return: 'OperationNode' containing classification labels maxed to ones and zeros. """ params_dict = {'X':X, 'W':W} - return OperationNode(X.sds_context, 'msvmPredict', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(X.sds_context, 'msvmPredict', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/multiLogReg.py b/src/main/python/systemds/operator/algorithm/builtin/multiLogReg.py index 893763b..6ad34fa 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/multiLogReg.py +++ b/src/main/python/systemds/operator/algorithm/builtin/multiLogReg.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -42,7 +42,9 @@ def multiLogReg(X: OperationNode, Y: OperationNode, **kwargs: Dict[str, VALID_IN """ params_dict = {'X':X, 'Y':Y} params_dict.update(kwargs) - return Matrix(X.sds_context, 'multiLogReg', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'multiLogReg', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/multiLogRegPredict.py b/src/main/python/systemds/operator/algorithm/builtin/multiLogRegPredict.py index 9370563..b3d6290 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/multiLogRegPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/multiLogRegPredict.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -38,7 +38,19 @@ def multiLogRegPredict(X: OperationNode, B: OperationNode, Y: OperationNode, **k """ params_dict = {'X':X, 'B':B, 'Y':Y} params_dict.update(kwargs) - return OperationNode(X.sds_context, 'multiLogRegPredict', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=3, output_types=[OutputType.MATRIX, OutputType.MATRIX, OutputType.DOUBLE]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + vX_2 = Scalar(X.sds_context, '') + output_nodes = [vX_0, vX_1, vX_2, ] + + op = MultiReturn(X.sds_context, 'multiLogRegPredict', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + vX_2._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/na_locf.py b/src/main/python/systemds/operator/algorithm/builtin/na_locf.py index baed229..aacd2ab 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/na_locf.py +++ b/src/main/python/systemds/operator/algorithm/builtin/na_locf.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,9 @@ def na_locf(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): params_dict = {'X':X} params_dict.update(kwargs) - return Matrix(X.sds_context, 'na_locf', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'na_locf', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/naiveBayes.py b/src/main/python/systemds/operator/algorithm/builtin/naiveBayes.py index 9bb127f..d049531 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/naiveBayes.py +++ b/src/main/python/systemds/operator/algorithm/builtin/naiveBayes.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,5 +32,17 @@ def naiveBayes(D: OperationNode, C: OperationNode, **kwargs: Dict[str, VALID_INP params_dict = {'D':D, 'C':C} params_dict.update(kwargs) - return OperationNode(D.sds_context, 'naiveBayes', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(D.sds_context, '') + vX_1 = Matrix(D.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(D.sds_context, 'naiveBayes', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op + + \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/naiveBayesPredict.py b/src/main/python/systemds/operator/algorithm/builtin/naiveBayesPredict.py index 4763377..1f1603f 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/naiveBayesPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/naiveBayesPredict.py @@ -24,14 +24,24 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def naiveBayesPredict(X: OperationNode, P: OperationNode, C: OperationNode): params_dict = {'X':X, 'P':P, 'C':C} - return OperationNode(X.sds_context, 'naiveBayesPredict', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(X.sds_context, 'naiveBayesPredict', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/normalize.py b/src/main/python/systemds/operator/algorithm/builtin/normalize.py index 335dacb..3578830 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/normalize.py +++ b/src/main/python/systemds/operator/algorithm/builtin/normalize.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def normalize(X: OperationNode): params_dict = {'X':X} - return Matrix(X.sds_context, 'normalize', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'normalize', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/outlier.py b/src/main/python/systemds/operator/algorithm/builtin/outlier.py index 54432de..0e3fd85 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/outlier.py +++ b/src/main/python/systemds/operator/algorithm/builtin/outlier.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def outlier(X: OperationNode, opposite: bool): params_dict = {'X':X, 'opposite':opposite} - return Matrix(X.sds_context, 'outlier', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'outlier', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/outlierByArima.py b/src/main/python/systemds/operator/algorithm/builtin/outlierByArima.py index 851cd66..47589ab 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/outlierByArima.py +++ b/src/main/python/systemds/operator/algorithm/builtin/outlierByArima.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,9 @@ def outlierByArima(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): params_dict = {'X':X} params_dict.update(kwargs) - return Matrix(X.sds_context, 'outlierByArima', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'outlierByArima', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/outlierByIQR.py b/src/main/python/systemds/operator/algorithm/builtin/outlierByIQR.py index 54f5fe2..294b53f 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/outlierByIQR.py +++ b/src/main/python/systemds/operator/algorithm/builtin/outlierByIQR.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,9 @@ def outlierByIQR(X: OperationNode, k: float, max_iterations: int, **kwargs: Dict params_dict = {'X':X, 'k':k, 'max_iterations':max_iterations} params_dict.update(kwargs) - return Matrix(X.sds_context, 'outlierByIQR', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'outlierByIQR', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/outlierBySd.py b/src/main/python/systemds/operator/algorithm/builtin/outlierBySd.py index 3032bc5..848e193 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/outlierBySd.py +++ b/src/main/python/systemds/operator/algorithm/builtin/outlierBySd.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,9 @@ def outlierBySd(X: OperationNode, max_iterations: int, **kwargs: Dict[str, VALID params_dict = {'X':X, 'max_iterations':max_iterations} params_dict.update(kwargs) - return Matrix(X.sds_context, 'outlierBySd', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'outlierBySd', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/pca.py b/src/main/python/systemds/operator/algorithm/builtin/pca.py index 9ac19f8..5fff19c 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/pca.py +++ b/src/main/python/systemds/operator/algorithm/builtin/pca.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -38,7 +38,21 @@ def pca(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): """ params_dict = {'X':X} params_dict.update(kwargs) - return OperationNode(X.sds_context, 'pca', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=4, output_types=[OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + vX_2 = Matrix(X.sds_context, '') + vX_3 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, vX_2, vX_3, ] + + op = MultiReturn(X.sds_context, 'pca', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + vX_2._unnamed_input_nodes = [op] + vX_3._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/pnmf.py b/src/main/python/systemds/operator/algorithm/builtin/pnmf.py index 2dce1d3..7be0d1d 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/pnmf.py +++ b/src/main/python/systemds/operator/algorithm/builtin/pnmf.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,17 @@ def pnmf(X: OperationNode, rnk: int, **kwargs: Dict[str, VALID_INPUT_TYPES]): params_dict = {'X':X, 'rnk':rnk} params_dict.update(kwargs) - return OperationNode(X.sds_context, 'pnmf', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(X.sds_context, 'pnmf', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/ppca.py b/src/main/python/systemds/operator/algorithm/builtin/ppca.py index 01387bb..4981762 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/ppca.py +++ b/src/main/python/systemds/operator/algorithm/builtin/ppca.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -40,7 +40,17 @@ def ppca(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): """ params_dict = {'X':X} params_dict.update(kwargs) - return OperationNode(X.sds_context, 'ppca', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(X.sds_context, 'ppca', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/randomForest.py b/src/main/python/systemds/operator/algorithm/builtin/randomForest.py index dee1839..0cc28fc 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/randomForest.py +++ b/src/main/python/systemds/operator/algorithm/builtin/randomForest.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -49,7 +49,21 @@ def randomForest(X: OperationNode, Y: OperationNode, R: OperationNode, **kwargs: """ params_dict = {'X':X, 'Y':Y, 'R':R} params_dict.update(kwargs) - return OperationNode(X.sds_context, 'randomForest', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=4, output_types=[OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + vX_2 = Matrix(X.sds_context, '') + vX_3 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, vX_2, vX_3, ] + + op = MultiReturn(X.sds_context, 'randomForest', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + vX_2._unnamed_input_nodes = [op] + vX_3._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/scale.py b/src/main/python/systemds/operator/algorithm/builtin/scale.py index ff84e9a..c6017cf 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/scale.py +++ b/src/main/python/systemds/operator/algorithm/builtin/scale.py @@ -24,14 +24,26 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def scale(X: OperationNode, center: bool, scale: bool): params_dict = {'X':X, 'center':center, 'scale':scale} - return OperationNode(X.sds_context, 'scale', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=3, output_types=[OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + vX_2 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, vX_2, ] + + op = MultiReturn(X.sds_context, 'scale', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + vX_2._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/scaleApply.py b/src/main/python/systemds/operator/algorithm/builtin/scaleApply.py index 2ca4657..0a95e3c 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/scaleApply.py +++ b/src/main/python/systemds/operator/algorithm/builtin/scaleApply.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def scaleApply(X: OperationNode, Centering: OperationNode, ScaleFactor: OperationNode): params_dict = {'X':X, 'Centering':Centering, 'ScaleFactor':ScaleFactor} - return Matrix(X.sds_context, 'scaleApply', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'scaleApply', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/sherlock.py b/src/main/python/systemds/operator/algorithm/builtin/sherlock.py index 9558f7a..cbae8e7 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/sherlock.py +++ b/src/main/python/systemds/operator/algorithm/builtin/sherlock.py @@ -24,14 +24,80 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def sherlock(X_train: OperationNode, y_train: OperationNode): params_dict = {'X_train':X_train, 'y_train':y_train} - return OperationNode(X_train.sds_context, 'sherlock', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=30, output_types=[OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATR [...] + + vX_0 = Matrix(X_train.sds_context, '') + vX_1 = Matrix(X_train.sds_context, '') + vX_2 = Matrix(X_train.sds_context, '') + vX_3 = Matrix(X_train.sds_context, '') + vX_4 = Matrix(X_train.sds_context, '') + vX_5 = Matrix(X_train.sds_context, '') + vX_6 = Matrix(X_train.sds_context, '') + vX_7 = Matrix(X_train.sds_context, '') + vX_8 = Matrix(X_train.sds_context, '') + vX_9 = Matrix(X_train.sds_context, '') + vX_10 = Matrix(X_train.sds_context, '') + vX_11 = Matrix(X_train.sds_context, '') + vX_12 = Matrix(X_train.sds_context, '') + vX_13 = Matrix(X_train.sds_context, '') + vX_14 = Matrix(X_train.sds_context, '') + vX_15 = Matrix(X_train.sds_context, '') + vX_16 = Matrix(X_train.sds_context, '') + vX_17 = Matrix(X_train.sds_context, '') + vX_18 = Matrix(X_train.sds_context, '') + vX_19 = Matrix(X_train.sds_context, '') + vX_20 = Matrix(X_train.sds_context, '') + vX_21 = Matrix(X_train.sds_context, '') + vX_22 = Matrix(X_train.sds_context, '') + vX_23 = Matrix(X_train.sds_context, '') + vX_24 = Matrix(X_train.sds_context, '') + vX_25 = Matrix(X_train.sds_context, '') + vX_26 = Matrix(X_train.sds_context, '') + vX_27 = Matrix(X_train.sds_context, '') + vX_28 = Matrix(X_train.sds_context, '') + vX_29 = Matrix(X_train.sds_context, '') + output_nodes = [vX_0, vX_1, vX_2, vX_3, vX_4, vX_5, vX_6, vX_7, vX_8, vX_9, vX_10, vX_11, vX_12, vX_13, vX_14, vX_15, vX_16, vX_17, vX_18, vX_19, vX_20, vX_21, vX_22, vX_23, vX_24, vX_25, vX_26, vX_27, vX_28, vX_29, ] + + op = MultiReturn(X_train.sds_context, 'sherlock', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + vX_2._unnamed_input_nodes = [op] + vX_3._unnamed_input_nodes = [op] + vX_4._unnamed_input_nodes = [op] + vX_5._unnamed_input_nodes = [op] + vX_6._unnamed_input_nodes = [op] + vX_7._unnamed_input_nodes = [op] + vX_8._unnamed_input_nodes = [op] + vX_9._unnamed_input_nodes = [op] + vX_10._unnamed_input_nodes = [op] + vX_11._unnamed_input_nodes = [op] + vX_12._unnamed_input_nodes = [op] + vX_13._unnamed_input_nodes = [op] + vX_14._unnamed_input_nodes = [op] + vX_15._unnamed_input_nodes = [op] + vX_16._unnamed_input_nodes = [op] + vX_17._unnamed_input_nodes = [op] + vX_18._unnamed_input_nodes = [op] + vX_19._unnamed_input_nodes = [op] + vX_20._unnamed_input_nodes = [op] + vX_21._unnamed_input_nodes = [op] + vX_22._unnamed_input_nodes = [op] + vX_23._unnamed_input_nodes = [op] + vX_24._unnamed_input_nodes = [op] + vX_25._unnamed_input_nodes = [op] + vX_26._unnamed_input_nodes = [op] + vX_27._unnamed_input_nodes = [op] + vX_28._unnamed_input_nodes = [op] + vX_29._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/sherlockPredict.py b/src/main/python/systemds/operator/algorithm/builtin/sherlockPredict.py index 12e35ef..91aabff 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/sherlockPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/sherlockPredict.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def sherlockPredict(X: OperationNode, cW1: OperationNode, cb1: OperationNode, cW2: OperationNode, cb2: OperationNode, cW3: OperationNode, cb3: OperationNode, wW1: OperationNode, wb1: OperationNode, wW2: OperationNode, wb2: OperationNode, wW3: OperationNode, wb3: OperationNode, pW1: OperationNode, pb1: OperationNode, pW2: OperationNode, pb2: OperationNode, pW3: OperationNode, pb3: OperationNode, sW1: OperationNode, sb1: OperationNode, sW2: OperationNode, sb2: OperationNode, sW3: Operation [...] params_dict = {'X':X, 'cW1':cW1, 'cb1':cb1, 'cW2':cW2, 'cb2':cb2, 'cW3':cW3, 'cb3':cb3, 'wW1':wW1, 'wb1':wb1, 'wW2':wW2, 'wb2':wb2, 'wW3':wW3, 'wb3':wb3, 'pW1':pW1, 'pb1':pb1, 'pW2':pW2, 'pb2':pb2, 'pW3':pW3, 'pb3':pb3, 'sW1':sW1, 'sb1':sb1, 'sW2':sW2, 'sb2':sb2, 'sW3':sW3, 'sb3':sb3, 'fW1':fW1, 'fb1':fb1, 'fW2':fW2, 'fb2':fb2, 'fW3':fW3, 'fb3':fb3} - return Matrix(X.sds_context, 'sherlockPredict', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'sherlockPredict', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/sigmoid.py b/src/main/python/systemds/operator/algorithm/builtin/sigmoid.py index a11a33e..96f5820 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/sigmoid.py +++ b/src/main/python/systemds/operator/algorithm/builtin/sigmoid.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def sigmoid(X: OperationNode): params_dict = {'X':X} - return Matrix(X.sds_context, 'sigmoid', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'sigmoid', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/slicefinder.py b/src/main/python/systemds/operator/algorithm/builtin/slicefinder.py index c046769..42fef5e 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/slicefinder.py +++ b/src/main/python/systemds/operator/algorithm/builtin/slicefinder.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,19 @@ def slicefinder(X: OperationNode, e: OperationNode, **kwargs: Dict[str, VALID_IN params_dict = {'X':X, 'e':e} params_dict.update(kwargs) - return OperationNode(X.sds_context, 'slicefinder', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=3, output_types=[OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + vX_2 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, vX_2, ] + + op = MultiReturn(X.sds_context, 'slicefinder', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + vX_2._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/smote.py b/src/main/python/systemds/operator/algorithm/builtin/smote.py index d1b64b8..2084b59 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/smote.py +++ b/src/main/python/systemds/operator/algorithm/builtin/smote.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,9 @@ def smote(X: OperationNode, mask: OperationNode, **kwargs: Dict[str, VALID_INPUT params_dict = {'X':X, 'mask':mask} params_dict.update(kwargs) - return Matrix(X.sds_context, 'smote', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'smote', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/split.py b/src/main/python/systemds/operator/algorithm/builtin/split.py index e4c5ea7..1a8e306 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/split.py +++ b/src/main/python/systemds/operator/algorithm/builtin/split.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,21 @@ def split(X: OperationNode, Y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TY params_dict = {'X':X, 'Y':Y} params_dict.update(kwargs) - return OperationNode(X.sds_context, 'split', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=4, output_types=[OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + vX_2 = Matrix(X.sds_context, '') + vX_3 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, vX_2, vX_3, ] + + op = MultiReturn(X.sds_context, 'split', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + vX_2._unnamed_input_nodes = [op] + vX_3._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/splitBalanced.py b/src/main/python/systemds/operator/algorithm/builtin/splitBalanced.py index b1bf9a8..6eb9962 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/splitBalanced.py +++ b/src/main/python/systemds/operator/algorithm/builtin/splitBalanced.py @@ -24,14 +24,28 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def splitBalanced(X: OperationNode, Y: OperationNode, splitRatio: float, verbose: bool): params_dict = {'X':X, 'Y':Y, 'splitRatio':splitRatio, 'verbose':verbose} - return OperationNode(X.sds_context, 'splitBalanced', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=4, output_types=[OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + vX_2 = Matrix(X.sds_context, '') + vX_3 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, vX_2, vX_3, ] + + op = MultiReturn(X.sds_context, 'splitBalanced', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + vX_2._unnamed_input_nodes = [op] + vX_3._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/stableMarriage.py b/src/main/python/systemds/operator/algorithm/builtin/stableMarriage.py index 26c8cb4..6c09dc5 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/stableMarriage.py +++ b/src/main/python/systemds/operator/algorithm/builtin/stableMarriage.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -40,7 +40,9 @@ def stableMarriage(P: OperationNode, A: OperationNode, **kwargs: Dict[str, VALID """ params_dict = {'P':P, 'A':A} params_dict.update(kwargs) - return Matrix(P.sds_context, 'stableMarriage', named_input_nodes=params_dict) + return Matrix(P.sds_context, + 'stableMarriage', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/statsNA.py b/src/main/python/systemds/operator/algorithm/builtin/statsNA.py index be8d1a7..2e5e5bc 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/statsNA.py +++ b/src/main/python/systemds/operator/algorithm/builtin/statsNA.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,9 @@ def statsNA(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): params_dict = {'X':X} params_dict.update(kwargs) - return Matrix(X.sds_context, 'statsNA', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'statsNA', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/steplm.py b/src/main/python/systemds/operator/algorithm/builtin/steplm.py index 152d10d..5565b4e 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/steplm.py +++ b/src/main/python/systemds/operator/algorithm/builtin/steplm.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -32,7 +32,17 @@ def steplm(X: OperationNode, y: OperationNode, **kwargs: Dict[str, VALID_INPUT_T params_dict = {'X':X, 'y':y} params_dict.update(kwargs) - return OperationNode(X.sds_context, 'steplm', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(X.sds_context, 'steplm', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/toOneHot.py b/src/main/python/systemds/operator/algorithm/builtin/toOneHot.py index ca11663..105ec27 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/toOneHot.py +++ b/src/main/python/systemds/operator/algorithm/builtin/toOneHot.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -35,7 +35,9 @@ def toOneHot(X: OperationNode, numClasses: int): :return: 'OperationNode' containing matrix with shape (n, numclasses) """ params_dict = {'X':X, 'numClasses':numClasses} - return Matrix(X.sds_context, 'toOneHot', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'toOneHot', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/tomeklink.py b/src/main/python/systemds/operator/algorithm/builtin/tomeklink.py index 499586e..f9d565e 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/tomeklink.py +++ b/src/main/python/systemds/operator/algorithm/builtin/tomeklink.py @@ -24,7 +24,7 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES @@ -35,7 +35,19 @@ def tomeklink(X: OperationNode, y: OperationNode): :return: 'OperationNode' containing """ params_dict = {'X':X, 'y':y} - return OperationNode(X.sds_context, 'tomeklink', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=3, output_types=[OutputType.MATRIX, OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + vX_2 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, vX_2, ] + + op = MultiReturn(X.sds_context, 'tomeklink', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + vX_2._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/univar.py b/src/main/python/systemds/operator/algorithm/builtin/univar.py index 534d41e..bf165c2 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/univar.py +++ b/src/main/python/systemds/operator/algorithm/builtin/univar.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def univar(X: OperationNode, types: OperationNode): params_dict = {'X':X, 'types':types} - return Matrix(X.sds_context, 'univar', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'univar', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/vectorToCsv.py b/src/main/python/systemds/operator/algorithm/builtin/vectorToCsv.py index b011a77..065e9c5 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/vectorToCsv.py +++ b/src/main/python/systemds/operator/algorithm/builtin/vectorToCsv.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def vectorToCsv(mask: OperationNode): params_dict = {'mask':mask} - return Matrix(mask.sds_context, 'vectorToCsv', named_input_nodes=params_dict) + return Matrix(mask.sds_context, + 'vectorToCsv', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/winsorize.py b/src/main/python/systemds/operator/algorithm/builtin/winsorize.py index eacaa28..6133e75 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/winsorize.py +++ b/src/main/python/systemds/operator/algorithm/builtin/winsorize.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def winsorize(X: OperationNode, verbose: bool): params_dict = {'X':X, 'verbose':verbose} - return Matrix(X.sds_context, 'winsorize', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'winsorize', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/xdummy1.py b/src/main/python/systemds/operator/algorithm/builtin/xdummy1.py index d677320..b2fcbbf 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/xdummy1.py +++ b/src/main/python/systemds/operator/algorithm/builtin/xdummy1.py @@ -24,14 +24,16 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def xdummy1(X: OperationNode): params_dict = {'X':X} - return Matrix(X.sds_context, 'xdummy1', named_input_nodes=params_dict) + return Matrix(X.sds_context, + 'xdummy1', + named_input_nodes=params_dict) \ No newline at end of file diff --git a/src/main/python/systemds/operator/algorithm/builtin/xdummy2.py b/src/main/python/systemds/operator/algorithm/builtin/xdummy2.py index a5d75f4..d91b1c9 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/xdummy2.py +++ b/src/main/python/systemds/operator/algorithm/builtin/xdummy2.py @@ -24,14 +24,24 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix +from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES def xdummy2(X: OperationNode): params_dict = {'X':X} - return OperationNode(X.sds_context, 'xdummy2', named_input_nodes=params_dict, output_type=OutputType.LIST, number_of_outputs=2, output_types=[OutputType.MATRIX, OutputType.MATRIX]) + + vX_0 = Matrix(X.sds_context, '') + vX_1 = Matrix(X.sds_context, '') + output_nodes = [vX_0, vX_1, ] + + op = MultiReturn(X.sds_context, 'xdummy2', output_nodes, named_input_nodes=params_dict) + + vX_0._unnamed_input_nodes = [op] + vX_1._unnamed_input_nodes = [op] + + return op \ No newline at end of file diff --git a/src/main/python/systemds/operator/nodes/frame.py b/src/main/python/systemds/operator/nodes/frame.py index 0beb05f..9c7d204 100644 --- a/src/main/python/systemds/operator/nodes/frame.py +++ b/src/main/python/systemds/operator/nodes/frame.py @@ -89,8 +89,8 @@ class Frame(OperationNode): frame = Frame(self.sds_context,"") matrix = Matrix(self.sds_context,"") - output_nodes = [matrix,frame] + op = MultiReturn( self.sds_context, "transformencode", diff --git a/src/main/python/systemds/operator/operation_node.py b/src/main/python/systemds/operator/operation_node.py index f3e295d..8dba0f9 100644 --- a/src/main/python/systemds/operator/operation_node.py +++ b/src/main/python/systemds/operator/operation_node.py @@ -92,7 +92,6 @@ class OperationNode(DAGNode): print("SCRIPT:") print(self._script.dml_script) - if lineage: result_variables, self._lineage_trace = self._script.execute_with_lineage() else: @@ -115,7 +114,11 @@ class OperationNode(DAGNode): return self._result_var def _parse_output_result_variables(self, result_variables): - raise NotImplementedError("This method should be overwritten by subclasses") + if self._output_type == None or self._output_type == OutputType.NONE: + return None + else: + raise NotImplementedError( + "This method should be overwritten by subclasses") def get_lineage_trace(self) -> str: """Get the lineage trace for this node. diff --git a/src/main/python/tests/frame/test_transform_encode.py b/src/main/python/tests/frame/test_transform_encode.py index 70b1605..5159a61 100644 --- a/src/main/python/tests/frame/test_transform_encode.py +++ b/src/main/python/tests/frame/test_transform_encode.py @@ -81,8 +81,9 @@ class TestTransformEncode(unittest.TestCase): ) jspec = self.sds.read(self.JSPEC_PATH, data_type="scalar", value_type="string") X, M = F1.transform_encode(spec=jspec) - xm = X + 1 - res = xm.compute(verbose=True) + xm = X.sum() + 1 + res = xm.compute() + self.assertTrue(isinstance(res,float)) if __name__ == "__main__": unittest.main(exit=False)
