本文整理汇总了Java中gnu.trove.map.hash.TIntFloatHashMap.get方法的典型用法代码示例。如果您正苦于以下问题:Java TIntFloatHashMap.get方法的具体用法?Java TIntFloatHashMap.get怎么用?Java TIntFloatHashMap.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gnu.trove.map.hash.TIntFloatHashMap
的用法示例。
在下文中一共展示了TIntFloatHashMap.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: distanceEuclidean
import gnu.trove.map.hash.TIntFloatHashMap; //导入方法依赖的package包/类
private float distanceEuclidean(int n, HashSparseVector sv, float baseDistance) {
HashSparseVector center = classCenter.get(n);
int count = classCount.get(n);
float dist = baseDistance / (count * count);
TIntFloatHashMap data = center.data;
TIntFloatIterator it = sv.data.iterator();
while (it.hasNext()) {
it.advance();
int key = it.key();
if (!data.containsKey(key)) {
dist += it.value() * it.value();
}
else {
float temp = data.get(key) / count;
dist -= temp * temp;
dist += (it.value() - temp) * (it.value() - temp);
}
}
return dist;
}
示例2: updateBaseDist
import gnu.trove.map.hash.TIntFloatHashMap; //导入方法依赖的package包/类
private void updateBaseDist(int classid, HashSparseVector vector) {
float base = baseDistList.get(classid);
TIntFloatHashMap center = classCenter.get(classid).data;
TIntFloatIterator it = vector.data.iterator();
while (it.hasNext()) {
it.advance();
if (!center.containsKey(it.key())) {
base += it.value() * it.value();
}
else {
float temp = center.get(it.key());
base -= temp * temp;
base += (it.value() - temp) * (it.value() - temp);
}
}
baseDistList.set(classid, base);
}
示例3: getweight
import gnu.trove.map.hash.TIntFloatHashMap; //导入方法依赖的package包/类
private float getweight(int c1, int c2) {
int max,min;
if(c1<=c2){
max = c2;
min = c1;
}else{
max = c1;
min = c2;
}
float w;
TIntFloatHashMap map2 = wcc.get(min);
if(map2==null){
w = 0;
}else
w = map2.get(max);
return w;
}
示例4: cmpCosineSim
import gnu.trove.map.hash.TIntFloatHashMap; //导入方法依赖的package包/类
private float cmpCosineSim(TIntFloatHashMap v1, TIntFloatHashMap v2) {
TIntHashSet inters = new TIntHashSet();
inters.addAll(v1.keySet());
inters.retainAll(v2.keySet());
if (inters.size() == 0)
return 0;
else {
int i = 0;
TIntIterator it = inters.iterator();
float num = 0;
float norm_v1 = 0;
float norm_v2 = 0;
while (it.hasNext()) {
i = it.next();
num += v1.get(i) * v2.get(i);
}
for (int k1 : v1.keys())
norm_v1 += (v1.get(k1) * v1.get(k1));
for (int k2 : v2.keys())
norm_v2 += (v2.get(k2) * v2.get(k2));
return num / (float) (Math.sqrt(norm_v1) * Math.sqrt(norm_v2));
}
}