Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4782,10 +4782,10 @@ public MatrixBlock pickValues(MatrixValue quantiles, MatrixValue ret, boolean av
output=new MatrixBlock(qs.rlen, qs.clen, false); // resulting matrix is mostly likely be dense
else
output.reset(qs.rlen, qs.clen, false);
for ( int i=0; i < qs.rlen; i++ ) {
// FIXME: [SYSTEMDS-3953] consider the average parameter here
output.set(i, 0, this.pickValue(qs.get(i,0)) );

for(int i = 0; i < qs.rlen; i++) {
// FIXME: include the average parameter here to fix SYSTEMDS-3953
output.set(i, 0, this.pickValue(qs.get(i, 0)));
}

return output;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.util.HashMap;

import org.junit.Ignore;
import org.junit.Test;
import org.apache.sysds.common.Types.ExecMode;
import org.apache.sysds.common.Types.ExecType;
Expand All @@ -36,6 +37,7 @@ public class QuantileTest extends AutomatedTestBase
private final static String TEST_NAME3 = "IQM";
private final static String TEST_NAME4 = "QuantileBug";
private final static String TEST_NAME5 = "MedianBug";
private final static String TEST_NAME6 = "QuartileArray";

private final static String TEST_DIR = "functions/binary/matrix/";
private final static String TEST_CLASS_DIR = TEST_DIR + QuantileTest.class.getSimpleName() + "/";
Expand All @@ -51,15 +53,17 @@ public void setUp()
{
TestUtils.clearAssertionInformation();
addTestConfiguration(TEST_NAME1,
new TestConfiguration(TEST_CLASS_DIR, TEST_NAME1, new String[] { "R" }) );
new TestConfiguration(TEST_CLASS_DIR, TEST_NAME1, new String[] {"R"}));
addTestConfiguration(TEST_NAME2,
new TestConfiguration(TEST_CLASS_DIR, TEST_NAME2, new String[] { "R" }) );
new TestConfiguration(TEST_CLASS_DIR, TEST_NAME2, new String[] {"R"}));
addTestConfiguration(TEST_NAME3,
new TestConfiguration(TEST_CLASS_DIR, TEST_NAME3, new String[] { "R" }) );
new TestConfiguration(TEST_CLASS_DIR, TEST_NAME3, new String[] {"R"}));
addTestConfiguration(TEST_NAME4,
new TestConfiguration(TEST_CLASS_DIR, TEST_NAME4, new String[] { "R" }) );
new TestConfiguration(TEST_CLASS_DIR, TEST_NAME4, new String[] {"R"}));
addTestConfiguration(TEST_NAME5,
new TestConfiguration(TEST_CLASS_DIR, TEST_NAME5, new String[] { "R" }) );
new TestConfiguration(TEST_CLASS_DIR, TEST_NAME5, new String[] {"R"}));
addTestConfiguration(TEST_NAME6,
new TestConfiguration(TEST_CLASS_DIR, TEST_NAME6, new String[] {"R"}));
}

@Test
Expand Down Expand Up @@ -182,6 +186,18 @@ public void testMedianBugSP() {
runQuantileTest(TEST_NAME5, -1, false, ExecType.SPARK);
}

@Test
@Ignore // FIXME: fix SYSTEMDS-3953
public void testQuartileArrayCP() {
runQuantileTest(TEST_NAME6, 0, false, ExecType.CP);
}

@Test
@Ignore // FIXME: fix SYSTEMDS-3953
public void testQuartileArraySP() {
runQuantileTest(TEST_NAME6, 0, false, ExecType.SPARK);
}

private void runQuantileTest( String TEST_NAME, double p, boolean sparse, ExecType et)
{
ExecMode platformOld = setExecMode(et);
Expand Down
33 changes: 33 additions & 0 deletions src/test/scripts/functions/binary/matrix/QuartileArray.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#-------------------------------------------------------------
#
# 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.
#
#-------------------------------------------------------------

args <- commandArgs(TRUE)
options(digits=22)

library("Matrix")

A = as.matrix(c(1,5,7,10))

m = quantile(A, c(0.25, 0.5, 0.75));

writeMM(as(m, "CsparseMatrix"), paste(args[3], "R", sep=""));


24 changes: 24 additions & 0 deletions src/test/scripts/functions/binary/matrix/QuartileArray.dml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#-------------------------------------------------------------
#
# 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.
#
#-------------------------------------------------------------

A = as.matrix(list(1,5,7,10));
m = quantile(A, as.matrix(list(0.25, 0.5, 0.75)));
write(m, $3, format="text");
Loading