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 97523dd0b6139300d6f016aa293315ff5cc7f1e2 Author: baunsgaard <[email protected]> AuthorDate: Thu Jun 3 13:25:31 2021 +0200 [SYSTEMDS-3006] Python AutoGenerator methods with types Specify the types for the inputs in the functions definitions, such that it is clear if the input is matrix, scalar, or frame. Closes #1293 --- src/main/python/generator/generator.py | 71 +++++++++------------- .../resources/template_python_script_imports | 1 + .../python/generator/resources/type_mapping.json | 4 +- .../python/systemds/operator/algorithm/__init__.py | 3 +- .../systemds/operator/algorithm/builtin/abstain.py | 15 ++--- .../systemds/operator/algorithm/builtin/als.py | 9 ++- .../systemds/operator/algorithm/builtin/alsCG.py | 9 ++- .../systemds/operator/algorithm/builtin/alsDS.py | 9 ++- .../operator/algorithm/builtin/alsPredict.py | 15 ++--- .../operator/algorithm/builtin/alsTopkPredict.py | 12 ++-- .../systemds/operator/algorithm/builtin/arima.py | 13 ++-- .../systemds/operator/algorithm/builtin/bandit.py | 15 +++-- .../systemds/operator/algorithm/builtin/bivar.py | 13 ++-- .../operator/algorithm/builtin/components.py | 13 ++-- .../operator/algorithm/builtin/confusionMatrix.py | 9 ++- .../systemds/operator/algorithm/builtin/cor.py | 12 ++-- .../systemds/operator/algorithm/builtin/cox.py | 12 ++-- .../systemds/operator/algorithm/builtin/cspline.py | 11 ++-- .../operator/algorithm/builtin/csplineDS.py | 10 +-- .../systemds/operator/algorithm/builtin/cvlm.py | 11 ++-- .../systemds/operator/algorithm/builtin/dbscan.py | 13 ++-- .../operator/algorithm/builtin/decisionTree.py | 16 ++--- .../operator/algorithm/builtin/discoverFD.py | 14 ++--- .../systemds/operator/algorithm/builtin/dist.py | 12 ++-- .../operator/algorithm/builtin/executePipeline.py | 13 ++-- .../algorithm/builtin/gaussianClassifier.py | 13 ++-- .../operator/algorithm/builtin/getAccuracy.py | 14 ++--- .../systemds/operator/algorithm/builtin/glm.py | 14 ++--- .../systemds/operator/algorithm/builtin/gmm.py | 10 +-- .../operator/algorithm/builtin/gmmPredict.py | 12 ++-- .../systemds/operator/algorithm/builtin/gnmf.py | 10 +-- .../operator/algorithm/builtin/hyperband.py | 14 +++-- .../operator/algorithm/builtin/img_brightness.py | 14 ++--- .../operator/algorithm/builtin/img_crop.py | 16 ++--- .../operator/algorithm/builtin/img_cutout.py | 17 +++--- .../operator/algorithm/builtin/img_invert.py | 13 ++-- .../operator/algorithm/builtin/img_mirror.py | 13 ++-- .../operator/algorithm/builtin/img_posterize.py | 13 ++-- .../operator/algorithm/builtin/img_rotate.py | 14 ++--- .../algorithm/builtin/img_sample_pairing.py | 14 ++--- .../operator/algorithm/builtin/img_shear.py | 15 ++--- .../operator/algorithm/builtin/img_transform.py | 21 ++++--- .../operator/algorithm/builtin/img_translate.py | 17 +++--- .../operator/algorithm/builtin/imputeByFD.py | 16 ++--- .../operator/algorithm/builtin/imputeByMean.py | 13 ++-- .../operator/algorithm/builtin/imputeByMedian.py | 13 ++-- .../operator/algorithm/builtin/imputeByMode.py | 12 ++-- .../operator/algorithm/builtin/intersect.py | 13 ++-- .../systemds/operator/algorithm/builtin/km.py | 12 ++-- .../systemds/operator/algorithm/builtin/kmeans.py | 9 ++- .../operator/algorithm/builtin/kmeansPredict.py | 13 ++-- .../systemds/operator/algorithm/builtin/knnbf.py | 14 ++--- .../systemds/operator/algorithm/builtin/l2svm.py | 14 ++--- .../operator/algorithm/builtin/l2svmPredict.py | 10 +-- .../systemds/operator/algorithm/builtin/lasso.py | 14 ++--- .../systemds/operator/algorithm/builtin/lm.py | 14 ++--- .../systemds/operator/algorithm/builtin/lmCG.py | 14 ++--- .../systemds/operator/algorithm/builtin/lmDS.py | 14 ++--- .../operator/algorithm/builtin/lmPredict.py | 15 ++--- .../operator/algorithm/builtin/logSumExp.py | 13 ++-- .../systemds/operator/algorithm/builtin/msvm.py | 14 ++--- .../operator/algorithm/builtin/msvmPredict.py | 9 ++- .../operator/algorithm/builtin/multiLogReg.py | 14 ++--- .../algorithm/builtin/multiLogRegPredict.py | 11 ++-- .../systemds/operator/algorithm/builtin/na_locf.py | 13 ++-- .../operator/algorithm/builtin/naiveBayes.py | 10 +-- .../algorithm/builtin/naiveBayesPredict.py | 10 +-- .../operator/algorithm/builtin/normalize.py | 12 ++-- .../systemds/operator/algorithm/builtin/outlier.py | 13 ++-- .../operator/algorithm/builtin/outlierByArima.py | 13 ++-- .../operator/algorithm/builtin/outlierByIQR.py | 15 ++--- .../operator/algorithm/builtin/outlierBySd.py | 14 ++--- .../systemds/operator/algorithm/builtin/pca.py | 9 ++- .../systemds/operator/algorithm/builtin/pnmf.py | 10 +-- .../systemds/operator/algorithm/builtin/ppca.py | 9 ++- .../operator/algorithm/builtin/randomForest.py | 11 ++-- .../systemds/operator/algorithm/builtin/scale.py | 10 +-- .../operator/algorithm/builtin/scaleApply.py | 14 ++--- .../operator/algorithm/builtin/sherlock.py | 9 ++- .../operator/algorithm/builtin/sherlockPredict.py | 42 ++++++++++--- .../systemds/operator/algorithm/builtin/sigmoid.py | 12 ++-- .../operator/algorithm/builtin/slicefinder.py | 10 +-- .../systemds/operator/algorithm/builtin/smote.py | 14 ++--- .../systemds/operator/algorithm/builtin/split.py | 10 +-- .../operator/algorithm/builtin/splitBalanced.py | 11 ++-- .../operator/algorithm/builtin/stableMarriage.py | 14 ++--- .../systemds/operator/algorithm/builtin/statsNA.py | 13 ++-- .../systemds/operator/algorithm/builtin/steplm.py | 10 +-- .../operator/algorithm/builtin/toOneHot.py | 13 ++-- .../operator/algorithm/builtin/tomeklink.py | 9 ++- .../systemds/operator/algorithm/builtin/univar.py | 13 ++-- .../operator/algorithm/builtin/vectorToCsv.py | 12 ++-- .../operator/algorithm/builtin/winsorize.py | 13 ++-- .../systemds/operator/algorithm/builtin/xdummy1.py | 12 ++-- .../systemds/operator/algorithm/builtin/xdummy2.py | 8 +-- 95 files changed, 635 insertions(+), 613 deletions(-) diff --git a/src/main/python/generator/generator.py b/src/main/python/generator/generator.py index 7ee39e3..39dc59e 100644 --- a/src/main/python/generator/generator.py +++ b/src/main/python/generator/generator.py @@ -97,8 +97,7 @@ class PythonAPIFunctionGenerator(object): api_template = u"""def {function_name}({parameters}): {header} {params_dict} - {api_call}\n\n - """ + {api_call}\n""" kwargs_parameter_string = u"**kwargs: Dict[str, VALID_INPUT_TYPES]" kwargs_result = u"params_dict.update(kwargs)" @@ -128,8 +127,9 @@ class PythonAPIFunctionGenerator(object): } @return: function definition """ - parameters = self.format_param_string(data['parameters']) function_name = data['function_name'] + parameters = self.format_param_string( + data['parameters'], len(function_name)) header = data['function_header'] if data['function_header'] else "" params_dict = self.format_params_dict_string(data['parameters']) api_call = self.format_api_call( @@ -138,39 +138,32 @@ class PythonAPIFunctionGenerator(object): data['function_name'] ) return self.__class__.api_template.format( - function_name=function_name, - parameters=parameters, - header=header, - params_dict=params_dict, - api_call=api_call - ) + function_name=function_name, parameters=parameters, header=header, + params_dict=params_dict, api_call=api_call) - def format_param_string(self, parameters: List[Tuple[str]]) -> str: - result = u"" + def format_param_string(self, parameters: List[Tuple[str]], nameLength: int) -> str: + result = [] has_optional = False path = os.path.dirname(__file__) + newline_spacing = "\n" + " " * (nameLength + 5) for param in parameters: # map data types pattern = self.__class__.type_mapping_pattern - param = tuple([self.__class__.type_mapping["type"].get(re.search(pattern, str( - item).lower()).group() if item else str(item).lower(), item) for item in param]) + param = [self.__class__.type_mapping["type"].get(re.search(pattern, str( + item).lower()).group() if item else str(item).lower(), item) for item in param] if param[2] is not None: has_optional = True else: - if len(result): - result = u"{result}, ".format(result=result) - result = u"{result}{name}: {typ}".format( - result=result, - name=param[0], - typ=param[1] - ) + result.append("{nl}{name}: {typ},".format( + result=result, name=param[0], typ=param[1], + nl=newline_spacing)) + result[0] = result[0][len(newline_spacing):] + result[-1] = result[-1][:-1] + result = "".join(result) if has_optional: - if len(result): - result = u"{result}, ".format(result=result) - result = u"{result}{kwargs}".format( - result=result, - kwargs=self.__class__.kwargs_parameter_string - ) + result = u"{result},{nl}{kwargs}".format( + result=result, kwargs=self.__class__.kwargs_parameter_string, + nl=newline_spacing) return result def format_params_dict_string(self, parameters: List[Tuple[str]]) -> str: @@ -187,7 +180,7 @@ class PythonAPIFunctionGenerator(object): result=result) else: result = u"params_dict = {" - result = u"{result}\'{name}\':{name}".format( + result = u"{result}\'{name}\': {name}".format( result=result, name=param[0] ) @@ -204,7 +197,6 @@ class PythonAPIFunctionGenerator(object): return_values: List[Tuple[str]], function_name: str ) -> str: - nl = "\n\t\t" length = len(return_values) param_string = "" param = parameters[0] @@ -229,11 +221,10 @@ class PythonAPIFunctionGenerator(object): else: raise AttributeError("Error in pattern match") result = ("{sds_context}," + - "{nl}\'{function_name}\'," + - "{nl}named_input_nodes=params_dict").format( + "\n \'{function_name}\'," + + "\n named_input_nodes=params_dict").format( sds_context=sds_context, - function_name=function_name, - nl=nl + function_name=function_name ) result = "return Matrix({params})".format(params=result) return result @@ -246,8 +237,9 @@ class PythonAPIFunctionGenerator(object): output_type = re.search(pattern, value[1])[0].upper() # print(output_type) output_type = output_type.lower() + if output_type == "matrix": - object_type= "Matrix" + object_type = "Matrix" elif output_type == "frame": object_type = "Frame" elif output_type == "double": @@ -256,10 +248,13 @@ class PythonAPIFunctionGenerator(object): object_type = "Scalar" elif output_type == "integer": object_type = "Scalar" + elif output_type == "list": + object_type = "List" else: raise ValueError("Unknown type " + object_type) + lines.append(" vX_{idx} = {obj}({sds}, '')".format( - idx=idx,obj = object_type, sds=sds_context)) + 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)) @@ -348,12 +343,4 @@ 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 fdc16c7..572c6be 100644 --- a/src/main/python/generator/resources/template_python_script_imports +++ b/src/main/python/generator/resources/template_python_script_imports @@ -5,3 +5,4 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES + diff --git a/src/main/python/generator/resources/type_mapping.json b/src/main/python/generator/resources/type_mapping.json index aeebc95..7d2041a 100644 --- a/src/main/python/generator/resources/type_mapping.json +++ b/src/main/python/generator/resources/type_mapping.json @@ -1,8 +1,8 @@ { "__comment__": "insert type_mapping from dml to python here", "type": { - "matrix": "OperationNode", - "frame": "OperationNode", + "matrix": "Matrix", + "frame": "Frame", "boolean": "bool", "integer": "int", "double": "float", diff --git a/src/main/python/systemds/operator/algorithm/__init__.py b/src/main/python/systemds/operator/algorithm/__init__.py index d6f281b..d2e5d83 100644 --- a/src/main/python/systemds/operator/algorithm/__init__.py +++ b/src/main/python/systemds/operator/algorithm/__init__.py @@ -42,6 +42,7 @@ from .builtin.decisionTree import decisionTree from .builtin.discoverFD import discoverFD from .builtin.dist import dist from .builtin.executePipeline import executePipeline +from .builtin.gaussianClassifier import gaussianClassifier from .builtin.getAccuracy import getAccuracy from .builtin.glm import glm from .builtin.gmm import gmm @@ -112,4 +113,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, 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, [...] +__all__ = [abstain, als, alsCG, alsDS, alsPredict, alsTopkPredict, arima, bandit, bivar, components, confusionMatrix, cor, cox, cspline, csplineDS, cvlm, dbscan, decisionTree, discoverFD, dist, executePipeline, gaussianClassifier, 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, int [...] diff --git a/src/main/python/systemds/operator/algorithm/builtin/abstain.py b/src/main/python/systemds/operator/algorithm/builtin/abstain.py index 26e8b27..4d0a0fb 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/abstain.py +++ b/src/main/python/systemds/operator/algorithm/builtin/abstain.py @@ -28,13 +28,14 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def abstain(X: OperationNode, Y: OperationNode, threshold: float, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def abstain(X: Matrix, + Y: Matrix, + threshold: float, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X, 'Y':Y, 'threshold':threshold} + params_dict = {'X': X, 'Y': Y, 'threshold': threshold} params_dict.update(kwargs) return Matrix(X.sds_context, - 'abstain', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'abstain', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/als.py b/src/main/python/systemds/operator/algorithm/builtin/als.py index f57630b..15eb88f 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/als.py +++ b/src/main/python/systemds/operator/algorithm/builtin/als.py @@ -28,7 +28,9 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def als(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def als(X: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param X: Location to read the input matrix X to be factorized :param rank: Rank of the factorization @@ -41,7 +43,7 @@ def als(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): :param if: FALSE thr is ignored :return: 'OperationNode' containing x n matrix v """ - params_dict = {'X':X} + params_dict = {'X': X} params_dict.update(kwargs) vX_0 = Matrix(X.sds_context, '') @@ -54,6 +56,3 @@ def als(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): 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 6a43aaa..782fbde 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/alsCG.py +++ b/src/main/python/systemds/operator/algorithm/builtin/alsCG.py @@ -28,7 +28,9 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def alsCG(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def alsCG(X: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param X: Location to read the input matrix X to be factorized :param rank: Rank of the factorization @@ -41,7 +43,7 @@ def alsCG(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): :param if: FALSE thr is ignored :return: 'OperationNode' containing x n matrix v """ - params_dict = {'X':X} + params_dict = {'X': X} params_dict.update(kwargs) vX_0 = Matrix(X.sds_context, '') @@ -54,6 +56,3 @@ def alsCG(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): 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 e543493..df6c9b6 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/alsDS.py +++ b/src/main/python/systemds/operator/algorithm/builtin/alsDS.py @@ -28,7 +28,9 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def alsDS(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def alsDS(X: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param V: Location to read the input matrix V to be factorized :param L: Location to write the factor matrix L @@ -42,7 +44,7 @@ def alsDS(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): :param if: FALSE thr is ignored :return: 'OperationNode' containing x n matrix r """ - params_dict = {'X':X} + params_dict = {'X': X} params_dict.update(kwargs) vX_0 = Matrix(X.sds_context, '') @@ -55,6 +57,3 @@ def alsDS(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): 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 26a4e16..3886c30 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/alsPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/alsPredict.py @@ -28,12 +28,13 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S 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): + +def alsPredict(userIDs: Matrix, + I: Matrix, + L: Matrix, + R: Matrix): - params_dict = {'userIDs':userIDs, 'I':I, 'L':L, 'R':R} + params_dict = {'userIDs': userIDs, 'I': I, 'L': L, 'R': R} return Matrix(userIDs.sds_context, - 'alsPredict', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'alsPredict', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/alsTopkPredict.py b/src/main/python/systemds/operator/algorithm/builtin/alsTopkPredict.py index b7cb189..6add5f9 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/alsTopkPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/alsTopkPredict.py @@ -28,7 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def alsTopkPredict(userIDs: OperationNode, I: OperationNode, L: OperationNode, R: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def alsTopkPredict(userIDs: Matrix, + I: Matrix, + L: Matrix, + R: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param userIDs: Column vector of user-ids (n x 1) :param I: Indicator matrix user-id x user-id to exclude from scoring @@ -37,7 +42,7 @@ def alsTopkPredict(userIDs: OperationNode, I: OperationNode, L: OperationNode, R :param K: The number of top-K items :return: 'OperationNode' containing users (rows) & a matrix containing the top-k predicted ratings for the specified users (rows) """ - params_dict = {'userIDs':userIDs, 'I':I, 'L':L, 'R':R} + params_dict = {'userIDs': userIDs, 'I': I, 'L': L, 'R': R} params_dict.update(kwargs) vX_0 = Matrix(userIDs.sds_context, '') @@ -50,6 +55,3 @@ def alsTopkPredict(userIDs: OperationNode, I: OperationNode, L: OperationNode, R 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 decc43c..713cae0 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/arima.py +++ b/src/main/python/systemds/operator/algorithm/builtin/arima.py @@ -28,7 +28,9 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S 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 arima(X: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param X: The input Matrix to apply Arima on. :param max_func_invoc: ? @@ -43,11 +45,8 @@ def arima(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): :param solver: solver, is either "cg" or "jacobi" :return: 'OperationNode' containing the calculated coefficients """ - params_dict = {'X':X} + params_dict = {'X': X} params_dict.update(kwargs) return Matrix(X.sds_context, - 'arima', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'arima', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/bandit.py b/src/main/python/systemds/operator/algorithm/builtin/bandit.py index cd866c3..ff6b1c0 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/bandit.py +++ b/src/main/python/systemds/operator/algorithm/builtin/bandit.py @@ -28,9 +28,17 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def bandit(X_train: OperationNode, Y_train: OperationNode, metaList: Iterable, targetList: Iterable, lp: OperationNode, primitives: OperationNode, param: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def bandit(X_train: Matrix, + Y_train: Matrix, + metaList: Iterable, + targetList: Iterable, + lp: Frame, + primitives: Frame, + param: Frame, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X_train':X_train, 'Y_train':Y_train, 'metaList':metaList, 'targetList':targetList, 'lp':lp, 'primitives':primitives, 'param':param} + params_dict = {'X_train': X_train, 'Y_train': Y_train, 'metaList': metaList, 'targetList': targetList, 'lp': lp, 'primitives': primitives, 'param': param} params_dict.update(kwargs) vX_0 = Frame(X_train.sds_context, '') @@ -47,6 +55,3 @@ def bandit(X_train: OperationNode, Y_train: OperationNode, metaList: Iterable, t 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 9a9a04d..dfa4061 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/bivar.py +++ b/src/main/python/systemds/operator/algorithm/builtin/bivar.py @@ -28,12 +28,18 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S 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 bivar(X: Matrix, + S1: Matrix, + S2: Matrix, + T1: Matrix, + T2: Matrix, + verbose: bool): """ :param verbose: Print bivar stats :return: 'OperationNode' containing """ - params_dict = {'X':X, 'S1':S1, 'S2':S2, 'T1':T1, 'T2':T2, 'verbose':verbose} + params_dict = {'X': X, 'S1': S1, 'S2': S2, 'T1': T1, 'T2': T2, 'verbose': verbose} vX_0 = Matrix(X.sds_context, '') vX_1 = Matrix(X.sds_context, '') @@ -49,6 +55,3 @@ def bivar(X: OperationNode, S1: OperationNode, S2: OperationNode, T1: OperationN 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 386db83..d411e4c 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/components.py +++ b/src/main/python/systemds/operator/algorithm/builtin/components.py @@ -28,13 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def components(G: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def components(G: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'G':G} + params_dict = {'G': G} params_dict.update(kwargs) return Matrix(G.sds_context, - 'components', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'components', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/confusionMatrix.py b/src/main/python/systemds/operator/algorithm/builtin/confusionMatrix.py index d124936..e9b1e1b 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/confusionMatrix.py +++ b/src/main/python/systemds/operator/algorithm/builtin/confusionMatrix.py @@ -28,13 +28,15 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def confusionMatrix(P: OperationNode, Y: OperationNode): + +def confusionMatrix(P: Matrix, + Y: Matrix): """ :param P: vector of Predictions :param Y: vector of Golden standard One Hot Encoded; the one hot encoded vector of actual labels :return: 'OperationNode' containing the confusion matrix sums of classifications & the confusion matrix averages of each true class """ - params_dict = {'P':P, 'Y':Y} + params_dict = {'P': P, 'Y': Y} vX_0 = Matrix(P.sds_context, '') vX_1 = Matrix(P.sds_context, '') @@ -46,6 +48,3 @@ def confusionMatrix(P: OperationNode, Y: OperationNode): 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 9c0d632..ddc4c89 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/cor.py +++ b/src/main/python/systemds/operator/algorithm/builtin/cor.py @@ -28,12 +28,10 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def cor(X: OperationNode): + +def cor(X: Matrix): - params_dict = {'X':X} + params_dict = {'X': X} return Matrix(X.sds_context, - 'cor', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'cor', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/cox.py b/src/main/python/systemds/operator/algorithm/builtin/cox.py index ebc12c7..1d1f2f6 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/cox.py +++ b/src/main/python/systemds/operator/algorithm/builtin/cox.py @@ -28,7 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def cox(X: OperationNode, TE: OperationNode, F: OperationNode, R: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def cox(X: Matrix, + TE: Matrix, + F: Matrix, + R: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param X: Location to read the input matrix X containing the survival data :param containing: information @@ -46,7 +51,7 @@ def cox(X: OperationNode, TE: OperationNode, F: OperationNode, R: OperationNode, :param mii: Max. number of inner (conjugate gradient) iterations, 0 = no max :return: 'OperationNode' containing a summary of some statistics of the fitted model: & matrix rt that contains the order-preserving recoded timestamps from x & which is matrix x with sorted timestamps & matrix mf that contains the column indices of x with the baseline factors removed (if available) """ - params_dict = {'X':X, 'TE':TE, 'F':F, 'R':R} + params_dict = {'X': X, 'TE': TE, 'F': F, 'R': R} params_dict.update(kwargs) vX_0 = Matrix(X.sds_context, '') @@ -67,6 +72,3 @@ def cox(X: OperationNode, TE: OperationNode, F: OperationNode, R: OperationNode, 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 8c2af13..e4f60bb 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/cspline.py +++ b/src/main/python/systemds/operator/algorithm/builtin/cspline.py @@ -28,9 +28,13 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def cspline(X: OperationNode, Y: OperationNode, inp_x: float, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def cspline(X: Matrix, + Y: Matrix, + inp_x: float, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X, 'Y':Y, 'inp_x':inp_x} + params_dict = {'X': X, 'Y': Y, 'inp_x': inp_x} params_dict.update(kwargs) vX_0 = Matrix(X.sds_context, '') @@ -43,6 +47,3 @@ def cspline(X: OperationNode, Y: OperationNode, inp_x: float, **kwargs: Dict[str 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 b4a3d6c..3641d3a 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/csplineDS.py +++ b/src/main/python/systemds/operator/algorithm/builtin/csplineDS.py @@ -28,9 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def csplineDS(X: OperationNode, Y: OperationNode, inp_x: float): + +def csplineDS(X: Matrix, + Y: Matrix, + inp_x: float): - params_dict = {'X':X, 'Y':Y, 'inp_x':inp_x} + params_dict = {'X': X, 'Y': Y, 'inp_x': inp_x} vX_0 = Matrix(X.sds_context, '') vX_1 = Matrix(X.sds_context, '') @@ -42,6 +45,3 @@ def csplineDS(X: OperationNode, Y: OperationNode, inp_x: float): 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 410910f..c00ee59 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/cvlm.py +++ b/src/main/python/systemds/operator/algorithm/builtin/cvlm.py @@ -28,9 +28,13 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def cvlm(X: OperationNode, y: OperationNode, k: int, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def cvlm(X: Matrix, + y: Matrix, + k: int, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X, 'y':y, 'k':k} + params_dict = {'X': X, 'y': y, 'k': k} params_dict.update(kwargs) vX_0 = Matrix(X.sds_context, '') @@ -43,6 +47,3 @@ def cvlm(X: OperationNode, y: OperationNode, k: int, **kwargs: Dict[str, VALID_I 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 477510b..e327c1b 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/dbscan.py +++ b/src/main/python/systemds/operator/algorithm/builtin/dbscan.py @@ -28,13 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S 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 dbscan(X: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X} + params_dict = {'X': X} params_dict.update(kwargs) return Matrix(X.sds_context, - 'dbscan', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'dbscan', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/decisionTree.py b/src/main/python/systemds/operator/algorithm/builtin/decisionTree.py index 5bc433f..658c01a 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/decisionTree.py +++ b/src/main/python/systemds/operator/algorithm/builtin/decisionTree.py @@ -28,7 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def decisionTree(X: OperationNode, Y: OperationNode, R: OperationNode, verbose: bool, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def decisionTree(X: Matrix, + Y: Matrix, + R: Matrix, + verbose: bool, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param a: vector, other positive Integers indicate the number of categories :param If: not provided by default all variables are assumed to be scale @@ -37,11 +42,8 @@ def decisionTree(X: OperationNode, Y: OperationNode, R: OperationNode, verbose: :param verbose: boolean specifying if the algorithm should print information while executing :return: 'OperationNode' containing looks at if j is an internal node, otherwise 0 & 6,7,... if j is categorical & a leaf node: number of misclassified samples reaching at node j & feature chosen for j is categorical rows 6,7,... depict the value subset chosen for j & a leaf node 1 if j is impure and the number of samples at j > threshold, otherwise 0 """ - params_dict = {'X':X, 'Y':Y, 'R':R, 'verbose':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) - - - \ No newline at end of file + 'decisionTree', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/discoverFD.py b/src/main/python/systemds/operator/algorithm/builtin/discoverFD.py index d5292e1..0014bf7 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/discoverFD.py +++ b/src/main/python/systemds/operator/algorithm/builtin/discoverFD.py @@ -28,12 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def discoverFD(X: OperationNode, Mask: OperationNode, threshold: float): + +def discoverFD(X: Matrix, + Mask: Matrix, + threshold: float): - params_dict = {'X':X, 'Mask':Mask, 'threshold':threshold} + params_dict = {'X': X, 'Mask': Mask, 'threshold': threshold} return Matrix(X.sds_context, - 'discoverFD', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'discoverFD', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/dist.py b/src/main/python/systemds/operator/algorithm/builtin/dist.py index 02c7c6e..6122871 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/dist.py +++ b/src/main/python/systemds/operator/algorithm/builtin/dist.py @@ -28,12 +28,10 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def dist(X: OperationNode): + +def dist(X: Matrix): - params_dict = {'X':X} + params_dict = {'X': X} return Matrix(X.sds_context, - 'dist', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'dist', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/executePipeline.py b/src/main/python/systemds/operator/algorithm/builtin/executePipeline.py index 38d3ac1..7fa78cd 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/executePipeline.py +++ b/src/main/python/systemds/operator/algorithm/builtin/executePipeline.py @@ -28,15 +28,14 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def executePipeline(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def executePipeline(X: Matrix, + **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 = {'X': X} params_dict.update(kwargs) return Matrix(X.sds_context, - 'executePipeline', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'executePipeline', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/gaussianClassifier.py b/src/main/python/systemds/operator/algorithm/builtin/gaussianClassifier.py index 761e5c5..5f35c95 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/gaussianClassifier.py +++ b/src/main/python/systemds/operator/algorithm/builtin/gaussianClassifier.py @@ -24,21 +24,25 @@ from typing import Dict, Iterable -from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn +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 gaussianClassifier(D: OperationNode, C: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def gaussianClassifier(D: Matrix, + C: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param varSmoothing: Smoothing factor for variances :param verbose: Print accuracy of the training set :return: 'OperationNode' containing """ - params_dict = {'D':D, 'C':C} + params_dict = {'D': D, 'C': C} params_dict.update(kwargs) vX_0 = Matrix(D.sds_context, '') vX_1 = Matrix(D.sds_context, '') + vX_2 = List(D.sds_context, '') vX_3 = Matrix(D.sds_context, '') output_nodes = [vX_0, vX_1, vX_2, vX_3, ] @@ -50,6 +54,3 @@ def gaussianClassifier(D: OperationNode, C: OperationNode, **kwargs: Dict[str, V 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 736a9b3..43ff5df 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/getAccuracy.py +++ b/src/main/python/systemds/operator/algorithm/builtin/getAccuracy.py @@ -28,13 +28,13 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def getAccuracy(y: OperationNode, yhat: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def getAccuracy(y: Matrix, + yhat: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'y':y, 'yhat':yhat} + params_dict = {'y': y, 'yhat': yhat} params_dict.update(kwargs) return Matrix(y.sds_context, - 'getAccuracy', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'getAccuracy', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/glm.py b/src/main/python/systemds/operator/algorithm/builtin/glm.py index b164815..a92e6c1 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/glm.py +++ b/src/main/python/systemds/operator/algorithm/builtin/glm.py @@ -28,13 +28,13 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def glm(X: OperationNode, Y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def glm(X: Matrix, + Y: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X, 'Y':Y} + params_dict = {'X': X, 'Y': Y} params_dict.update(kwargs) return Matrix(X.sds_context, - 'glm', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'glm', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/gmm.py b/src/main/python/systemds/operator/algorithm/builtin/gmm.py index f81ac4a..effeebb 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/gmm.py +++ b/src/main/python/systemds/operator/algorithm/builtin/gmm.py @@ -28,9 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def gmm(X: OperationNode, verbose: bool, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def gmm(X: Matrix, + verbose: bool, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X, 'verbose':verbose} + params_dict = {'X': X, 'verbose': verbose} params_dict.update(kwargs) vX_0 = Matrix(X.sds_context, '') @@ -53,6 +56,3 @@ def gmm(X: OperationNode, verbose: bool, **kwargs: Dict[str, VALID_INPUT_TYPES]) 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 2b5895a..23a6397 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/gmmPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/gmmPredict.py @@ -28,7 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def gmmPredict(X: OperationNode, weight: OperationNode, mu: OperationNode, precisions_cholesky: OperationNode, model: str): + +def gmmPredict(X: Matrix, + weight: Matrix, + mu: Matrix, + precisions_cholesky: Matrix, + model: str): """ :param X: Matrix X (instances to be clustered) :param weight: Weight of learned model @@ -37,7 +42,7 @@ def gmmPredict(X: OperationNode, weight: OperationNode, mu: OperationNode, preci :param model: fitted model :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} + params_dict = {'X': X, 'weight': weight, 'mu': mu, 'precisions_cholesky': precisions_cholesky, 'model': model} vX_0 = Matrix(X.sds_context, '') vX_1 = Matrix(X.sds_context, '') @@ -49,6 +54,3 @@ def gmmPredict(X: OperationNode, weight: OperationNode, mu: OperationNode, preci 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 ed69606..adae58e 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/gnmf.py +++ b/src/main/python/systemds/operator/algorithm/builtin/gnmf.py @@ -28,9 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def gnmf(X: OperationNode, rnk: int, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def gnmf(X: Matrix, + rnk: int, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X, 'rnk':rnk} + params_dict = {'X': X, 'rnk': rnk} params_dict.update(kwargs) vX_0 = Matrix(X.sds_context, '') @@ -43,6 +46,3 @@ def gnmf(X: OperationNode, rnk: int, **kwargs: Dict[str, VALID_INPUT_TYPES]): 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 08d0bba..2d1681e 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/hyperband.py +++ b/src/main/python/systemds/operator/algorithm/builtin/hyperband.py @@ -28,9 +28,16 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def hyperband(X_train: OperationNode, y_train: OperationNode, X_val: OperationNode, y_val: OperationNode, params: Iterable, paramRanges: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def hyperband(X_train: Matrix, + y_train: Matrix, + X_val: Matrix, + y_val: Matrix, + params: Iterable, + paramRanges: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X_train':X_train, 'y_train':y_train, 'X_val':X_val, 'y_val':y_val, 'params':params, 'paramRanges':paramRanges} + 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) vX_0 = Matrix(X_train.sds_context, '') @@ -43,6 +50,3 @@ def hyperband(X_train: OperationNode, y_train: OperationNode, X_val: OperationNo 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 171ecef..72dbcbc 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/img_brightness.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_brightness.py @@ -28,12 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S 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): + +def img_brightness(img_in: Matrix, + value: float, + channel_max: int): - params_dict = {'img_in':img_in, 'value':value, 'channel_max':channel_max} + 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) - - - \ No newline at end of file + 'img_brightness', + named_input_nodes=params_dict) 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 848dbdb..701b891 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/img_crop.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_crop.py @@ -28,12 +28,14 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S 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): + +def img_crop(img_in: Matrix, + 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} + 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) - - - \ No newline at end of file + 'img_crop', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/img_cutout.py b/src/main/python/systemds/operator/algorithm/builtin/img_cutout.py index 60e55e8..5dd6a50 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/img_cutout.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_cutout.py @@ -28,7 +28,13 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def img_cutout(img_in: OperationNode, x: int, y: int, width: int, height: int, fill_value: float): + +def img_cutout(img_in: Matrix, + x: int, + y: int, + width: int, + height: int, + fill_value: float): """ :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) @@ -38,10 +44,7 @@ def img_cutout(img_in: OperationNode, x: int, y: int, width: int, height: int, f :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 = {'img_in':img_in, 'x':x, 'y':y, 'width':width, 'height':height, 'fill_value':fill_value} + 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 + 'img_cutout', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/img_invert.py b/src/main/python/systemds/operator/algorithm/builtin/img_invert.py index 76c9613..942a2e2 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/img_invert.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_invert.py @@ -28,16 +28,15 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def img_invert(img_in: OperationNode, max_value: float): + +def img_invert(img_in: Matrix, + max_value: float): """ :param img_in: Input image :param max_value: The maximum value pixels can have :return: 'OperationNode' containing """ - params_dict = {'img_in':img_in, 'max_value':max_value} + 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 + 'img_invert', + named_input_nodes=params_dict) 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 3e1833e..8b1f495 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/img_mirror.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_mirror.py @@ -28,12 +28,11 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def img_mirror(img_in: OperationNode, horizontal_axis: bool): + +def img_mirror(img_in: Matrix, + horizontal_axis: bool): - params_dict = {'img_in':img_in, 'horizontal_axis':horizontal_axis} + params_dict = {'img_in': img_in, 'horizontal_axis': horizontal_axis} return Matrix(img_in.sds_context, - 'img_mirror', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'img_mirror', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/img_posterize.py b/src/main/python/systemds/operator/algorithm/builtin/img_posterize.py index 3595ea4..c6f2b41 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/img_posterize.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_posterize.py @@ -28,17 +28,16 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def img_posterize(img_in: OperationNode, bits: int): + +def img_posterize(img_in: Matrix, + bits: int): """ :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 = {'img_in':img_in, 'bits':bits} + 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 + 'img_posterize', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/img_rotate.py b/src/main/python/systemds/operator/algorithm/builtin/img_rotate.py index 71ec866..5f3228c 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/img_rotate.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_rotate.py @@ -28,17 +28,17 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def img_rotate(img_in: OperationNode, radians: float, fill_value: float): + +def img_rotate(img_in: Matrix, + radians: float, + fill_value: float): """ :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 = {'img_in':img_in, 'radians':radians, 'fill_value':fill_value} + 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 + 'img_rotate', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/img_sample_pairing.py b/src/main/python/systemds/operator/algorithm/builtin/img_sample_pairing.py index 786d6a3..6cbdc3a 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/img_sample_pairing.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_sample_pairing.py @@ -28,7 +28,10 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def img_sample_pairing(img_in1: OperationNode, img_in2: OperationNode, weight: float): + +def img_sample_pairing(img_in1: Matrix, + img_in2: Matrix, + weight: float): """ :param img_in1: First input image :param img_in2: Second input image @@ -36,10 +39,7 @@ def img_sample_pairing(img_in1: OperationNode, img_in2: OperationNode, weight: f :param 0: img_in1, 1 means only img_in2 will be visible :return: 'OperationNode' containing """ - params_dict = {'img_in1':img_in1, 'img_in2':img_in2, 'weight':weight} + 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 + 'img_sample_pairing', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/img_shear.py b/src/main/python/systemds/operator/algorithm/builtin/img_shear.py index 3844992..74f1665 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/img_shear.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_shear.py @@ -28,7 +28,11 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def img_shear(img_in: OperationNode, shear_x: float, shear_y: float, fill_value: float): + +def img_shear(img_in: Matrix, + shear_x: float, + shear_y: float, + fill_value: float): """ :param img_in: Input image as 2D matrix with top left corner at [1, 1] :param shear_x: Shearing factor for horizontal shearing @@ -36,10 +40,7 @@ def img_shear(img_in: OperationNode, shear_x: float, shear_y: float, fill_value: :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 = {'img_in':img_in, 'shear_x':shear_x, 'shear_y':shear_y, 'fill_value':fill_value} + 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 + 'img_shear', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/img_transform.py b/src/main/python/systemds/operator/algorithm/builtin/img_transform.py index 4a3e476..9120568 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/img_transform.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_transform.py @@ -28,7 +28,17 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import 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): + +def img_transform(img_in: Matrix, + out_w: int, + out_h: int, + a: float, + b: float, + c: float, + d: float, + e: float, + f: float, + fill_value: float): """ :param img_in: Input image as 2D matrix with top left corner at [1, 1] :param out_w: Width of the output image @@ -37,10 +47,7 @@ def img_transform(img_in: OperationNode, out_w: int, out_h: int, a: float, b: fl :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 = {'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} + 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 + 'img_transform', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/img_translate.py b/src/main/python/systemds/operator/algorithm/builtin/img_translate.py index 8725b14..99247f5 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/img_translate.py +++ b/src/main/python/systemds/operator/algorithm/builtin/img_translate.py @@ -28,7 +28,13 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def img_translate(img_in: OperationNode, offset_x: float, offset_y: float, out_w: int, out_h: int, fill_value: float): + +def img_translate(img_in: Matrix, + offset_x: float, + offset_y: float, + out_w: int, + out_h: int, + fill_value: float): """ :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 @@ -38,10 +44,7 @@ def img_translate(img_in: OperationNode, offset_x: float, offset_y: float, out_w :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 = {'img_in':img_in, 'offset_x':offset_x, 'offset_y':offset_y, 'out_w':out_w, 'out_h':out_h, 'fill_value':fill_value} + 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 + 'img_translate', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/imputeByFD.py b/src/main/python/systemds/operator/algorithm/builtin/imputeByFD.py index fc306bf..bd24bb0 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/imputeByFD.py +++ b/src/main/python/systemds/operator/algorithm/builtin/imputeByFD.py @@ -28,13 +28,15 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def imputeByFD(X: OperationNode, sourceAttribute: int, targetAttribute: int, threshold: float, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def imputeByFD(X: Matrix, + sourceAttribute: int, + targetAttribute: int, + threshold: float, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X, 'sourceAttribute':sourceAttribute, 'targetAttribute':targetAttribute, 'threshold':threshold} + 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) - - - \ No newline at end of file + 'imputeByFD', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/imputeByMean.py b/src/main/python/systemds/operator/algorithm/builtin/imputeByMean.py index 5f6e5dc..cc62789 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/imputeByMean.py +++ b/src/main/python/systemds/operator/algorithm/builtin/imputeByMean.py @@ -28,12 +28,11 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def imputeByMean(X: OperationNode, mask: OperationNode): + +def imputeByMean(X: Matrix, + mask: Matrix): - params_dict = {'X':X, 'mask':mask} + params_dict = {'X': X, 'mask': mask} return Matrix(X.sds_context, - 'imputeByMean', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'imputeByMean', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/imputeByMedian.py b/src/main/python/systemds/operator/algorithm/builtin/imputeByMedian.py index 3aa3103..abb806d 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/imputeByMedian.py +++ b/src/main/python/systemds/operator/algorithm/builtin/imputeByMedian.py @@ -28,12 +28,11 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def imputeByMedian(X: OperationNode, mask: OperationNode): + +def imputeByMedian(X: Matrix, + mask: Matrix): - params_dict = {'X':X, 'mask':mask} + params_dict = {'X': X, 'mask': mask} return Matrix(X.sds_context, - 'imputeByMedian', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'imputeByMedian', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/imputeByMode.py b/src/main/python/systemds/operator/algorithm/builtin/imputeByMode.py index dc613fc..c6921b1 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/imputeByMode.py +++ b/src/main/python/systemds/operator/algorithm/builtin/imputeByMode.py @@ -28,12 +28,10 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def imputeByMode(X: OperationNode): + +def imputeByMode(X: Matrix): - params_dict = {'X':X} + params_dict = {'X': X} return Matrix(X.sds_context, - 'imputeByMode', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'imputeByMode', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/intersect.py b/src/main/python/systemds/operator/algorithm/builtin/intersect.py index b0c2c80..5cf6b5b 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/intersect.py +++ b/src/main/python/systemds/operator/algorithm/builtin/intersect.py @@ -28,12 +28,11 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def intersect(X: OperationNode, Y: OperationNode): + +def intersect(X: Matrix, + Y: Matrix): - params_dict = {'X':X, 'Y':Y} + params_dict = {'X': X, 'Y': Y} return Matrix(X.sds_context, - 'intersect', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'intersect', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/km.py b/src/main/python/systemds/operator/algorithm/builtin/km.py index ef5ea84..f4df2b5 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/km.py +++ b/src/main/python/systemds/operator/algorithm/builtin/km.py @@ -28,7 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def km(X: OperationNode, TE: OperationNode, GI: OperationNode, SI: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def km(X: Matrix, + TE: Matrix, + GI: Matrix, + SI: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param X: Input matrix X containing the survival data: :param number: (categorical features) for grouping and/or stratifying @@ -45,7 +50,7 @@ def km(X: OperationNode, TE: OperationNode, GI: OperationNode, SI: OperationNode :param perform: survival data across multiple groups: "none" (the default) :return: 'OperationNode' containing 7 consecutive columns in km corresponds to a unique combination of groups and strata in the data & schema & whose dimension depends on the number of groups (g) and strata (s) in the data (k denotes the number & for grouping ,i.e., ncol(gi) and l denotes the number of factors used for stratifying, i.e., ncol(si)) & of groups and strata is equal to 1, m will have 4 columns with & data from multiple groups available and ttype=log-rank or wilcoxon, [...] """ - params_dict = {'X':X, 'TE':TE, 'GI':GI, 'SI':SI} + params_dict = {'X': X, 'TE': TE, 'GI': GI, 'SI': SI} params_dict.update(kwargs) vX_0 = Matrix(X.sds_context, '') @@ -62,6 +67,3 @@ def km(X: OperationNode, TE: OperationNode, GI: OperationNode, SI: OperationNode 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 82c2a3f..823c10a 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/kmeans.py +++ b/src/main/python/systemds/operator/algorithm/builtin/kmeans.py @@ -28,7 +28,9 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def kmeans(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def kmeans(X: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param X: The input Matrix to do KMeans on. :param k: Number of centroids @@ -40,7 +42,7 @@ def kmeans(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): :param seed: The seed used for initial sampling. If set to -1 random seeds are selected. :return: 'OperationNode' containing the mapping of records to centroids & the output matrix with the centroids """ - params_dict = {'X':X} + params_dict = {'X': X} params_dict.update(kwargs) vX_0 = Matrix(X.sds_context, '') @@ -53,6 +55,3 @@ def kmeans(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): 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 ef85ff7..80fa3aa 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/kmeansPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/kmeansPredict.py @@ -28,16 +28,15 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def kmeansPredict(X: OperationNode, C: OperationNode): + +def kmeansPredict(X: Matrix, + C: Matrix): """ :param X: The input Matrix to do KMeans on. :param C: The input Centroids to map X onto. :return: 'OperationNode' containing the mapping of records to centroids """ - params_dict = {'X':X, 'C':C} + params_dict = {'X': X, 'C': C} return Matrix(X.sds_context, - 'kmeansPredict', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'kmeansPredict', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/knnbf.py b/src/main/python/systemds/operator/algorithm/builtin/knnbf.py index 2a7411e..b242936 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/knnbf.py +++ b/src/main/python/systemds/operator/algorithm/builtin/knnbf.py @@ -28,12 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def knnbf(X: OperationNode, T: OperationNode, k_value: int): + +def knnbf(X: Matrix, + T: Matrix, + k_value: int): - params_dict = {'X':X, 'T':T, 'k_value':k_value} + params_dict = {'X': X, 'T': T, 'k_value': k_value} return Matrix(X.sds_context, - 'knnbf', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'knnbf', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/l2svm.py b/src/main/python/systemds/operator/algorithm/builtin/l2svm.py index 3e7d0e6..454e751 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/l2svm.py +++ b/src/main/python/systemds/operator/algorithm/builtin/l2svm.py @@ -28,7 +28,10 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def l2svm(X: OperationNode, Y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def l2svm(X: Matrix, + Y: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param X: matrix X of feature vectors :param Y: matrix Y of class labels have to be a single column @@ -41,11 +44,8 @@ def l2svm(X: OperationNode, Y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TY :param columnId: The column Id used if one wants to add a ID to the print statement, Specificly usefull when L2SVM is used in MSVM. :return: 'OperationNode' containing model matrix """ - params_dict = {'X':X, 'Y':Y} + params_dict = {'X': X, 'Y': Y} params_dict.update(kwargs) return Matrix(X.sds_context, - 'l2svm', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'l2svm', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/l2svmPredict.py b/src/main/python/systemds/operator/algorithm/builtin/l2svmPredict.py index dd0ea44..e10f749 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/l2svmPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/l2svmPredict.py @@ -28,14 +28,17 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def l2svmPredict(X: OperationNode, W: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def l2svmPredict(X: Matrix, + W: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param X: matrix X of feature vectors to classify :param W: matrix of the trained variables :param verbose: Set to true if one wants print statements. :return: 'OperationNode' containing classification labels maxed to ones and zeros. """ - params_dict = {'X':X, 'W':W} + params_dict = {'X': X, 'W': W} params_dict.update(kwargs) vX_0 = Matrix(X.sds_context, '') @@ -48,6 +51,3 @@ def l2svmPredict(X: OperationNode, W: OperationNode, **kwargs: Dict[str, VALID_I 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 a299180..3c40fa0 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/lasso.py +++ b/src/main/python/systemds/operator/algorithm/builtin/lasso.py @@ -28,7 +28,10 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def lasso(X: OperationNode, y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def lasso(X: Matrix, + y: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param X: input feature matrix :param y: matrix Y columns of the design matrix @@ -38,11 +41,8 @@ def lasso(X: OperationNode, y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TY :param maxi: maximum number of iterations until convergence :return: 'OperationNode' containing """ - params_dict = {'X':X, 'y':y} + params_dict = {'X': X, 'y': y} params_dict.update(kwargs) return Matrix(X.sds_context, - 'lasso', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'lasso', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/lm.py b/src/main/python/systemds/operator/algorithm/builtin/lm.py index 7400c25..0a9ce19 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/lm.py +++ b/src/main/python/systemds/operator/algorithm/builtin/lm.py @@ -28,7 +28,10 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def lm(X: OperationNode, y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def lm(X: Matrix, + y: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param X: Matrix of feature vectors. :param y: 1-column matrix of response values. @@ -39,11 +42,8 @@ def lm(X: OperationNode, y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES :param verbose: If TRUE print messages are activated :return: 'OperationNode' containing the model fit """ - params_dict = {'X':X, 'y':y} + params_dict = {'X': X, 'y': y} params_dict.update(kwargs) return Matrix(X.sds_context, - 'lm', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'lm', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/lmCG.py b/src/main/python/systemds/operator/algorithm/builtin/lmCG.py index 7d9ef78..a2d67af 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/lmCG.py +++ b/src/main/python/systemds/operator/algorithm/builtin/lmCG.py @@ -28,13 +28,13 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def lmCG(X: OperationNode, y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def lmCG(X: Matrix, + y: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X, 'y':y} + params_dict = {'X': X, 'y': y} params_dict.update(kwargs) return Matrix(X.sds_context, - 'lmCG', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'lmCG', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/lmDS.py b/src/main/python/systemds/operator/algorithm/builtin/lmDS.py index de6bbee..132a32a 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/lmDS.py +++ b/src/main/python/systemds/operator/algorithm/builtin/lmDS.py @@ -28,13 +28,13 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def lmDS(X: OperationNode, y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def lmDS(X: Matrix, + y: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X, 'y':y} + params_dict = {'X': X, 'y': y} params_dict.update(kwargs) return Matrix(X.sds_context, - 'lmDS', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'lmDS', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/lmPredict.py b/src/main/python/systemds/operator/algorithm/builtin/lmPredict.py index 28bf6fe..612887b 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/lmPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/lmPredict.py @@ -28,13 +28,14 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def lmPredict(X: OperationNode, B: OperationNode, ytest: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def lmPredict(X: Matrix, + B: Matrix, + ytest: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X, 'B':B, 'ytest':ytest} + params_dict = {'X': X, 'B': B, 'ytest': ytest} params_dict.update(kwargs) return Matrix(X.sds_context, - 'lmPredict', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'lmPredict', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/logSumExp.py b/src/main/python/systemds/operator/algorithm/builtin/logSumExp.py index ddd0a20..787649d 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/logSumExp.py +++ b/src/main/python/systemds/operator/algorithm/builtin/logSumExp.py @@ -28,13 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def logSumExp(M: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def logSumExp(M: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'M':M} + params_dict = {'M': M} params_dict.update(kwargs) return Matrix(M.sds_context, - 'logSumExp', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'logSumExp', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/msvm.py b/src/main/python/systemds/operator/algorithm/builtin/msvm.py index 5fca57c..918a36b 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/msvm.py +++ b/src/main/python/systemds/operator/algorithm/builtin/msvm.py @@ -28,13 +28,13 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def msvm(X: OperationNode, Y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def msvm(X: Matrix, + Y: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X, 'Y':Y} + params_dict = {'X': X, 'Y': Y} params_dict.update(kwargs) return Matrix(X.sds_context, - 'msvm', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'msvm', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/msvmPredict.py b/src/main/python/systemds/operator/algorithm/builtin/msvmPredict.py index 8b061cc..ec1b539 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/msvmPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/msvmPredict.py @@ -28,13 +28,15 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def msvmPredict(X: OperationNode, W: OperationNode): + +def msvmPredict(X: Matrix, + W: Matrix): """ :param X: matrix X of feature vectors to classify :param W: matrix of the trained variables :return: 'OperationNode' containing classification labels maxed to ones and zeros. """ - params_dict = {'X':X, 'W':W} + params_dict = {'X': X, 'W': W} vX_0 = Matrix(X.sds_context, '') vX_1 = Matrix(X.sds_context, '') @@ -46,6 +48,3 @@ def msvmPredict(X: OperationNode, W: OperationNode): 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 6ad34fa..c2540cc 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/multiLogReg.py +++ b/src/main/python/systemds/operator/algorithm/builtin/multiLogReg.py @@ -28,7 +28,10 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def multiLogReg(X: OperationNode, Y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def multiLogReg(X: Matrix, + Y: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param X: Location to read the matrix of feature vectors :param Y: Location to read the matrix with category labels @@ -40,11 +43,8 @@ def multiLogReg(X: OperationNode, Y: OperationNode, **kwargs: Dict[str, VALID_IN :param verbose: flag specifying if logging information should be printed :return: 'OperationNode' containing betas as output for prediction """ - params_dict = {'X':X, 'Y':Y} + params_dict = {'X': X, 'Y': Y} params_dict.update(kwargs) return Matrix(X.sds_context, - 'multiLogReg', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'multiLogReg', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/multiLogRegPredict.py b/src/main/python/systemds/operator/algorithm/builtin/multiLogRegPredict.py index b3d6290..6075c69 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/multiLogRegPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/multiLogRegPredict.py @@ -28,7 +28,11 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def multiLogRegPredict(X: OperationNode, B: OperationNode, Y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def multiLogRegPredict(X: Matrix, + B: Matrix, + Y: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param X: Data Matrix X :param B: Regression parameters betas @@ -36,7 +40,7 @@ def multiLogRegPredict(X: OperationNode, B: OperationNode, Y: OperationNode, **k :param verbose: / :return: 'OperationNode' containing matrix m of predicted means/probabilities & predicted response vector & scalar value of accuracy """ - params_dict = {'X':X, 'B':B, 'Y':Y} + params_dict = {'X': X, 'B': B, 'Y': Y} params_dict.update(kwargs) vX_0 = Matrix(X.sds_context, '') @@ -51,6 +55,3 @@ def multiLogRegPredict(X: OperationNode, B: OperationNode, Y: OperationNode, **k 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 aacd2ab..58c3c16 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/na_locf.py +++ b/src/main/python/systemds/operator/algorithm/builtin/na_locf.py @@ -28,13 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def na_locf(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def na_locf(X: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X} + params_dict = {'X': X} params_dict.update(kwargs) return Matrix(X.sds_context, - 'na_locf', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'na_locf', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/naiveBayes.py b/src/main/python/systemds/operator/algorithm/builtin/naiveBayes.py index d049531..84c4ae8 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/naiveBayes.py +++ b/src/main/python/systemds/operator/algorithm/builtin/naiveBayes.py @@ -28,9 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def naiveBayes(D: OperationNode, C: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def naiveBayes(D: Matrix, + C: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'D':D, 'C':C} + params_dict = {'D': D, 'C': C} params_dict.update(kwargs) vX_0 = Matrix(D.sds_context, '') @@ -43,6 +46,3 @@ def naiveBayes(D: OperationNode, C: OperationNode, **kwargs: Dict[str, VALID_INP 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 1f1603f..508670c 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/naiveBayesPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/naiveBayesPredict.py @@ -28,9 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def naiveBayesPredict(X: OperationNode, P: OperationNode, C: OperationNode): + +def naiveBayesPredict(X: Matrix, + P: Matrix, + C: Matrix): - params_dict = {'X':X, 'P':P, 'C':C} + params_dict = {'X': X, 'P': P, 'C': C} vX_0 = Matrix(X.sds_context, '') vX_1 = Matrix(X.sds_context, '') @@ -42,6 +45,3 @@ def naiveBayesPredict(X: OperationNode, P: OperationNode, C: OperationNode): 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 3578830..da36cb1 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/normalize.py +++ b/src/main/python/systemds/operator/algorithm/builtin/normalize.py @@ -28,12 +28,10 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def normalize(X: OperationNode): + +def normalize(X: Matrix): - params_dict = {'X':X} + params_dict = {'X': X} return Matrix(X.sds_context, - 'normalize', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'normalize', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/outlier.py b/src/main/python/systemds/operator/algorithm/builtin/outlier.py index 0e3fd85..cd97cfb 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/outlier.py +++ b/src/main/python/systemds/operator/algorithm/builtin/outlier.py @@ -28,12 +28,11 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def outlier(X: OperationNode, opposite: bool): + +def outlier(X: Matrix, + opposite: bool): - params_dict = {'X':X, 'opposite':opposite} + params_dict = {'X': X, 'opposite': opposite} return Matrix(X.sds_context, - 'outlier', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'outlier', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/outlierByArima.py b/src/main/python/systemds/operator/algorithm/builtin/outlierByArima.py index 47589ab..80f1b1e 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/outlierByArima.py +++ b/src/main/python/systemds/operator/algorithm/builtin/outlierByArima.py @@ -28,13 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def outlierByArima(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def outlierByArima(X: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X} + params_dict = {'X': X} params_dict.update(kwargs) return Matrix(X.sds_context, - 'outlierByArima', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'outlierByArima', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/outlierByIQR.py b/src/main/python/systemds/operator/algorithm/builtin/outlierByIQR.py index 294b53f..0a36298 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/outlierByIQR.py +++ b/src/main/python/systemds/operator/algorithm/builtin/outlierByIQR.py @@ -28,13 +28,14 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def outlierByIQR(X: OperationNode, k: float, max_iterations: int, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def outlierByIQR(X: Matrix, + k: float, + max_iterations: int, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X, 'k':k, 'max_iterations':max_iterations} + 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) - - - \ No newline at end of file + 'outlierByIQR', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/outlierBySd.py b/src/main/python/systemds/operator/algorithm/builtin/outlierBySd.py index 848e193..38174f7 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/outlierBySd.py +++ b/src/main/python/systemds/operator/algorithm/builtin/outlierBySd.py @@ -28,13 +28,13 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def outlierBySd(X: OperationNode, max_iterations: int, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def outlierBySd(X: Matrix, + max_iterations: int, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X, 'max_iterations':max_iterations} + params_dict = {'X': X, 'max_iterations': max_iterations} params_dict.update(kwargs) return Matrix(X.sds_context, - 'outlierBySd', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'outlierBySd', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/pca.py b/src/main/python/systemds/operator/algorithm/builtin/pca.py index 5fff19c..a05df0e 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/pca.py +++ b/src/main/python/systemds/operator/algorithm/builtin/pca.py @@ -28,7 +28,9 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def pca(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def pca(X: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param X: Input feature matrix :param K: Number of reduced dimensions (i.e., columns) @@ -36,7 +38,7 @@ def pca(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): :param Scale: Indicates whether or not to scale the feature matrix :return: 'OperationNode' containing output dominant eigen vectors (can be used for projections) & the column means of the input, subtracted to construct the pca & the scaling of the values, to make each dimension same size. """ - params_dict = {'X':X} + params_dict = {'X': X} params_dict.update(kwargs) vX_0 = Matrix(X.sds_context, '') @@ -53,6 +55,3 @@ def pca(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): 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 7be0d1d..32a21a5 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/pnmf.py +++ b/src/main/python/systemds/operator/algorithm/builtin/pnmf.py @@ -28,9 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def pnmf(X: OperationNode, rnk: int, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def pnmf(X: Matrix, + rnk: int, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X, 'rnk':rnk} + params_dict = {'X': X, 'rnk': rnk} params_dict.update(kwargs) vX_0 = Matrix(X.sds_context, '') @@ -43,6 +46,3 @@ def pnmf(X: OperationNode, rnk: int, **kwargs: Dict[str, VALID_INPUT_TYPES]): 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 4981762..466fb0b 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/ppca.py +++ b/src/main/python/systemds/operator/algorithm/builtin/ppca.py @@ -28,7 +28,9 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def ppca(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def ppca(X: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param X: n x m input feature matrix :param k: indicates dimension of the new vector space constructed from eigen vectors @@ -38,7 +40,7 @@ def ppca(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): :param verbose: verbose debug output :return: 'OperationNode' containing output feature matrix with k columns & output dominant eigen vectors (can be used for projections) """ - params_dict = {'X':X} + params_dict = {'X': X} params_dict.update(kwargs) vX_0 = Matrix(X.sds_context, '') @@ -51,6 +53,3 @@ def ppca(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): 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 0cc28fc..a4f61c4 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/randomForest.py +++ b/src/main/python/systemds/operator/algorithm/builtin/randomForest.py @@ -28,7 +28,11 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def randomForest(X: OperationNode, Y: OperationNode, R: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def randomForest(X: Matrix, + Y: Matrix, + R: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param X: Feature matrix X; note that X needs to be both recoded and dummy coded :param Y: Label matrix Y; note that Y needs to be both recoded and dummy coded @@ -47,7 +51,7 @@ def randomForest(X: OperationNode, Y: OperationNode, R: OperationNode, **kwargs: :param impurity: Impurity measure: entropy or Gini (the default) :return: 'OperationNode' containing tree and each row contains the following information: & that leaf node j is supposed to predict & 7,8,... if j is categorical & chosen for j is categorical rows 7,8,... depict the value subset chosen for j & c containing the number of times samples are chosen in each tree of the random forest & from scale feature ids to global feature ids & from categorical feature ids to global feature ids """ - params_dict = {'X':X, 'Y':Y, 'R':R} + params_dict = {'X': X, 'Y': Y, 'R': R} params_dict.update(kwargs) vX_0 = Matrix(X.sds_context, '') @@ -64,6 +68,3 @@ def randomForest(X: OperationNode, Y: OperationNode, R: OperationNode, **kwargs: 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 c6017cf..7974e74 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/scale.py +++ b/src/main/python/systemds/operator/algorithm/builtin/scale.py @@ -28,9 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def scale(X: OperationNode, center: bool, scale: bool): + +def scale(X: Matrix, + center: bool, + scale: bool): - params_dict = {'X':X, 'center':center, 'scale':scale} + params_dict = {'X': X, 'center': center, 'scale': scale} vX_0 = Matrix(X.sds_context, '') vX_1 = Matrix(X.sds_context, '') @@ -44,6 +47,3 @@ def scale(X: OperationNode, center: bool, scale: bool): 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 0a95e3c..53a6ac6 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/scaleApply.py +++ b/src/main/python/systemds/operator/algorithm/builtin/scaleApply.py @@ -28,12 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def scaleApply(X: OperationNode, Centering: OperationNode, ScaleFactor: OperationNode): + +def scaleApply(X: Matrix, + Centering: Matrix, + ScaleFactor: Matrix): - params_dict = {'X':X, 'Centering':Centering, 'ScaleFactor':ScaleFactor} + params_dict = {'X': X, 'Centering': Centering, 'ScaleFactor': ScaleFactor} return Matrix(X.sds_context, - 'scaleApply', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'scaleApply', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/sherlock.py b/src/main/python/systemds/operator/algorithm/builtin/sherlock.py index cbae8e7..664cd3e 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/sherlock.py +++ b/src/main/python/systemds/operator/algorithm/builtin/sherlock.py @@ -28,9 +28,11 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def sherlock(X_train: OperationNode, y_train: OperationNode): + +def sherlock(X_train: Matrix, + y_train: Matrix): - params_dict = {'X_train':X_train, 'y_train':y_train} + params_dict = {'X_train': X_train, 'y_train': y_train} vX_0 = Matrix(X_train.sds_context, '') vX_1 = Matrix(X_train.sds_context, '') @@ -98,6 +100,3 @@ def sherlock(X_train: OperationNode, y_train: OperationNode): 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 91aabff..3cc6cbd 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/sherlockPredict.py +++ b/src/main/python/systemds/operator/algorithm/builtin/sherlockPredict.py @@ -28,12 +28,40 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S 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 [...] + +def sherlockPredict(X: Matrix, + cW1: Matrix, + cb1: Matrix, + cW2: Matrix, + cb2: Matrix, + cW3: Matrix, + cb3: Matrix, + wW1: Matrix, + wb1: Matrix, + wW2: Matrix, + wb2: Matrix, + wW3: Matrix, + wb3: Matrix, + pW1: Matrix, + pb1: Matrix, + pW2: Matrix, + pb2: Matrix, + pW3: Matrix, + pb3: Matrix, + sW1: Matrix, + sb1: Matrix, + sW2: Matrix, + sb2: Matrix, + sW3: Matrix, + sb3: Matrix, + fW1: Matrix, + fb1: Matrix, + fW2: Matrix, + fb2: Matrix, + fW3: Matrix, + fb3: Matrix): - 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} + 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) - - - \ No newline at end of file + 'sherlockPredict', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/sigmoid.py b/src/main/python/systemds/operator/algorithm/builtin/sigmoid.py index 96f5820..c78d9da 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/sigmoid.py +++ b/src/main/python/systemds/operator/algorithm/builtin/sigmoid.py @@ -28,12 +28,10 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def sigmoid(X: OperationNode): + +def sigmoid(X: Matrix): - params_dict = {'X':X} + params_dict = {'X': X} return Matrix(X.sds_context, - 'sigmoid', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'sigmoid', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/slicefinder.py b/src/main/python/systemds/operator/algorithm/builtin/slicefinder.py index 42fef5e..9e0f692 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/slicefinder.py +++ b/src/main/python/systemds/operator/algorithm/builtin/slicefinder.py @@ -28,9 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def slicefinder(X: OperationNode, e: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def slicefinder(X: Matrix, + e: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X, 'e':e} + params_dict = {'X': X, 'e': e} params_dict.update(kwargs) vX_0 = Matrix(X.sds_context, '') @@ -45,6 +48,3 @@ def slicefinder(X: OperationNode, e: OperationNode, **kwargs: Dict[str, VALID_IN 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 2084b59..8d62f73 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/smote.py +++ b/src/main/python/systemds/operator/algorithm/builtin/smote.py @@ -28,13 +28,13 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def smote(X: OperationNode, mask: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def smote(X: Matrix, + mask: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X, 'mask':mask} + params_dict = {'X': X, 'mask': mask} params_dict.update(kwargs) return Matrix(X.sds_context, - 'smote', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'smote', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/split.py b/src/main/python/systemds/operator/algorithm/builtin/split.py index 1a8e306..f21572d 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/split.py +++ b/src/main/python/systemds/operator/algorithm/builtin/split.py @@ -28,9 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def split(X: OperationNode, Y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def split(X: Matrix, + Y: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X, 'Y':Y} + params_dict = {'X': X, 'Y': Y} params_dict.update(kwargs) vX_0 = Matrix(X.sds_context, '') @@ -47,6 +50,3 @@ def split(X: OperationNode, Y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TY 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 6eb9962..6a39965 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/splitBalanced.py +++ b/src/main/python/systemds/operator/algorithm/builtin/splitBalanced.py @@ -28,9 +28,13 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S 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): + +def splitBalanced(X: Matrix, + Y: Matrix, + splitRatio: float, + verbose: bool): - params_dict = {'X':X, 'Y':Y, 'splitRatio':splitRatio, 'verbose':verbose} + params_dict = {'X': X, 'Y': Y, 'splitRatio': splitRatio, 'verbose': verbose} vX_0 = Matrix(X.sds_context, '') vX_1 = Matrix(X.sds_context, '') @@ -46,6 +50,3 @@ def splitBalanced(X: OperationNode, Y: OperationNode, splitRatio: float, verbose 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 6c09dc5..5dd2bb8 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/stableMarriage.py +++ b/src/main/python/systemds/operator/algorithm/builtin/stableMarriage.py @@ -28,7 +28,10 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def stableMarriage(P: OperationNode, A: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def stableMarriage(P: Matrix, + A: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): """ :param P: proposer matrix P. :param It: a square matrix with no zeros. @@ -38,11 +41,8 @@ def stableMarriage(P: OperationNode, A: OperationNode, **kwargs: Dict[str, VALID :param index: vice-versa (higher is better). :return: 'OperationNode' containing result matrix & 1 (2.0 preference value) and acceptor 2 (1.0 preference value). & 3 (2.0 preference value) and proposer 2 (1.0 preference value). & matched with proposer 3 (since [1,3] is non-zero) at a preference level of 3.0. & matched with proposer 2 (since [2,2] is non-zero) at a preference level of 3.0. & matched with proposer 1 (since [3,1] is non-zero) at a preference level of 1.0. """ - params_dict = {'P':P, 'A':A} + params_dict = {'P': P, 'A': A} params_dict.update(kwargs) return Matrix(P.sds_context, - 'stableMarriage', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'stableMarriage', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/statsNA.py b/src/main/python/systemds/operator/algorithm/builtin/statsNA.py index 2e5e5bc..db8c1f4 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/statsNA.py +++ b/src/main/python/systemds/operator/algorithm/builtin/statsNA.py @@ -28,13 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def statsNA(X: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def statsNA(X: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X} + params_dict = {'X': X} params_dict.update(kwargs) return Matrix(X.sds_context, - 'statsNA', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'statsNA', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/steplm.py b/src/main/python/systemds/operator/algorithm/builtin/steplm.py index 5565b4e..95d9465 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/steplm.py +++ b/src/main/python/systemds/operator/algorithm/builtin/steplm.py @@ -28,9 +28,12 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def steplm(X: OperationNode, y: OperationNode, **kwargs: Dict[str, VALID_INPUT_TYPES]): + +def steplm(X: Matrix, + y: Matrix, + **kwargs: Dict[str, VALID_INPUT_TYPES]): - params_dict = {'X':X, 'y':y} + params_dict = {'X': X, 'y': y} params_dict.update(kwargs) vX_0 = Matrix(X.sds_context, '') @@ -43,6 +46,3 @@ def steplm(X: OperationNode, y: OperationNode, **kwargs: Dict[str, VALID_INPUT_T 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 105ec27..74b00b8 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/toOneHot.py +++ b/src/main/python/systemds/operator/algorithm/builtin/toOneHot.py @@ -28,16 +28,15 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def toOneHot(X: OperationNode, numClasses: int): + +def toOneHot(X: Matrix, + numClasses: int): """ :param X: vector with N integer entries between 1 and numClasses :param numclasses: number of columns, must be >= largest value in X :return: 'OperationNode' containing matrix with shape (n, numclasses) """ - params_dict = {'X':X, 'numClasses':numClasses} + params_dict = {'X': X, 'numClasses': numClasses} return Matrix(X.sds_context, - 'toOneHot', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'toOneHot', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/tomeklink.py b/src/main/python/systemds/operator/algorithm/builtin/tomeklink.py index f9d565e..e2e020c 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/tomeklink.py +++ b/src/main/python/systemds/operator/algorithm/builtin/tomeklink.py @@ -28,13 +28,15 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def tomeklink(X: OperationNode, y: OperationNode): + +def tomeklink(X: Matrix, + y: Matrix): """ :param X: Data Matrix (nxm) :param y: Label Matrix (nx1) :return: 'OperationNode' containing """ - params_dict = {'X':X, 'y':y} + params_dict = {'X': X, 'y': y} vX_0 = Matrix(X.sds_context, '') vX_1 = Matrix(X.sds_context, '') @@ -48,6 +50,3 @@ def tomeklink(X: OperationNode, y: OperationNode): 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 bf165c2..070a49a 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/univar.py +++ b/src/main/python/systemds/operator/algorithm/builtin/univar.py @@ -28,12 +28,11 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def univar(X: OperationNode, types: OperationNode): + +def univar(X: Matrix, + types: Matrix): - params_dict = {'X':X, 'types':types} + params_dict = {'X': X, 'types': types} return Matrix(X.sds_context, - 'univar', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'univar', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/vectorToCsv.py b/src/main/python/systemds/operator/algorithm/builtin/vectorToCsv.py index 065e9c5..0a54b2d 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/vectorToCsv.py +++ b/src/main/python/systemds/operator/algorithm/builtin/vectorToCsv.py @@ -28,12 +28,10 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def vectorToCsv(mask: OperationNode): + +def vectorToCsv(mask: Matrix): - params_dict = {'mask':mask} + params_dict = {'mask': mask} return Matrix(mask.sds_context, - 'vectorToCsv', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'vectorToCsv', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/winsorize.py b/src/main/python/systemds/operator/algorithm/builtin/winsorize.py index 6133e75..335d01b 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/winsorize.py +++ b/src/main/python/systemds/operator/algorithm/builtin/winsorize.py @@ -28,12 +28,11 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def winsorize(X: OperationNode, verbose: bool): + +def winsorize(X: Matrix, + verbose: bool): - params_dict = {'X':X, 'verbose':verbose} + params_dict = {'X': X, 'verbose': verbose} return Matrix(X.sds_context, - 'winsorize', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'winsorize', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/xdummy1.py b/src/main/python/systemds/operator/algorithm/builtin/xdummy1.py index b2fcbbf..8615319 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/xdummy1.py +++ b/src/main/python/systemds/operator/algorithm/builtin/xdummy1.py @@ -28,12 +28,10 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def xdummy1(X: OperationNode): + +def xdummy1(X: Matrix): - params_dict = {'X':X} + params_dict = {'X': X} return Matrix(X.sds_context, - 'xdummy1', - named_input_nodes=params_dict) - - - \ No newline at end of file + 'xdummy1', + named_input_nodes=params_dict) diff --git a/src/main/python/systemds/operator/algorithm/builtin/xdummy2.py b/src/main/python/systemds/operator/algorithm/builtin/xdummy2.py index d91b1c9..b99c3f9 100644 --- a/src/main/python/systemds/operator/algorithm/builtin/xdummy2.py +++ b/src/main/python/systemds/operator/algorithm/builtin/xdummy2.py @@ -28,9 +28,10 @@ from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, S from systemds.script_building.dag import OutputType from systemds.utils.consts import VALID_INPUT_TYPES -def xdummy2(X: OperationNode): + +def xdummy2(X: Matrix): - params_dict = {'X':X} + params_dict = {'X': X} vX_0 = Matrix(X.sds_context, '') vX_1 = Matrix(X.sds_context, '') @@ -42,6 +43,3 @@ def xdummy2(X: OperationNode): vX_1._unnamed_input_nodes = [op] return op - - - \ No newline at end of file
