热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

org.apache.mahout.math.random.WeightedThing类的使用及代码示例

本文整理了Java中org.apache.mahout.math.random.WeightedThing类的一些代码示例,展示了WeightedThing

本文整理了Java中org.apache.mahout.math.random.WeightedThing类的一些代码示例,展示了WeightedThing类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WeightedThing类的具体详情如下:
包路径:org.apache.mahout.math.random.WeightedThing
类名称:WeightedThing

WeightedThing介绍

[英]Handy for creating multinomial distributions of things.
[中]便于创建事物的多项式分布。

代码示例

代码示例来源:origin: apache/mahout

public Multinomial(Iterable> things) {
this();
for (WeightedThing thing : things) {
add(thing.getValue(), thing.getWeight());
}
}

代码示例来源:origin: apache/mahout

double sample(double u) {
if (u List> steps = Lists.newArrayList();
limit = 1;
int i = 0;
while (u / 20 double pdf = pd.probability(i);
limit -= pdf;
steps.add(new WeightedThing<>(i, pdf));
i++;
}
steps.add(new WeightedThing<>(steps.size(), limit));
partial = new Multinomial<>(steps);
}
return partial.sample(u);
}
}

代码示例来源:origin: org.apache.mahout/mahout-core

protected static WeightedThing removeHash(WeightedThing input) {
return new WeightedThing(((HashedVector) input.getValue()).getVector(), input.getWeight());
}

代码示例来源:origin: org.apache.mahout/mahout-mr

List> currProjectiOns= scalarProjections.get(i);
int middle = Collections.binarySearch(currProjections,
new WeightedThing(projection.get(i)));
if (middle <0) {
middle = -(middle + 1);
if (currProjections.get(j).getValue() == null) {
continue;
candidates.add(currProjections.get(j).getValue());
Lists.newArrayListWithCapacity(candidates.size() + pendingAdditions.size());
for (Vector candidate : Iterables.concat(candidates, pendingAdditions)) {
top.add(new WeightedThing<>(candidate, distanceMeasure.distance(candidate, query)));

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

@Override
protected Vector computeNext() {
do {
if (!data.hasNext()) {
return endOfData();
}
WeightedThing next = data.next();
if (next.getValue() != null) {
return next.getValue();
}
} while (true);
}
};

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

@Override
public boolean remove(Vector vector, double epsilon) {
WeightedThing toRemove = searchFirst(vector, false);
if (toRemove.getWeight() Iterator basisVectors = basisMatrix.iterator();
for (TreeMultiset> 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

Vector projection = basisMatrix.times(pending);
for (int i = 0; i scalarProjections.get(i).add(new WeightedThing(pending, projection.get(i)));
List> currProjectiOns= scalarProjections.get(i);
for (WeightedThing v : currProjections) {
if (v.getValue() == null) {
v.setWeight(Double.POSITIVE_INFINITY);

代码示例来源:origin: org.apache.mahout/mahout-core

@Override
protected boolean lessThan(WeightedThing a, WeightedThing b) {
return a.getWeight() > b.getWeight();
}
};

代码示例来源:origin: org.apache.mahout/mahout-mr

protected static WeightedThing removeHash(WeightedThing input) {
return new WeightedThing<>(((HashedVector) input.getValue()).getVector(), input.getWeight());
}

代码示例来源:origin: org.apache.mahout/mahout-core

List> currProjectiOns= scalarProjections.get(i);
int middle = Collections.binarySearch(currProjections,
new WeightedThing(projection.get(i)));
if (middle <0) {
middle = -(middle + 1);
if (currProjections.get(j).getValue() == null) {
continue;
candidates.add(currProjections.get(j).getValue());
Lists.newArrayListWithCapacity(candidates.size() + pendingAdditions.size());
for (Vector candidate : Iterables.concat(candidates, pendingAdditions)) {
top.add(new WeightedThing(candidate, distanceMeasure.distance(candidate, query)));

代码示例来源:origin: org.apache.mahout/mahout-core

@Override
protected Vector computeNext() {
do {
if (!data.hasNext()) {
return endOfData();
}
WeightedThing next = data.next();
if (next.getValue() != null) {
return next.getValue();
}
} while (true);
}
};

代码示例来源:origin: org.apache.mahout/mahout-core

@Override
public boolean remove(Vector vector, double epsilon) {
WeightedThing toRemove = searchFirst(vector, false);
if (toRemove.getWeight() Iterator basisVectors = basisMatrix.iterator();
for (TreeMultiset> 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-mrlegacy

Vector projection = basisMatrix.times(pending);
for (int i = 0; i scalarProjections.get(i).add(new WeightedThing(pending, projection.get(i)));
List> currProjectiOns= scalarProjections.get(i);
for (WeightedThing v : currProjections) {
if (v.getValue() == null) {
v.setWeight(Double.POSITIVE_INFINITY);

代码示例来源:origin: org.apache.mahout/mahout-mr

@Override
protected boolean lessThan(WeightedThing a, WeightedThing b) {
return a.getWeight() > b.getWeight();
}
};

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

protected static WeightedThing removeHash(WeightedThing input) {
return new WeightedThing(((HashedVector) input.getValue()).getVector(), input.getWeight());
}

代码示例来源:origin: org.apache.mahout/mahout-math

public Multinomial(Iterable> things) {
this();
for (WeightedThing thing : things) {
add(thing.getValue(), thing.getWeight());
}
}

代码示例来源:origin: org.apache.mahout/mahout-mrlegacy

List> currProjectiOns= scalarProjections.get(i);
int middle = Collections.binarySearch(currProjections,
new WeightedThing(projection.get(i)));
if (middle <0) {
middle = -(middle + 1);
if (currProjections.get(j).getValue() == null) {
continue;
candidates.add(currProjections.get(j).getValue());
Lists.newArrayListWithCapacity(candidates.size() + pendingAdditions.size());
for (Vector candidate : Iterables.concat(candidates, pendingAdditions)) {
top.add(new WeightedThing(candidate, distanceMeasure.distance(candidate, query)));

代码示例来源:origin: org.apache.mahout/mahout-mr

@Override
protected Vector computeNext() {
do {
if (!data.hasNext()) {
return endOfData();
}
WeightedThing next = data.next();
if (next.getValue() != null) {
return next.getValue();
}
} while (true);
}
};

代码示例来源:origin: org.apache.mahout/mahout-mr

@Override
public boolean remove(Vector vector, double epsilon) {
WeightedThing toRemove = searchFirst(vector, false);
if (toRemove.getWeight() Iterator basisVectors = basisMatrix.iterator();
for (TreeMultiset> 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-mr

Vector projection = basisMatrix.times(pending);
for (int i = 0; i scalarProjections.get(i).add(new WeightedThing<>(pending, projection.get(i)));
List> currProjectiOns= scalarProjections.get(i);
for (WeightedThing v : currProjections) {
if (v.getValue() == null) {
v.setWeight(Double.POSITIVE_INFINITY);

推荐阅读
  • Python正则表达式学习记录及常用方法
    本文记录了学习Python正则表达式的过程,介绍了re模块的常用方法re.search,并解释了rawstring的作用。正则表达式是一种方便检查字符串匹配模式的工具,通过本文的学习可以掌握Python中使用正则表达式的基本方法。 ... [详细]
  • 微软头条实习生分享深度学习自学指南
    本文介绍了一位微软头条实习生自学深度学习的经验分享,包括学习资源推荐、重要基础知识的学习要点等。作者强调了学好Python和数学基础的重要性,并提供了一些建议。 ... [详细]
  • 如何自行分析定位SAP BSP错误
    The“BSPtag”Imentionedintheblogtitlemeansforexamplethetagchtmlb:configCelleratorbelowwhichi ... [详细]
  • Spring源码解密之默认标签的解析方式分析
    本文分析了Spring源码解密中默认标签的解析方式。通过对命名空间的判断,区分默认命名空间和自定义命名空间,并采用不同的解析方式。其中,bean标签的解析最为复杂和重要。 ... [详细]
  • PHP图片截取方法及应用实例
    本文介绍了使用PHP动态切割JPEG图片的方法,并提供了应用实例,包括截取视频图、提取文章内容中的图片地址、裁切图片等问题。详细介绍了相关的PHP函数和参数的使用,以及图片切割的具体步骤。同时,还提供了一些注意事项和优化建议。通过本文的学习,读者可以掌握PHP图片截取的技巧,实现自己的需求。 ... [详细]
  • 这是原文链接:sendingformdata许多情况下,我们使用表单发送数据到服务器。服务器处理数据并返回响应给用户。这看起来很简单,但是 ... [详细]
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • CSS3选择器的使用方法详解,提高Web开发效率和精准度
    本文详细介绍了CSS3新增的选择器方法,包括属性选择器的使用。通过CSS3选择器,可以提高Web开发的效率和精准度,使得查找元素更加方便和快捷。同时,本文还对属性选择器的各种用法进行了详细解释,并给出了相应的代码示例。通过学习本文,读者可以更好地掌握CSS3选择器的使用方法,提升自己的Web开发能力。 ... [详细]
  • 个人学习使用:谨慎参考1Client类importcom.thoughtworks.gauge.Step;importcom.thoughtworks.gauge.T ... [详细]
  • 标题: ... [详细]
  • 前景:当UI一个查询条件为多项选择,或录入多个条件的时候,比如查询所有名称里面包含以下动态条件,需要模糊查询里面每一项时比如是这样一个数组条件:newstring[]{兴业银行, ... [详细]
  • Linux重启网络命令实例及关机和重启示例教程
    本文介绍了Linux系统中重启网络命令的实例,以及使用不同方式关机和重启系统的示例教程。包括使用图形界面和控制台访问系统的方法,以及使用shutdown命令进行系统关机和重启的句法和用法。 ... [详细]
  • JavaSE笔试题-接口、抽象类、多态等问题解答
    本文解答了JavaSE笔试题中关于接口、抽象类、多态等问题。包括Math类的取整数方法、接口是否可继承、抽象类是否可实现接口、抽象类是否可继承具体类、抽象类中是否可以有静态main方法等问题。同时介绍了面向对象的特征,以及Java中实现多态的机制。 ... [详细]
  • 本文介绍了Oracle数据库中tnsnames.ora文件的作用和配置方法。tnsnames.ora文件在数据库启动过程中会被读取,用于解析LOCAL_LISTENER,并且与侦听无关。文章还提供了配置LOCAL_LISTENER和1522端口的示例,并展示了listener.ora文件的内容。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
author-avatar
my76572
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有