當前位置: 首頁>>代碼示例>>Java>>正文


Java Utils.smOrEq方法代碼示例

本文整理匯總了Java中weka.core.Utils.smOrEq方法的典型用法代碼示例。如果您正苦於以下問題:Java Utils.smOrEq方法的具體用法?Java Utils.smOrEq怎麽用?Java Utils.smOrEq使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在weka.core.Utils的用法示例。


在下文中一共展示了Utils.smOrEq方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: prune

import weka.core.Utils; //導入方法依賴的package包/類
/**
  * Prunes a tree.
  *
  * @throws Exception if tree can't be pruned successfully
  */
 public void prune() throws Exception {
 
   if (!m_isLeaf) {
     
     // Prune all subtrees.
     for (int i = 0; i < m_sons.length; i++)
son(i).prune();
     
     // Decide if leaf is best choice.
     if (Utils.smOrEq(errorsForLeaf(),errorsForTree())) {

// Free son Trees
m_sons = null;
m_isLeaf = true;

// Get NoSplit Model for node.
m_localModel = new NoSplit(localModel().distribution());
     }
   }
 }
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:26,代碼來源:PruneableClassifierTree.java

示例2: setSplitPoint

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Sets split point to greatest value in given data smaller or equal to old
 * split point. (C4.5 does this for some strange reason).
 */
public final void setSplitPoint(Instances allInstances) {

  double newSplitPoint = -Double.MAX_VALUE;
  double tempValue;
  Instance instance;

  if ((!allInstances.attribute(m_attIndex).isNominal()) && (m_numSubsets > 1)) {
    Enumeration<Instance> enu = allInstances.enumerateInstances();
    while (enu.hasMoreElements()) {
      instance = enu.nextElement();
      if (!instance.isMissing(m_attIndex)) {
        tempValue = instance.value(m_attIndex);
        if (Utils.gr(tempValue, newSplitPoint)
          && Utils.smOrEq(tempValue, m_splitPoint)) {
          newSplitPoint = tempValue;
        }
      }
    }
    m_splitPoint = newSplitPoint;
  }
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:26,代碼來源:BinC45Split.java

示例3: whichSubset

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Returns index of subset instance is assigned to. Returns -1 if instance is
 * assigned to more than one subset.
 * 
 * @exception Exception if something goes wrong
 */

@Override
public final int whichSubset(Instance instance) throws Exception {

  if (instance.isMissing(m_attIndex)) {
    return -1;
  } else {
    if (instance.attribute(m_attIndex).isNominal()) {
      if ((int) m_splitPoint == (int) instance.value(m_attIndex)) {
        return 0;
      } else {
        return 1;
      }
    } else if (Utils.smOrEq(instance.value(m_attIndex), m_splitPoint)) {
      return 0;
    } else {
      return 1;
    }
  }
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:27,代碼來源:BinC45Split.java

示例4: setSplitPoint

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Sets split point to greatest value in given data smaller or equal to old
 * split point. (C4.5 does this for some strange reason).
 */
public final void setSplitPoint(Instances allInstances) {

  double newSplitPoint = -Double.MAX_VALUE;
  double tempValue;
  Instance instance;

  if ((allInstances.attribute(m_attIndex).isNumeric()) && (m_numSubsets > 1)) {
    Enumeration<Instance> enu = allInstances.enumerateInstances();
    while (enu.hasMoreElements()) {
      instance = enu.nextElement();
      if (!instance.isMissing(m_attIndex)) {
        tempValue = instance.value(m_attIndex);
        if (Utils.gr(tempValue, newSplitPoint)
          && Utils.smOrEq(tempValue, m_splitPoint)) {
          newSplitPoint = tempValue;
        }
      }
    }
    m_splitPoint = newSplitPoint;
  }
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:26,代碼來源:C45Split.java

示例5: whichSubset

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Returns index of subset instance is assigned to. Returns -1 if instance is
 * assigned to more than one subset.
 * 
 * @exception Exception if something goes wrong
 */
@Override
public final int whichSubset(Instance instance) throws Exception {

  if (instance.isMissing(m_attIndex)) {
    return -1;
  } else {
    if (instance.attribute(m_attIndex).isNominal()) {
      return (int) instance.value(m_attIndex);
    } else if (Utils.smOrEq(instance.value(m_attIndex), m_splitPoint)) {
      return 0;
    } else {
      return 1;
    }
  }
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:22,代碼來源:C45Split.java

示例6: whichSubset

import weka.core.Utils; //導入方法依賴的package包/類
public final int whichSubset(Instance instance) 
 throws Exception {

   if (instance.isMissing(m_attIndex))
     return -1;
   else{
     if (instance.attribute(m_attIndex).isNominal())
return (int)instance.value(m_attIndex);
     else
if (Utils.smOrEq(instance.value(m_attIndex),m_splitPoint))
  return 0;
else
  return 1;
   }
 }
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:16,代碼來源:ResidualSplit.java

示例7: pruneEnd

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Prunes the end of the rule.
 */
protected void pruneEnd() throws Exception {

  double errorsLeaf, errorsTree;

  errorsTree = errorsForTree();
  errorsLeaf = errorsForLeaf();
  if (Utils.smOrEq(errorsLeaf, errorsTree)) {
    m_isLeaf = true;
    m_sons = null;
    m_localModel = new NoSplit(localModel().distribution());
  }
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:16,代碼來源:PruneableDecList.java

示例8: pruneEnd

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Prunes the end of the rule.
 */
protected void pruneEnd() {

  double errorsLeaf, errorsTree;

  errorsTree = getEstimatedErrorsForTree();
  errorsLeaf = getEstimatedErrorsForLeaf();
  if (Utils.smOrEq(errorsLeaf, errorsTree + 0.1)) { // +0.1 as in C4.5
    m_isLeaf = true;
    m_sons = null;
    m_localModel = new NoSplit(localModel().distribution());
  }
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:16,代碼來源:C45PruneableDecList.java

示例9: chooseIndex

import weka.core.Utils; //導入方法依賴的package包/類
/**
 * Method for choosing a subset to expand.
 */
public final int chooseIndex() {

  int minIndex = -1;
  double estimated, min = Double.MAX_VALUE;
  int i, j;

  for (i = 0; i < m_sons.length; i++) {
    if (son(i) == null) {
      if (Utils.sm(localModel().distribution().perBag(i), m_minNumObj)) {
        estimated = Double.MAX_VALUE;
      } else {
        estimated = 0;
        for (j = 0; j < localModel().distribution().numClasses(); j++) {
          estimated -= m_splitCrit.lnFunc(localModel().distribution()
            .perClassPerBag(i, j));
        }
        estimated += m_splitCrit
          .lnFunc(localModel().distribution().perBag(i));
        estimated /= (localModel().distribution().perBag(i) * ContingencyTables.log2);
      }
      if (Utils.smOrEq(estimated, 0)) {
        return i;
      }
      if (Utils.sm(estimated, min)) {
        min = estimated;
        minIndex = i;
      }
    }
  }

  return minIndex;
}
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:36,代碼來源:ClassifierDecList.java

示例10: prune

import weka.core.Utils; //導入方法依賴的package包/類
/**
  * Prunes a tree using C4.5's pruning procedure.
  *
  * @throws Exception if something goes wrong
  */
 public void prune() throws Exception {

   double errorsLargestBranch;
   double errorsLeaf;
   double errorsTree;
   int indexOfLargestBranch;
   C45PruneableClassifierTree largestBranch;
   int i;

   if (!m_isLeaf){

     // Prune all subtrees.
     for (i=0;i<m_sons.length;i++)
son(i).prune();

     // Compute error for largest branch
     indexOfLargestBranch = localModel().distribution().maxBag();
     if (m_subtreeRaising) {
errorsLargestBranch = son(indexOfLargestBranch).
  getEstimatedErrorsForBranch((Instances)m_train);
     } else {
errorsLargestBranch = Double.MAX_VALUE;
     }

     // Compute error if this Tree would be leaf
     errorsLeaf = 
getEstimatedErrorsForDistribution(localModel().distribution());

     // Compute error for the whole subtree
     errorsTree = getEstimatedErrors();

     // Decide if leaf is best choice.
     if (Utils.smOrEq(errorsLeaf,errorsTree+0.1) &&
  Utils.smOrEq(errorsLeaf,errorsLargestBranch+0.1)){

// Free son Trees
m_sons = null;
m_isLeaf = true;
	
// Get NoSplit Model for node.
m_localModel = new NoSplit(localModel().distribution());
return;
     }

     // Decide if largest branch is better choice
     // than whole subtree.
     if (Utils.smOrEq(errorsLargestBranch,errorsTree+0.1)){
largestBranch = son(indexOfLargestBranch);
m_sons = largestBranch.m_sons;
m_localModel = largestBranch.localModel();
m_isLeaf = largestBranch.m_isLeaf;
newDistribution(m_train);
prune();
     }
   }
 }
 
開發者ID:mydzigear,項目名稱:repo.kmeanspp.silhouette_score,代碼行數:62,代碼來源:C45PruneableClassifierTree.java


注:本文中的weka.core.Utils.smOrEq方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。