Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MINOR] Python autogenerate new Builtins
- Loading branch information
1 parent
c8a8506
commit 2d4114e
Showing
10 changed files
with
303 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
src/main/python/systemds/operator/algorithm/builtin/auc.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# ------------------------------------------------------------- | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
# ------------------------------------------------------------- | ||
|
||
# Autogenerated By : src/main/python/generator/generator.py | ||
# Autogenerated From : scripts/builtin/auc.dml | ||
|
||
from typing import Dict, Iterable | ||
|
||
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 auc(Y: Matrix, | ||
P: Matrix): | ||
""" | ||
This builting function computes the area under the ROC curve (AUC) | ||
for binary classifiers. | ||
:param Y: Binary response vector (shape: n x 1), in -1/+1 or 0/1 encoding | ||
:param P: Prediction scores (predictor such as estimated probabilities) | ||
for true class (shape: n x 1), assumed in [0,1] | ||
:return: Area under the ROC curve (AUC) | ||
""" | ||
|
||
params_dict = {'Y': Y, 'P': P} | ||
return Matrix(Y.sds_context, | ||
'auc', | ||
named_input_nodes=params_dict) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/main/python/systemds/operator/algorithm/builtin/lmPredictStats.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# ------------------------------------------------------------- | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
# ------------------------------------------------------------- | ||
|
||
# Autogenerated By : src/main/python/generator/generator.py | ||
# Autogenerated From : scripts/builtin/lmPredictStats.dml | ||
|
||
from typing import Dict, Iterable | ||
|
||
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 lmPredictStats(yhat: Matrix, | ||
ytest: Matrix, | ||
lm: bool): | ||
""" | ||
This builtin function computes and prints a summary of accuracy | ||
measures for regression problems. | ||
:param yhat: column vector of predicted response values y | ||
:param ytest: column vector of actual response values y | ||
:param lm: indicator if used for linear regression model | ||
:return: column vector holding avg_res, ss_avg_res, and R2 | ||
""" | ||
|
||
params_dict = {'yhat': yhat, 'ytest': ytest, 'lm': lm} | ||
return Matrix(yhat.sds_context, | ||
'lmPredictStats', | ||
named_input_nodes=params_dict) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.