當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。