Skip to content

Commit b4bc2ab

Browse files
committed
[MINOR] Update Python generated builtins
1 parent 0aa69fd commit b4bc2ab

12 files changed

Lines changed: 596 additions & 0 deletions

File tree

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
from .builtin.fit_pipeline import fit_pipeline
6262
from .builtin.fixInvalidLengths import fixInvalidLengths
6363
from .builtin.fixInvalidLengthsApply import fixInvalidLengthsApply
64+
from .builtin.flattenQuantile import flattenQuantile
6465
from .builtin.frameSort import frameSort
6566
from .builtin.frequencyEncode import frequencyEncode
6667
from .builtin.frequencyEncodeApply import frequencyEncodeApply
@@ -113,11 +114,15 @@
113114
from .builtin.lmPredict import lmPredict
114115
from .builtin.lmPredictStats import lmPredictStats
115116
from .builtin.logSumExp import logSumExp
117+
from .builtin.mae import mae
118+
from .builtin.mape import mape
116119
from .builtin.matrixProfile import matrixProfile
117120
from .builtin.mcc import mcc
118121
from .builtin.mdedup import mdedup
119122
from .builtin.mice import mice
120123
from .builtin.miceApply import miceApply
124+
from .builtin.mse import mse
125+
from .builtin.msmape import msmape
121126
from .builtin.msvm import msvm
122127
from .builtin.msvmPredict import msvmPredict
123128
from .builtin.multiLogReg import multiLogReg
@@ -127,6 +132,7 @@
127132
from .builtin.naiveBayesPredict import naiveBayesPredict
128133
from .builtin.normalize import normalize
129134
from .builtin.normalizeApply import normalizeApply
135+
from .builtin.nrmse import nrmse
130136
from .builtin.outlier import outlier
131137
from .builtin.outlierByArima import outlierByArima
132138
from .builtin.outlierByIQR import outlierByIQR
@@ -138,8 +144,10 @@
138144
from .builtin.pcaTransform import pcaTransform
139145
from .builtin.pnmf import pnmf
140146
from .builtin.ppca import ppca
147+
from .builtin.psnr import psnr
141148
from .builtin.randomForest import randomForest
142149
from .builtin.randomForestPredict import randomForestPredict
150+
from .builtin.rmse import rmse
143151
from .builtin.scale import scale
144152
from .builtin.scaleApply import scaleApply
145153
from .builtin.scaleMinMax import scaleMinMax
@@ -149,7 +157,9 @@
149157
from .builtin.sherlockPredict import sherlockPredict
150158
from .builtin.shortestPath import shortestPath
151159
from .builtin.sigmoid import sigmoid
160+
from .builtin.skewness import skewness
152161
from .builtin.slicefinder import slicefinder
162+
from .builtin.smape import smape
153163
from .builtin.smote import smote
154164
from .builtin.softmax import softmax
155165
from .builtin.split import split
@@ -215,6 +225,7 @@
215225
'fit_pipeline',
216226
'fixInvalidLengths',
217227
'fixInvalidLengthsApply',
228+
'flattenQuantile',
218229
'frameSort',
219230
'frequencyEncode',
220231
'frequencyEncodeApply',
@@ -267,11 +278,15 @@
267278
'lmPredict',
268279
'lmPredictStats',
269280
'logSumExp',
281+
'mae',
282+
'mape',
270283
'matrixProfile',
271284
'mcc',
272285
'mdedup',
273286
'mice',
274287
'miceApply',
288+
'mse',
289+
'msmape',
275290
'msvm',
276291
'msvmPredict',
277292
'multiLogReg',
@@ -281,6 +296,7 @@
281296
'naiveBayesPredict',
282297
'normalize',
283298
'normalizeApply',
299+
'nrmse',
284300
'outlier',
285301
'outlierByArima',
286302
'outlierByIQR',
@@ -292,8 +308,10 @@
292308
'pcaTransform',
293309
'pnmf',
294310
'ppca',
311+
'psnr',
295312
'randomForest',
296313
'randomForestPredict',
314+
'rmse',
297315
'scale',
298316
'scaleApply',
299317
'scaleMinMax',
@@ -303,7 +321,9 @@
303321
'sherlockPredict',
304322
'shortestPath',
305323
'sigmoid',
324+
'skewness',
306325
'slicefinder',
326+
'smape',
307327
'smote',
308328
'softmax',
309329
'split',

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ def decisionTree(X: Matrix,
7070
candidates at tree nodes: m = ceil(num_features^max_features)
7171
:param max_values: Parameter controlling the number of values per feature used
7272
as split candidates: nb = ceil(num_values^max_values)
73+
:param max_dataratio: Parameter in [0,1] controlling when to materialize data
74+
subsets of X and y on node splits. When set to 0, we always
75+
scan the original X and y, which has the benefit of avoiding
76+
the allocation and maintenance of data for all active nodes.
77+
When set to 0.01 we rematerialize whenever the sub-tree data
78+
would be less than 1% of last the parent materialize data size.
7379
:param impurity: Impurity measure: entropy, gini (default), rss (regression)
7480
:param seed: Fixed seed for randomization of samples and split candidates
7581
:param verbose: Flag indicating verbose debug output
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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/flattenQuantile.dml
24+
25+
from typing import Dict, Iterable
26+
27+
from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar
28+
from systemds.script_building.dag import OutputType
29+
from systemds.utils.consts import VALID_INPUT_TYPES
30+
31+
32+
def flattenQuantile(X: Matrix,
33+
P: Matrix):
34+
"""
35+
Returns the quantiles requested, but treating the input matrix X as a flattened matrix
36+
to return quantiles of all cells as if it was a continuous allocation.
37+
38+
39+
40+
:param X: Matrix with values to extract quantiles from.
41+
:param P: Quantiles to extract as well if empty matrix not calculated
42+
:return: Quantiles calculated
43+
"""
44+
45+
params_dict = {'X': X, 'P': P}
46+
return Matrix(X.sds_context,
47+
'flattenQuantile',
48+
named_input_nodes=params_dict)
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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/mae.dml
24+
25+
from typing import Dict, Iterable
26+
27+
from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar
28+
from systemds.script_building.dag import OutputType
29+
from systemds.utils.consts import VALID_INPUT_TYPES
30+
31+
32+
def mae(X: Matrix,
33+
Y: Matrix,
34+
**kwargs: Dict[str, VALID_INPUT_TYPES]):
35+
"""
36+
Returns the means absolute error between the two inputs
37+
38+
39+
40+
:param X: First Matrix to compare
41+
:param Y: Second Matrix to compare
42+
:param P: Quantiles to extract as well if empty matrix not calculated
43+
:return: Mean absolute error
44+
:return: Quantiles calculated
45+
"""
46+
47+
params_dict = {'X': X, 'Y': Y}
48+
params_dict.update(kwargs)
49+
50+
vX_0 = Matrix(X.sds_context, '')
51+
vX_1 = Matrix(X.sds_context, '')
52+
output_nodes = [vX_0, vX_1, ]
53+
54+
op = MultiReturn(X.sds_context, 'mae', output_nodes, named_input_nodes=params_dict)
55+
56+
vX_0._unnamed_input_nodes = [op]
57+
vX_1._unnamed_input_nodes = [op]
58+
59+
return op
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
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/mape.dml
24+
25+
from typing import Dict, Iterable
26+
27+
from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar
28+
from systemds.script_building.dag import OutputType
29+
from systemds.utils.consts import VALID_INPUT_TYPES
30+
31+
32+
def mape(X: Matrix,
33+
Y: Matrix,
34+
**kwargs: Dict[str, VALID_INPUT_TYPES]):
35+
"""
36+
Returns the means absolute percentage error between the two inputs
37+
38+
39+
Monash Time Series Forecasting Archive
40+
Rakshitha Godahewaa,∗, Christoph Bergmeira , Geoffrey I. Webba , Rob J. Hyndmanb ,
41+
Pablo Montero-Mansoc
42+
43+
44+
45+
46+
:param X: First Matrix to compare
47+
:param Y: Second Matrix to compare
48+
:param P: Quantiles to extract as well if empty matrix not calculated
49+
:return: Mean absolute percentage error
50+
:return: Quantiles calculated
51+
"""
52+
53+
params_dict = {'X': X, 'Y': Y}
54+
params_dict.update(kwargs)
55+
56+
vX_0 = Matrix(X.sds_context, '')
57+
vX_1 = Matrix(X.sds_context, '')
58+
output_nodes = [vX_0, vX_1, ]
59+
60+
op = MultiReturn(X.sds_context, 'mape', output_nodes, named_input_nodes=params_dict)
61+
62+
vX_0._unnamed_input_nodes = [op]
63+
vX_1._unnamed_input_nodes = [op]
64+
65+
return op
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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/mse.dml
24+
25+
from typing import Dict, Iterable
26+
27+
from systemds.operator import OperationNode, Matrix, Frame, List, MultiReturn, Scalar
28+
from systemds.script_building.dag import OutputType
29+
from systemds.utils.consts import VALID_INPUT_TYPES
30+
31+
32+
def mse(X: Matrix,
33+
Y: Matrix,
34+
**kwargs: Dict[str, VALID_INPUT_TYPES]):
35+
"""
36+
Returns the means square error between the two inputs
37+
38+
39+
40+
:param X: First Matrix to compare
41+
:param Y: Second Matrix to compare
42+
:param P: Quantiles to extract as well if empty matrix not calculated
43+
:return: Mean Square error
44+
:return: Quantiles calculated
45+
"""
46+
47+
params_dict = {'X': X, 'Y': Y}
48+
params_dict.update(kwargs)
49+
50+
vX_0 = Matrix(X.sds_context, '')
51+
vX_1 = Matrix(X.sds_context, '')
52+
output_nodes = [vX_0, vX_1, ]
53+
54+
op = MultiReturn(X.sds_context, 'mse', output_nodes, named_input_nodes=params_dict)
55+
56+
vX_0._unnamed_input_nodes = [op]
57+
vX_1._unnamed_input_nodes = [op]
58+
59+
return op

0 commit comments

Comments
 (0)