本文整理了Java中org.apache.mahout.math.Matrix.iterator()
方法的一些代码示例,展示了Matrix.iterator()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.iterator()
方法的具体详情如下:
包路径:org.apache.mahout.math.Matrix
类名称:Matrix
方法名:iterator
暂无
代码示例来源:origin: apache/mahout
@Test
public void testIterate() {
Iterator<MatrixSlice> it = test.iterator();
MatrixSlice m;
while (it.hasNext() && (m = it.next()) != null) {
Vector v = m.vector();
Vector w = test instanceof SparseColumnMatrix ? test.viewColumn(m.index()) : test.viewRow(m.index());
assertEquals("iterator: " + v + ", randomAccess: " + w, v, w);
}
}
代码示例来源:origin: org.apache.mahout/mahout-mrlegacy
@Override
public Iterator<VectorWritable> iterator() {
return Iterators.transform(m.iterator(), new Function<MatrixSlice,VectorWritable>() {
@Override
public VectorWritable apply(MatrixSlice input) {
return new VectorWritable(input.vector());
}
});
}
}, true, new Path(baseTmpDirPath, "distMatrix/part-00000"), fs, conf);
代码示例来源:origin: org.apache.mahout/mahout-mrlegacy
@Override
public boolean remove(Vector vector, double epsilon) {
WeightedThing<Vector> toRemove = searchFirst(vector, false);
if (toRemove.getWeight() < epsilon) {
Iterator<? extends Vector> basisVectors = basisMatrix.iterator();
for (TreeMultiset<WeightedThing<Vector>> projection : scalarProjections) {
if (!projection.remove(new WeightedThing<Vector>(vector, vector.dot(basisVectors.next())))) {
throw new RuntimeException("Internal inconsistency in ProjectionSearch");
}
}
return true;
} else {
return false;
}
}
代码示例来源:origin: org.apache.mahout/mahout-core
@Override
public boolean remove(Vector vector, double epsilon) {
WeightedThing<Vector> toRemove = searchFirst(vector, false);
if (toRemove.getWeight() < epsilon) {
Iterator<? extends Vector> basisVectors = basisMatrix.iterator();
for (TreeMultiset<WeightedThing<Vector>> projection : scalarProjections) {
if (!projection.remove(new WeightedThing<Vector>(vector, vector.dot(basisVectors.next())))) {
throw new RuntimeException("Internal inconsistency in ProjectionSearch");
}
}
return true;
} else {
return false;
}
}
代码示例来源:origin: org.apache.mahout/mahout-mr
@Override
public boolean remove(Vector vector, double epsilon) {
WeightedThing<Vector> toRemove = searchFirst(vector, false);
if (toRemove.getWeight() < epsilon) {
Iterator<? extends Vector> basisVectors = basisMatrix.iterator();
for (TreeMultiset<WeightedThing<Vector>> projection : scalarProjections) {
if (!projection.remove(new WeightedThing<>(vector, vector.dot(basisVectors.next())))) {
throw new RuntimeException("Internal inconsistency in ProjectionSearch");
}
}
return true;
} else {
return false;
}
}
代码示例来源:origin: org.apache.mahout/mahout-core
Set<Vector> candidates = Sets.newHashSet();
Iterator<? extends Vector> projections = basisMatrix.iterator();
for (TreeMultiset<WeightedThing<Vector>> v : scalarProjections) {
Vector basisVector = projections.next();
代码示例来源:origin: org.apache.mahout/mahout-mrlegacy
Set<Vector> candidates = Sets.newHashSet();
Iterator<? extends Vector> projections = basisMatrix.iterator();
for (TreeMultiset<WeightedThing<Vector>> v : scalarProjections) {
Vector basisVector = projections.next();
代码示例来源:origin: org.apache.mahout/mahout-mr
Set<Vector> candidates = Sets.newHashSet();
Iterator<? extends Vector> projections = basisMatrix.iterator();
for (TreeMultiset<WeightedThing<Vector>> v : scalarProjections) {
Vector basisVector = projections.next();
代码示例来源:origin: org.apache.mahout/mahout-mr
Vector bestVector = null;
Iterator<? extends Vector> projections = basisMatrix.iterator();
for (TreeMultiset<WeightedThing<Vector>> v : scalarProjections) {
Vector basisVector = projections.next();
代码示例来源:origin: org.apache.mahout/mahout-core
Vector bestVector = null;
Iterator<? extends Vector> projections = basisMatrix.iterator();
for (TreeMultiset<WeightedThing<Vector>> v : scalarProjections) {
Vector basisVector = projections.next();
代码示例来源:origin: org.apache.mahout/mahout-mrlegacy
Vector bestVector = null;
Iterator<? extends Vector> projections = basisMatrix.iterator();
for (TreeMultiset<WeightedThing<Vector>> v : scalarProjections) {
Vector basisVector = projections.next();
代码示例来源:origin: cloudera/mahout
@Test
public void testIterate() {
Iterator<MatrixSlice> it = test.iterator();
MatrixSlice m;
while(it.hasNext() && (m = it.next()) != null) {
Vector v = m.vector();
Vector w = test instanceof SparseColumnMatrix ? test.viewColumn(m.index()) : test.viewRow(m.index());
assertEquals("iterator: " + v + ", randomAccess: " + w, v, w);
}
}
内容来源于网络,如有侵权,请联系作者删除!