Skip to content

Commit eb7c65c

Browse files
committed
[MINOR] Add autogenerated Python builtins
This commit adds the sliceLineExtract and sqrtMatrix builtins to the python api.
1 parent cfbe190 commit eb7c65c

File tree

4 files changed

+115
-1
lines changed

4 files changed

+115
-1
lines changed

src/main/python/systemds/operator/algorithm/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,15 @@
170170
from .builtin.skewness import skewness
171171
from .builtin.sliceLine import sliceLine
172172
from .builtin.sliceLineDebug import sliceLineDebug
173+
from .builtin.sliceLineExtract import sliceLineExtract
173174
from .builtin.slicefinder import slicefinder
174175
from .builtin.smape import smape
175176
from .builtin.smote import smote
176177
from .builtin.softmax import softmax
177178
from .builtin.solve import solve
178179
from .builtin.split import split
179180
from .builtin.splitBalanced import splitBalanced
181+
from .builtin.sqrtMatrix import sqrtMatrix
180182
from .builtin.stableMarriage import stableMarriage
181183
from .builtin.statsNA import statsNA
182184
from .builtin.steplm import steplm
@@ -346,13 +348,15 @@
346348
'skewness',
347349
'sliceLine',
348350
'sliceLineDebug',
351+
'sliceLineExtract',
349352
'slicefinder',
350353
'smape',
351354
'smote',
352355
'softmax',
353356
'solve',
354357
'split',
355358
'splitBalanced',
359+
'sqrtMatrix',
356360
'stableMarriage',
357361
'statsNA',
358362
'steplm',

src/main/python/systemds/operator/algorithm/builtin/sliceLineDebug.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def sliceLineDebug(TK: Matrix,
4040
4141
4242
:param TK: top-k slices (k x ncol(X) if successful)
43-
:param TKC: score, size, error of slices (k x 3)
43+
:param TKC: score, total/max error, size of slices (k x 4)
4444
:param tfmeta: transformencode meta data
4545
:param tfspec: transform specification
4646
:return: debug output collected as a string
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# -------------------------------------------------------------
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
# -------------------------------------------------------------
21+
22+
# Autogenerated By : src/main/python/generator/generator.py
23+
# Autogenerated From : scripts/builtin/sliceLineExtract.dml
24+
25+
from typing import Dict, Iterable
26+
27+
from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar
28+
from systemds.utils.consts import VALID_INPUT_TYPES
29+
30+
31+
def sliceLineExtract(X: Matrix,
32+
e: Matrix,
33+
TK: Matrix,
34+
TKC: Matrix,
35+
**kwargs: Dict[str, VALID_INPUT_TYPES]):
36+
"""
37+
This builtin function takes the outputs of SliceLine and allows
38+
39+
40+
41+
42+
:param X: Feature matrix in recoded/binned representation
43+
:param e: Error vector of trained model
44+
:param TK: top-k slices (k x ncol(X) if successful)
45+
:param TKC: score, total/max error, size of slices (k x 4)
46+
:param k2: fist k2 slices to extract with k2 <= k
47+
:return: Selected rows from X which belong to k2 top slices
48+
:return: Selected rows from e which belong to k2 top slices
49+
"""
50+
51+
params_dict = {'X': X, 'e': e, 'TK': TK, 'TKC': TKC}
52+
params_dict.update(kwargs)
53+
54+
vX_0 = Matrix(X.sds_context, '')
55+
vX_1 = Matrix(X.sds_context, '')
56+
output_nodes = [vX_0, vX_1, ]
57+
58+
op = MultiReturn(X.sds_context, 'sliceLineExtract', output_nodes, named_input_nodes=params_dict)
59+
60+
vX_0._unnamed_input_nodes = [op]
61+
vX_1._unnamed_input_nodes = [op]
62+
63+
return op
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# -------------------------------------------------------------
2+
#
3+
# Licensed to the Apache Software Foundation (ASF) under one
4+
# or more contributor license agreements. See the NOTICE file
5+
# distributed with this work for additional information
6+
# regarding copyright ownership. The ASF licenses this file
7+
# to you under the Apache License, Version 2.0 (the
8+
# "License"); you may not use this file except in compliance
9+
# with the License. You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing,
14+
# software distributed under the License is distributed on an
15+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16+
# KIND, either express or implied. See the License for the
17+
# specific language governing permissions and limitations
18+
# under the License.
19+
#
20+
# -------------------------------------------------------------
21+
22+
# Autogenerated By : src/main/python/generator/generator.py
23+
# Autogenerated From : scripts/builtin/sqrtMatrix.dml
24+
25+
from typing import Dict, Iterable
26+
27+
from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar
28+
from systemds.utils.consts import VALID_INPUT_TYPES
29+
30+
31+
def sqrtMatrix(A: Matrix,
32+
S: str):
33+
"""
34+
Computes the matrix square root B of a matrix A, such that
35+
A = B %*% B.
36+
37+
38+
39+
:param A: Input Matrix A
40+
:param S: Strategy (COMMON .. java-based commons-math, DML)
41+
:return: Output Matrix B
42+
"""
43+
44+
params_dict = {'A': A, 'S': S}
45+
return Matrix(A.sds_context,
46+
'sqrtMatrix',
47+
named_input_nodes=params_dict)

0 commit comments

Comments
 (0)