This is an automated email from the ASF dual-hosted git repository.
baunsgaard pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/systemds.git
The following commit(s) were added to refs/heads/main by this push:
new eb7c65c5d8 [MINOR] Add autogenerated Python builtins
eb7c65c5d8 is described below
commit eb7c65c5d807ad695d74cc0f189e0bcfc5fe188f
Author: Sebastian Baunsgaard <[email protected]>
AuthorDate: Fri Mar 14 11:35:35 2025 +0100
[MINOR] Add autogenerated Python builtins
This commit adds the sliceLineExtract and sqrtMatrix builtins to the python
api.
---
.../python/systemds/operator/algorithm/__init__.py | 4 ++
.../operator/algorithm/builtin/sliceLineDebug.py | 2 +-
.../{sliceLineDebug.py => sliceLineExtract.py} | 43 ++++++++++++++--------
.../builtin/{sliceLineDebug.py => sqrtMatrix.py} | 27 ++++++--------
4 files changed, 43 insertions(+), 33 deletions(-)
diff --git a/src/main/python/systemds/operator/algorithm/__init__.py
b/src/main/python/systemds/operator/algorithm/__init__.py
index 95eb5dd207..325dbbd824 100644
--- a/src/main/python/systemds/operator/algorithm/__init__.py
+++ b/src/main/python/systemds/operator/algorithm/__init__.py
@@ -170,6 +170,7 @@ from .builtin.sigmoid import sigmoid
from .builtin.skewness import skewness
from .builtin.sliceLine import sliceLine
from .builtin.sliceLineDebug import sliceLineDebug
+from .builtin.sliceLineExtract import sliceLineExtract
from .builtin.slicefinder import slicefinder
from .builtin.smape import smape
from .builtin.smote import smote
@@ -177,6 +178,7 @@ from .builtin.softmax import softmax
from .builtin.solve import solve
from .builtin.split import split
from .builtin.splitBalanced import splitBalanced
+from .builtin.sqrtMatrix import sqrtMatrix
from .builtin.stableMarriage import stableMarriage
from .builtin.statsNA import statsNA
from .builtin.steplm import steplm
@@ -346,6 +348,7 @@ __all__ = ['WoE',
'skewness',
'sliceLine',
'sliceLineDebug',
+ 'sliceLineExtract',
'slicefinder',
'smape',
'smote',
@@ -353,6 +356,7 @@ __all__ = ['WoE',
'solve',
'split',
'splitBalanced',
+ 'sqrtMatrix',
'stableMarriage',
'statsNA',
'steplm',
diff --git
a/src/main/python/systemds/operator/algorithm/builtin/sliceLineDebug.py
b/src/main/python/systemds/operator/algorithm/builtin/sliceLineDebug.py
index b1b686fcdc..252bc269e6 100644
--- a/src/main/python/systemds/operator/algorithm/builtin/sliceLineDebug.py
+++ b/src/main/python/systemds/operator/algorithm/builtin/sliceLineDebug.py
@@ -40,7 +40,7 @@ def sliceLineDebug(TK: Matrix,
:param TK: top-k slices (k x ncol(X) if successful)
- :param TKC: score, size, error of slices (k x 3)
+ :param TKC: score, total/max error, size of slices (k x 4)
:param tfmeta: transformencode meta data
:param tfspec: transform specification
:return: debug output collected as a string
diff --git
a/src/main/python/systemds/operator/algorithm/builtin/sliceLineDebug.py
b/src/main/python/systemds/operator/algorithm/builtin/sliceLineExtract.py
similarity index 53%
copy from src/main/python/systemds/operator/algorithm/builtin/sliceLineDebug.py
copy to src/main/python/systemds/operator/algorithm/builtin/sliceLineExtract.py
index b1b686fcdc..df8f238833 100644
--- a/src/main/python/systemds/operator/algorithm/builtin/sliceLineDebug.py
+++ b/src/main/python/systemds/operator/algorithm/builtin/sliceLineExtract.py
@@ -20,7 +20,7 @@
# -------------------------------------------------------------
# Autogenerated By : src/main/python/generator/generator.py
-# Autogenerated From : scripts/builtin/sliceLineDebug.dml
+# Autogenerated From : scripts/builtin/sliceLineExtract.dml
from typing import Dict, Iterable
@@ -28,25 +28,36 @@ from systemds.operator import OperationNode, Matrix, Frame,
List, MultiReturn, S
from systemds.utils.consts import VALID_INPUT_TYPES
-def sliceLineDebug(TK: Matrix,
- TKC: Matrix,
- tfmeta: Frame,
- tfspec: str):
+def sliceLineExtract(X: Matrix,
+ e: Matrix,
+ TK: Matrix,
+ TKC: Matrix,
+ **kwargs: Dict[str, VALID_INPUT_TYPES]):
"""
- This builtin function takes the outputs of SliceLine and the
- original transformencode meta data in order to print a human-
- readable debug output of the resulting top-k slices.
+ This builtin function takes the outputs of SliceLine and allows
+
+ :param X: Feature matrix in recoded/binned representation
+ :param e: Error vector of trained model
:param TK: top-k slices (k x ncol(X) if successful)
- :param TKC: score, size, error of slices (k x 3)
- :param tfmeta: transformencode meta data
- :param tfspec: transform specification
- :return: debug output collected as a string
+ :param TKC: score, total/max error, size of slices (k x 4)
+ :param k2: fist k2 slices to extract with k2 <= k
+ :return: Selected rows from X which belong to k2 top slices
+ :return: Selected rows from e which belong to k2 top slices
"""
- params_dict = {'TK': TK, 'TKC': TKC, 'tfmeta': tfmeta, 'tfspec': tfspec}
- return Matrix(TK.sds_context,
- 'sliceLineDebug',
- named_input_nodes=params_dict)
+ params_dict = {'X': X, 'e': e, 'TK': TK, 'TKC': TKC}
+ params_dict.update(kwargs)
+
+ vX_0 = Matrix(X.sds_context, '')
+ vX_1 = Matrix(X.sds_context, '')
+ output_nodes = [vX_0, vX_1, ]
+
+ op = MultiReturn(X.sds_context, 'sliceLineExtract', output_nodes,
named_input_nodes=params_dict)
+
+ vX_0._unnamed_input_nodes = [op]
+ vX_1._unnamed_input_nodes = [op]
+
+ return op
diff --git
a/src/main/python/systemds/operator/algorithm/builtin/sliceLineDebug.py
b/src/main/python/systemds/operator/algorithm/builtin/sqrtMatrix.py
similarity index 61%
copy from src/main/python/systemds/operator/algorithm/builtin/sliceLineDebug.py
copy to src/main/python/systemds/operator/algorithm/builtin/sqrtMatrix.py
index b1b686fcdc..3a5f307a42 100644
--- a/src/main/python/systemds/operator/algorithm/builtin/sliceLineDebug.py
+++ b/src/main/python/systemds/operator/algorithm/builtin/sqrtMatrix.py
@@ -20,7 +20,7 @@
# -------------------------------------------------------------
# Autogenerated By : src/main/python/generator/generator.py
-# Autogenerated From : scripts/builtin/sliceLineDebug.dml
+# Autogenerated From : scripts/builtin/sqrtMatrix.dml
from typing import Dict, Iterable
@@ -28,25 +28,20 @@ from systemds.operator import OperationNode, Matrix, Frame,
List, MultiReturn, S
from systemds.utils.consts import VALID_INPUT_TYPES
-def sliceLineDebug(TK: Matrix,
- TKC: Matrix,
- tfmeta: Frame,
- tfspec: str):
+def sqrtMatrix(A: Matrix,
+ S: str):
"""
- This builtin function takes the outputs of SliceLine and the
- original transformencode meta data in order to print a human-
- readable debug output of the resulting top-k slices.
+ Computes the matrix square root B of a matrix A, such that
+ A = B %*% B.
- :param TK: top-k slices (k x ncol(X) if successful)
- :param TKC: score, size, error of slices (k x 3)
- :param tfmeta: transformencode meta data
- :param tfspec: transform specification
- :return: debug output collected as a string
+ :param A: Input Matrix A
+ :param S: Strategy (COMMON .. java-based commons-math, DML)
+ :return: Output Matrix B
"""
- params_dict = {'TK': TK, 'TKC': TKC, 'tfmeta': tfmeta, 'tfspec': tfspec}
- return Matrix(TK.sds_context,
- 'sliceLineDebug',
+ params_dict = {'A': A, 'S': S}
+ return Matrix(A.sds_context,
+ 'sqrtMatrix',
named_input_nodes=params_dict)