本文整理汇总了Java中edu.jhu.prim.map.IntDoubleEntry类的典型用法代码示例。如果您正苦于以下问题:Java IntDoubleEntry类的具体用法?Java IntDoubleEntry怎么用?Java IntDoubleEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IntDoubleEntry类属于edu.jhu.prim.map包,在下文中一共展示了IntDoubleEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testGetPerWordFeats
import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
@Test
public void testGetPerWordFeats() throws Exception {
CoNLL09Sentence csent = AnnoSentenceTest.getDogConll09Sentence();
AnnoSentence sent = csent.toAnnoSentence(true);
RoleVar rv = new RoleVar(VarType.PREDICTED, 3, "rv", QLists.getList("arg0", "arg1", "arg2"), 2, 0);
sent.setClusters(QLists.getList("010101", "01", "101010", "010101"));
FeatureNames alphabet = new FeatureNames();
SrlWordFeaturesPrm prm = new SrlWordFeaturesPrm();
prm.srlEmbFeatType = SrlWordFeatType.HEAD_TYPE_LOC;
SrlWordFeatures fe = new SrlWordFeatures(prm, sent, alphabet);
List<FeatureVector> featsList = fe.getFeatures(rv);
assertEquals(sent.size(), featsList.size());
String fs = "";
for (int i=0; i<featsList.size(); i++) {
//for (int k=0; k<featsListSystem.out.println()
FeatureVector feats = featsList.get(i);
fs += "FeatureVector: " + i + "\n";
for (IntDoubleEntry e : feats) {
fs += alphabet.lookupObject(e.index()) + "=" + e.get() + ", \n";
}
fs += "\n";
}
System.out.println(fs);
assertEquals(expectedFs, fs);
}
示例2: testGetPerWordFeats
import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
@Test
public void testGetPerWordFeats() throws Exception {
AnnoSentence sent = RelationMungerTest.getSentWithRelationsAndNer();
sent.setParents(new int[]{-1, 0, 1, 2, 3, 4});
Pair<NerMention, NerMention> pair = sent.getNePairs().get(0);
RelVar rv = new RelVar(VarType.PREDICTED, "rv", pair.get1(), pair.get2(),
QLists.getList("OWNER", "NEAR", "ART"));
FeatureNames alphabet = new FeatureNames();
RelWordFeaturesPrm prm = new RelWordFeaturesPrm();
prm.embFeatType = EmbFeatType.HEAD_TYPE_LOC;
prm.entityTypeRepl = null;
RelWordFeatures fe = new RelWordFeatures(prm, sent, alphabet);
List<FeatureVector> featsList = fe.getFeatures(rv);
assertEquals(sent.size(), featsList.size());
String fs = "";
for (int i=0; i<featsList.size(); i++) {
//for (int k=0; k<featsListSystem.out.println()
FeatureVector feats = featsList.get(i);
fs += "FeatureVector: " + i + "\n";
for (IntDoubleEntry e : feats) {
fs += alphabet.lookupObject(e.index()) + "=" + e.get() + ", \n";
}
fs += "\n";
}
System.out.println(fs);
assertEquals(expectedFs, fs);
}
示例3: next
import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
public IntDoubleEntry next() {
entry.update(cursor);
cursor++;
while(cursor < row.length && row[cursor] == 0) {
cursor++;
}
return entry;
}
示例4: testIterator
import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
@Test
public void testIterator() {
IntDoubleUnsortedVector v2 = new IntDoubleUnsortedVector();
v2.set(1, toDouble(11));
v2.set(3, toDouble(33));
v2.set(4, toDouble(0));
v2.set(5, toDouble(55));
IntDoubleEntry e;
Iterator<IntDoubleEntry> iter = v2.iterator();
assertTrue(iter.hasNext());
e = iter.next();
assertEquals(1, toInt(e.index()));
assertEquals(11, toInt(e.get()));
assertTrue(iter.hasNext());
e = iter.next();
assertEquals(3, toInt(e.index()));
assertEquals(33, toInt(e.get()));
// TODO: Zeros are never explicitly added.
// assertTrue(iter.hasNext());
// e = iter.next();
// assertEquals(4, toInt(e.index()));
// assertEquals(0, toInt(e.get()));
assertTrue(iter.hasNext());
e = iter.next();
assertEquals(5, toInt(e.index()));
assertEquals(55, toInt(e.get()));
assertFalse(iter.hasNext());
}
示例5: testIteratorNoCompact
import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
@Test
public void testIteratorNoCompact() {
IntDoubleUnsortedVector v2 = new IntDoubleUnsortedVector();
v2.add(1, toDouble(11));
v2.add(2, toDouble(22));
v2.add(1, toDouble(111));
IntDoubleEntry e;
Iterator<IntDoubleEntry> iter = v2.iteratorNoCompact();
assertTrue(iter.hasNext());
e = iter.next();
assertEquals(1, toInt(e.index()));
assertEquals(11, toInt(e.get()));
assertTrue(iter.hasNext());
e = iter.next();
assertEquals(2, toInt(e.index()));
assertEquals(22, toInt(e.get()));
assertTrue(iter.hasNext());
e = iter.next();
assertEquals(1, toInt(e.index()));
assertEquals(111, toInt(e.get()));
assertFalse(iter.hasNext());
}
示例6: testIterator
import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
@Test
public void testIterator() {
IntDoubleSortedVector v2 = new IntDoubleSortedVector();
v2.set(1, toDouble(11));
v2.set(3, toDouble(33));
v2.set(4, toDouble(0));
v2.set(5, toDouble(55));
IntDoubleEntry e;
Iterator<IntDoubleEntry> iter = v2.iterator();
assertTrue(iter.hasNext());
e = iter.next();
assertEquals(1, toInt(e.index()));
assertEquals(11, toInt(e.get()));
assertTrue(iter.hasNext());
e = iter.next();
assertEquals(3, toInt(e.index()));
assertEquals(33, toInt(e.get()));
assertTrue(iter.hasNext());
e = iter.next();
assertEquals(4, toInt(e.index()));
assertEquals(0, toInt(e.get()));
assertTrue(iter.hasNext());
e = iter.next();
assertEquals(5, toInt(e.index()));
assertEquals(55, toInt(e.get()));
assertFalse(iter.hasNext());
}
示例7: getStateNames
import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
public List<String> getStateNames() {
List<String> names = new ArrayList<String>();
for (LogLinearExDesc desc : descList) {
StringBuilder sb = new StringBuilder();
for (IntDoubleEntry entry : desc.getFeatures()) {
sb.append(entry.index());
sb.append(":");
}
names.add(sb.toString());
}
return names;
}
示例8: getRowEntries
import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
public Iterable<IntDoubleEntry> getRowEntries(int row) {
return rows[row];
}
示例9: getRowEntries
import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
public Iterable<IntDoubleEntry> getRowEntries(int row) {
throw new RuntimeException("not implemented");
}
示例10: getColEntries
import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
public Iterable<IntDoubleEntry> getColEntries(int col) {
return cols[col];
}
示例11: getRowEntries
import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
@Override
public Iterable<IntDoubleEntry> getRowEntries(int row) {
throw new RuntimeException();
}
示例12: getRowEntries
import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
@Override
public Iterable<IntDoubleEntry> getRowEntries(int row) {
return new DenseDoubleVectorIterator(matrix[row]);
}
示例13: iterator
import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
@Override
public Iterator<IntDoubleEntry> iterator() {
return this;
}
示例14: iterator
import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
@Override
public Iterator<IntDoubleEntry> iterator() {
compact();
return new IntDoubleIterator();
}
示例15: iteratorNoCompact
import edu.jhu.prim.map.IntDoubleEntry; //导入依赖的package包/类
public Iterator<IntDoubleEntry> iteratorNoCompact() {
return new IntDoubleIterator();
}