本文整理了Java中cc.mallet.types.InstanceList.sampleWithWeights()
方法的一些代码示例,展示了InstanceList.sampleWithWeights()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。InstanceList.sampleWithWeights()
方法的具体详情如下:
包路径:cc.mallet.types.InstanceList
类名称:InstanceList
方法名:sampleWithWeights
[英]Returns an InstanceList
of the same size, where the instances come from the random sampling (with replacement) of this list using the given weights. The length of the weight array must be the same as the length of this list The new instances all have their weights set to one.
[中]返回相同大小的InstanceList
,其中实例来自使用给定权重对此列表的随机抽样(替换)。权重数组的长度必须与此列表的长度相同。新实例的权重都设置为1。
代码示例来源:origin: com.github.steveash.mallet/mallet
/**
* Returns an <code>InstanceList</code> of the same size, where the instances come from the
* random sampling (with replacement) of this list using the instance weights.
* The new instances all have their weights set to one.
*/
// added by Gary - ghuang@cs.umass.edu
@Deprecated
// Move to InstanceListUtils
public InstanceList sampleWithInstanceWeights(java.util.Random r)
{
double[] weights = new double[size()];
for (int i = 0; i < weights.length; i++)
weights[i] = getInstanceWeight(i);
return sampleWithWeights(r, weights);
}
代码示例来源:origin: cc.mallet/mallet
/**
* Returns an <code>InstanceList</code> of the same size, where the instances come from the
* random sampling (with replacement) of this list using the instance weights.
* The new instances all have their weights set to one.
*/
// added by Gary - ghuang@cs.umass.edu
@Deprecated
// Move to InstanceListUtils
public InstanceList sampleWithInstanceWeights(java.util.Random r)
{
double[] weights = new double[size()];
for (int i = 0; i < weights.length; i++)
weights[i] = getInstanceWeight(i);
return sampleWithWeights(r, weights);
}
代码示例来源:origin: de.julielab/jcore-mallet-2.0.9
/**
* Returns an <code>InstanceList</code> of the same size, where the instances come from the
* random sampling (with replacement) of this list using the instance weights.
* The new instances all have their weights set to one.
*/
// added by Gary - ghuang@cs.umass.edu
@Deprecated
// Move to InstanceListUtils
public InstanceList sampleWithInstanceWeights(java.util.Random r)
{
double[] weights = new double[size()];
for (int i = 0; i < weights.length; i++)
weights[i] = getInstanceWeight(i);
return sampleWithWeights(r, weights);
}
内容来源于网络,如有侵权,请联系作者删除!