Skip to content

Commit d60724e

Browse files
committed
found new consolidations
1 parent a4b4ac5 commit d60724e

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

scripts/builtin/winsorize.dml

+6-6
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@
3535
# -----------------------------------------------------------------------------------
3636

3737
m_winsorize = function(Matrix[Double] X, Double ql = 0.05, Double qu = 0.95, Boolean verbose)
38-
return (Matrix[Double] Y, Matrix[Double] qLower, Matrix[Double] qUpper) {
39-
qLower = matrix(0, rows=1, cols=ncol(X))
40-
qUpper = matrix(0, rows=1, cols=ncol(X))
38+
return (Matrix[Double] Y, Matrix[Double] QL, Matrix[Double] QU) {
39+
QL = matrix(0, rows=1, cols=ncol(X))
40+
QU = matrix(0, rows=1, cols=ncol(X))
4141
Xtemp = replace(target=X, pattern=NaN, replacement=0)
4242
parfor(i in 1:ncol(X), check=0) {
43-
qLower[1,i] = quantile(Xtemp[,i], ql)
44-
qUpper[1,i] = quantile(Xtemp[,i], qu)
43+
QL[1,i] = quantile(Xtemp[,i], ql)
44+
QU[1,i] = quantile(Xtemp[,i], qu)
4545
}
46-
Y = winsorizeApply(X, qLower, qUpper)
46+
Y = winsorizeApply(X, QL, QU)
4747
}
4848

scripts/builtin/winsorizeApply.dml

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
# INPUT:
2626
# --------------------------------------------------
2727
# X Input feature matrix
28-
# ql row vector of upper bounds per column
29-
# qu row vector of lower bounds per column
28+
# QL row vector of upper bounds per column
29+
# QU row vector of lower bounds per column
3030
# --------------------------------------------------
3131
#
3232
# OUTPUT:
@@ -35,9 +35,9 @@
3535
# ------------------------------------------------
3636

3737

38-
m_winsorizeApply = function(Matrix[Double] X, Matrix[Double] ql, Matrix[Double] qu)
38+
m_winsorizeApply = function(Matrix[Double] X, Matrix[Double] QL, Matrix[Double] QU)
3939
return (Matrix[Double] Y)
4040
{
4141
# replace values outside [ql,qu] w/ ql and qu respectively
42-
Y = min(max(X, ql), qu);
42+
Y = min(max(X, QL), QU);
4343
}

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,21 @@
2929

3030

3131
def winsorizeApply(X: Matrix,
32-
ql: Matrix,
33-
qu: Matrix):
32+
QL: Matrix,
33+
QU: Matrix):
3434
"""
3535
winsorizeApply takes the upper and lower quantile values per column, and
3636
remove outliers by replacing them with these upper and lower bound values.
3737
3838
3939
4040
:param X: Input feature matrix
41-
:param ql: row vector of upper bounds per column
42-
:param qu: row vector of lower bounds per column
41+
:param QL: row vector of upper bounds per column
42+
:param QU: row vector of lower bounds per column
4343
:return: Matrix without outlier values
4444
"""
4545

46-
params_dict = {'X': X, 'ql': ql, 'qu': qu}
46+
params_dict = {'X': X, 'QL': QL, 'QU': QU}
4747
return Matrix(X.sds_context,
4848
'winsorizeApply',
4949
named_input_nodes=params_dict)

0 commit comments

Comments
 (0)