当前位置: 首页>>代码示例>>Java>>正文


Java RDD.toLocalIterator方法代码示例

本文整理汇总了Java中org.apache.spark.rdd.RDD.toLocalIterator方法的典型用法代码示例。如果您正苦于以下问题:Java RDD.toLocalIterator方法的具体用法?Java RDD.toLocalIterator怎么用?Java RDD.toLocalIterator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.spark.rdd.RDD的用法示例。


在下文中一共展示了RDD.toLocalIterator方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testOutputRDDStringIJVDML

import org.apache.spark.rdd.RDD; //导入方法依赖的package包/类
@Test
public void testOutputRDDStringIJVDML() {
	System.out.println("MLContextTest - output RDD String IJV DML");

	String s = "M = matrix('1 2 3 4', rows=2, cols=2);";
	Script script = dml(s).out("M");
	MLResults results = ml.execute(script);
	RDD<String> rddStringIJV = results.getRDDStringIJV("M");
	Iterator<String> iterator = rddStringIJV.toLocalIterator();
	Assert.assertEquals("1 1 1.0", iterator.next());
	Assert.assertEquals("1 2 2.0", iterator.next());
	Assert.assertEquals("2 1 3.0", iterator.next());
	Assert.assertEquals("2 2 4.0", iterator.next());
}
 
开发者ID:apache,项目名称:systemml,代码行数:15,代码来源:MLContextTest.java

示例2: testOutputRDDStringIJVPYDML

import org.apache.spark.rdd.RDD; //导入方法依赖的package包/类
@Test
public void testOutputRDDStringIJVPYDML() {
	System.out.println("MLContextTest - output RDD String IJV PYDML");

	String s = "M = full('1 2 3 4', rows=2, cols=2)";
	Script script = pydml(s).out("M");
	MLResults results = ml.execute(script);
	RDD<String> rddStringIJV = results.getRDDStringIJV("M");
	Iterator<String> iterator = rddStringIJV.toLocalIterator();
	Assert.assertEquals("1 1 1.0", iterator.next());
	Assert.assertEquals("1 2 2.0", iterator.next());
	Assert.assertEquals("2 1 3.0", iterator.next());
	Assert.assertEquals("2 2 4.0", iterator.next());
}
 
开发者ID:apache,项目名称:systemml,代码行数:15,代码来源:MLContextTest.java

示例3: testOutputRDDStringCSVDenseDML

import org.apache.spark.rdd.RDD; //导入方法依赖的package包/类
@Test
public void testOutputRDDStringCSVDenseDML() {
	System.out.println("MLContextTest - output RDD String CSV Dense DML");

	String s = "M = matrix('1 2 3 4', rows=2, cols=2); print(toString(M));";
	Script script = dml(s).out("M");
	MLResults results = ml.execute(script);
	RDD<String> rddStringCSV = results.getRDDStringCSV("M");
	Iterator<String> iterator = rddStringCSV.toLocalIterator();
	Assert.assertEquals("1.0,2.0", iterator.next());
	Assert.assertEquals("3.0,4.0", iterator.next());
}
 
开发者ID:apache,项目名称:systemml,代码行数:13,代码来源:MLContextTest.java

示例4: testOutputRDDStringCSVDensePYDML

import org.apache.spark.rdd.RDD; //导入方法依赖的package包/类
@Test
public void testOutputRDDStringCSVDensePYDML() {
	System.out.println("MLContextTest - output RDD String CSV Dense PYDML");

	String s = "M = full('1 2 3 4', rows=2, cols=2)\nprint(toString(M))";
	Script script = pydml(s).out("M");
	MLResults results = ml.execute(script);
	RDD<String> rddStringCSV = results.getRDDStringCSV("M");
	Iterator<String> iterator = rddStringCSV.toLocalIterator();
	Assert.assertEquals("1.0,2.0", iterator.next());
	Assert.assertEquals("3.0,4.0", iterator.next());
}
 
开发者ID:apache,项目名称:systemml,代码行数:13,代码来源:MLContextTest.java

示例5: testOutputRDDStringCSVSparseDML

import org.apache.spark.rdd.RDD; //导入方法依赖的package包/类
@Test
public void testOutputRDDStringCSVSparseDML() {
	System.out.println("MLContextTest - output RDD String CSV Sparse DML");

	String s = "M = matrix(0, rows=10, cols=10); M[1,1]=1; M[1,2]=2; M[2,1]=3; M[2,2]=4; print(toString(M));";
	Script script = dml(s).out("M");
	MLResults results = ml.execute(script);
	RDD<String> rddStringCSV = results.getRDDStringCSV("M");
	Iterator<String> iterator = rddStringCSV.toLocalIterator();
	Assert.assertEquals("1.0,2.0", iterator.next());
	Assert.assertEquals("3.0,4.0", iterator.next());
}
 
开发者ID:apache,项目名称:systemml,代码行数:13,代码来源:MLContextTest.java

示例6: testOutputRDDStringCSVSparsePYDML

import org.apache.spark.rdd.RDD; //导入方法依赖的package包/类
@Test
public void testOutputRDDStringCSVSparsePYDML() {
	System.out.println("MLContextTest - output RDD String CSV Sparse PYDML");

	String s = "M = full(0, rows=10, cols=10)\nM[0,0]=1\nM[0,1]=2\nM[1,0]=3\nM[1,1]=4\nprint(toString(M))";
	Script script = pydml(s).out("M");
	MLResults results = ml.execute(script);
	RDD<String> rddStringCSV = results.getRDDStringCSV("M");
	Iterator<String> iterator = rddStringCSV.toLocalIterator();
	Assert.assertEquals("1.0,2.0", iterator.next());
	Assert.assertEquals("3.0,4.0", iterator.next());
}
 
开发者ID:apache,项目名称:systemml,代码行数:13,代码来源:MLContextTest.java

示例7: testOutputMatrixObjectDML

import org.apache.spark.rdd.RDD; //导入方法依赖的package包/类
@Test
public void testOutputMatrixObjectDML() {
	System.out.println("MLContextTest - output matrix object DML");
	String s = "M = matrix('1 2 3 4', rows=2, cols=2);";
	MatrixObject mo = ml.execute(dml(s).out("M")).getMatrixObject("M");
	RDD<String> rddStringCSV = MLContextConversionUtil.matrixObjectToRDDStringCSV(mo);
	Iterator<String> iterator = rddStringCSV.toLocalIterator();
	Assert.assertEquals("1.0,2.0", iterator.next());
	Assert.assertEquals("3.0,4.0", iterator.next());
}
 
开发者ID:apache,项目名称:systemml,代码行数:11,代码来源:MLContextTest.java

示例8: testOutputMatrixObjectPYDML

import org.apache.spark.rdd.RDD; //导入方法依赖的package包/类
@Test
public void testOutputMatrixObjectPYDML() {
	System.out.println("MLContextTest - output matrix object PYDML");
	String s = "M = full('1 2 3 4', rows=2, cols=2);";
	MatrixObject mo = ml.execute(pydml(s).out("M")).getMatrixObject("M");
	RDD<String> rddStringCSV = MLContextConversionUtil.matrixObjectToRDDStringCSV(mo);
	Iterator<String> iterator = rddStringCSV.toLocalIterator();
	Assert.assertEquals("1.0,2.0", iterator.next());
	Assert.assertEquals("3.0,4.0", iterator.next());
}
 
开发者ID:apache,项目名称:systemml,代码行数:11,代码来源:MLContextTest.java

示例9: testOutputRDDStringCSVFromMatrixDML

import org.apache.spark.rdd.RDD; //导入方法依赖的package包/类
@Test
public void testOutputRDDStringCSVFromMatrixDML() {
	System.out.println("MLContextTest - output RDD String CSV from matrix DML");

	String s = "M = matrix('1 2 3 4', rows=1, cols=4);";
	Script script = dml(s).out("M");
	RDD<String> rddStringCSV = ml.execute(script).getMatrix("M").toRDDStringCSV();
	Iterator<String> iterator = rddStringCSV.toLocalIterator();
	Assert.assertEquals("1.0,2.0,3.0,4.0", iterator.next());
}
 
开发者ID:apache,项目名称:systemml,代码行数:11,代码来源:MLContextTest.java


注:本文中的org.apache.spark.rdd.RDD.toLocalIterator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。