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


Java Utils.grOrEq方法代码示例

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


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

示例1: check

import weka.core.Utils; //导入方法依赖的package包/类
/**
 * Checks if at least two bags contain a minimum number of instances.
 */
public final boolean check(double minNoObj) {

  int counter = 0;
  int i;

  for (i = 0; i < m_perBag.length; i++) {
    if (Utils.grOrEq(m_perBag[i], minNoObj)) {
      counter++;
    }
  }
  if (counter > 1) {
    return true;
  } else {
    return false;
  }
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:20,代码来源:Distribution.java

示例2: maxBag

import weka.core.Utils; //导入方法依赖的package包/类
/**
 * Returns index of bag containing maximum number of instances.
 */
public final int maxBag() {

  double max;
  int maxIndex;
  int i;

  max = 0;
  maxIndex = -1;
  for (i = 0; i < m_perBag.length; i++) {
    if (Utils.grOrEq(m_perBag[i], max)) {
      max = m_perBag[i];
      maxIndex = i;
    }
  }
  return maxIndex;
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:20,代码来源:Distribution.java

示例3: testWRTZeroR

import weka.core.Utils; //导入方法依赖的package包/类
/**
 * Determine whether the scheme performs worse than ZeroR during testing
 * 
 * @param classifier the pre-trained classifier
 * @param evaluation the classifier evaluation object
 * @param train the training data
 * @param test the test data
 * @return index 0 is true if the scheme performs better than ZeroR
 * @throws Exception if there was a problem during the scheme's testing
 */
protected boolean[] testWRTZeroR(Classifier classifier,
  Evaluation evaluation, Instances train, Instances test) throws Exception {

  boolean[] result = new boolean[2];

  evaluation.evaluateModel(classifier, test);
  try {

    // Tested OK, compare with ZeroR
    Classifier zeroR = new weka.classifiers.rules.ZeroR();
    zeroR.buildClassifier(train);
    Evaluation zeroREval = new Evaluation(train);
    zeroREval.evaluateModel(zeroR, test);
    result[0] = Utils.grOrEq(zeroREval.errorRate(), evaluation.errorRate());
  } catch (Exception ex) {
    throw new Error("Problem determining ZeroR performance: "
      + ex.getMessage());
  }

  return result;
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:32,代码来源:CheckClassifier.java

示例4: chooseLastIndex

import weka.core.Utils; //导入方法依赖的package包/类
/**
 * Choose last index (ie. choose rule).
 */
public final int chooseLastIndex() {

  int minIndex = 0;
  double estimated, min = Double.MAX_VALUE;

  if (!m_isLeaf) {
    for (int i = 0; i < m_sons.length; i++) {
      if (son(i) != null) {
        if (Utils.grOrEq(localModel().distribution().perBag(i), m_minNumObj)) {
          estimated = son(i).getSizeOfBranch();
          if (Utils.sm(estimated, min)) {
            min = estimated;
            minIndex = i;
          }
        }
      }
    }
  }

  return minIndex;
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:25,代码来源:ClassifierDecList.java

示例5: handleEnumeratedAttribute

import weka.core.Utils; //导入方法依赖的package包/类
/**
 * Creates split on enumerated attribute.
 * 
 * @exception Exception if something goes wrong
 */
private void handleEnumeratedAttribute(Instances trainInstances)
  throws Exception {

  Distribution newDistribution, secondDistribution;
  int numAttValues;
  double currIG, currGR;
  Instance instance;
  int i;

  numAttValues = trainInstances.attribute(m_attIndex).numValues();
  newDistribution = new Distribution(numAttValues,
    trainInstances.numClasses());

  // Only Instances with known values are relevant.
  Enumeration<Instance> enu = trainInstances.enumerateInstances();
  while (enu.hasMoreElements()) {
    instance = enu.nextElement();
    if (!instance.isMissing(m_attIndex)) {
      newDistribution.add((int) instance.value(m_attIndex), instance);
    }
  }
  m_distribution = newDistribution;

  // For all values
  for (i = 0; i < numAttValues; i++) {

    if (Utils.grOrEq(newDistribution.perBag(i), m_minNoObj)) {
      secondDistribution = new Distribution(newDistribution, i);

      // Check if minimum number of Instances in the two
      // subsets.
      if (secondDistribution.check(m_minNoObj)) {
        m_numSubsets = 2;
        currIG = m_infoGainCrit.splitCritValue(secondDistribution,
          m_sumOfWeights);
        currGR = m_gainRatioCrit.splitCritValue(secondDistribution,
          m_sumOfWeights, currIG);
        if ((i == 0) || Utils.gr(currGR, m_gainRatio)) {
          m_gainRatio = currGR;
          m_infoGain = currIG;
          m_splitPoint = i;
          m_distribution = secondDistribution;
        }
      }
    }
  }
}
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:53,代码来源:BinC45Split.java


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