当前位置: 首页>>代码示例>>Java>>正文


Java Utils.logs2probs方法代码示例

本文整理汇总了Java中weka.core.Utils.logs2probs方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.logs2probs方法的具体用法?Java Utils.logs2probs怎么用?Java Utils.logs2probs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在weka.core.Utils的用法示例。


在下文中一共展示了Utils.logs2probs方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: distributionForInstance

import weka.core.Utils; //导入方法依赖的package包/类
/**
 * Calculates the class membership probabilities for the given test instance.
 * 
 * @param instance the instance to be classified
 * @return predicted class probability distribution
 * @throws Exception if instance could not be classified successfully
 */
@Override
public double[] distributionForInstance(Instance instance) throws Exception {

  // default model?
  if (m_NumIterationsPerformed == 0) {
    return m_ZeroR.distributionForInstance(instance);
  }

  if (m_NumIterationsPerformed == 0) {
    throw new Exception("No model built");
  }
  double[] sums = new double[instance.numClasses()];

  if (m_NumIterationsPerformed == 1) {
    return m_Classifiers[0].distributionForInstance(instance);
  } else {
    for (int i = 0; i < m_NumIterationsPerformed; i++) {
      sums[(int) m_Classifiers[i].classifyInstance(instance)] += m_Betas[i];
    }
    return Utils.logs2probs(sums);
  }
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:30,代码来源:AdaBoostM1.java

示例2: convertInstance

import weka.core.Utils; //导入方法依赖的package包/类
/**
 * Convert a single instance over. The converted instance is added to the end
 * of the output queue.
 * 
 * @param instance the instance to convert
 * @throws Exception if something goes wrong
 */
protected void convertInstance(Instance instance) throws Exception {

  // set up values
  double[] instanceVals = new double[outputFormatPeek().numAttributes()];
  double[] tempvals;
  if (instance.classIndex() >= 0) {
    tempvals = new double[outputFormatPeek().numAttributes() - 1];
  } else {
    tempvals = new double[outputFormatPeek().numAttributes()];
  }
  int pos = 0;
  for (int j = 0; j < m_clusterers.length; j++) {
    if (m_clusterers[j] != null) {
      double[] probs;
      if (m_removeAttributes != null) {
        m_removeAttributes.input(instance);
        probs = logs2densities(j, m_removeAttributes.output());
      } else {
        probs = logs2densities(j, instance);
      }
      System.arraycopy(probs, 0, tempvals, pos, probs.length);
      pos += probs.length;
    }
  }
  tempvals = Utils.logs2probs(tempvals);
  System.arraycopy(tempvals, 0, instanceVals, 0, tempvals.length);
  if (instance.classIndex() >= 0) {
    instanceVals[instanceVals.length - 1] = instance.classValue();
  }

  push(new DenseInstance(instance.weight(), instanceVals));
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:40,代码来源:ClusterMembership.java

示例3: distributionForInstance

import weka.core.Utils; //导入方法依赖的package包/类
/**
 * Returns the cluster probability distribution for an instance.
 *
 * @param instance the instance to be clustered
 * @return the probability distribution
 * @throws Exception if computation fails
 */  
public double[] distributionForInstance(Instance instance) throws Exception {
  
  return Utils.logs2probs(logJointDensitiesForInstance(instance));
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:12,代码来源:AbstractDensityBasedClusterer.java


注:本文中的weka.core.Utils.logs2probs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。