This is an automated email from the ASF dual-hosted git repository.
mboehm7 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 693c81d [MINOR] Added scaleMinMax built-in function, and fix
warnings/javadocs
693c81d is described below
commit 693c81d0e8eee1cf4e97b86bc080d469540eb1bb
Author: Matthias Boehm <[email protected]>
AuthorDate: Sun Mar 27 19:51:40 2022 +0200
[MINOR] Added scaleMinMax built-in function, and fix warnings/javadocs
---
scripts/builtin/scaleMinMax.dml | 42 ++++++++++++++++++++++
.../java/org/apache/sysds/common/Builtins.java | 1 +
.../org/apache/sysds/runtime/data/DenseBlock.java | 1 +
.../instructions/gpu/SpoofCUDAInstruction.java | 2 --
4 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/scripts/builtin/scaleMinMax.dml b/scripts/builtin/scaleMinMax.dml
new file mode 100644
index 0000000..095e0d6
--- /dev/null
+++ b/scripts/builtin/scaleMinMax.dml
@@ -0,0 +1,42 @@
+#-------------------------------------------------------------
+#
+# 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.
+#
+#-------------------------------------------------------------
+
+# This function performs min-max normalization (rescaling to [0,1]).
+#
+# INPUT PARAMETERS:
+#
------------------------------------------------------------------------------
+# NAME TYPE DEFAULT MEANING
+#
------------------------------------------------------------------------------
+# X Matrix[Double] --- Input feature matrix
+#
------------------------------------------------------------------------------
+#
+# OUTPUT:
+#
------------------------------------------------------------------------------
+# NAME TYPE MEANING
+#
------------------------------------------------------------------------------
+# Y Matrix[Double] Scaled output matrix
+#
------------------------------------------------------------------------------
+
+m_scaleMinMax = function(Matrix[Double] X)
+ return (Matrix[Double] Y)
+{
+ Y = (X - colMins(X)) / (colMaxs(X) - colMins(X));
+}
diff --git a/src/main/java/org/apache/sysds/common/Builtins.java
b/src/main/java/org/apache/sysds/common/Builtins.java
index 8eec1e5..d9951df 100644
--- a/src/main/java/org/apache/sysds/common/Builtins.java
+++ b/src/main/java/org/apache/sysds/common/Builtins.java
@@ -327,6 +327,7 @@ public enum Builtins {
RMEMPTY("removeEmpty", false, true),
SCALE("scale", true, false),
SCALEAPPLY("scaleApply", true, false),
+ SCALE_MINMAX("scaleMinMax", true, false),
TIME("time", false),
TOKENIZE("tokenize", false, true),
TOSTRING("toString", false, true),
diff --git a/src/main/java/org/apache/sysds/runtime/data/DenseBlock.java
b/src/main/java/org/apache/sysds/runtime/data/DenseBlock.java
index 4e836e0..49d1350 100644
--- a/src/main/java/org/apache/sysds/runtime/data/DenseBlock.java
+++ b/src/main/java/org/apache/sysds/runtime/data/DenseBlock.java
@@ -227,6 +227,7 @@ public abstract class DenseBlock implements Serializable
/**
* Indicates if the dense block is a specific numeric value type.
+ * @param vt value type to check
* @return true if numeric and of value type vt
*/
public abstract boolean isNumeric(ValueType vt);
diff --git
a/src/main/java/org/apache/sysds/runtime/instructions/gpu/SpoofCUDAInstruction.java
b/src/main/java/org/apache/sysds/runtime/instructions/gpu/SpoofCUDAInstruction.java
index b54d6fe..cd1f272 100644
---
a/src/main/java/org/apache/sysds/runtime/instructions/gpu/SpoofCUDAInstruction.java
+++
b/src/main/java/org/apache/sysds/runtime/instructions/gpu/SpoofCUDAInstruction.java
@@ -39,8 +39,6 @@ import org.apache.sysds.runtime.lineage.LineageItem;
import org.apache.sysds.runtime.lineage.LineageItemUtils;
import org.apache.sysds.utils.GPUStatistics;
-import jcuda.Sizeof;
-
public class SpoofCUDAInstruction extends GPUInstruction {
private static final Log LOG =
LogFactory.getLog(SpoofCUDAInstruction.class.getName());