コード例 #1
0
 public void terminate(ClusModel model) throws IOException {
   CompleteTreeIterator iter = new CompleteTreeIterator((ClusNode) model);
   while (iter.hasMoreNodes()) {
     ClusNode node = (ClusNode) iter.getNextNode();
     node.getClusteringStat().calcMean();
   }
 }
コード例 #2
0
ファイル: M5Pruner.java プロジェクト: rcerri/Clus-Hyper-Code
 public void prune(ClusNode node) {
   RegressionStat stat = (RegressionStat) node.getClusteringStat();
   m_GlobalDeviation = Math.sqrt(stat.getSVarS(m_ClusteringWeights) / stat.getTotalWeight());
   pruneRecursive(node);
   // System.out.println("Performing test of M5 pruning");
   // TestM5PruningRuleNode.performTest(orig, node, m_GlobalDeviation, m_TargetWeights,
   // m_TrainingData);
 }
コード例 #3
0
ファイル: M5Pruner.java プロジェクト: rcerri/Clus-Hyper-Code
 public void pruneRecursive(ClusNode node) {
   if (node.atBottomLevel()) {
     return;
   }
   for (int i = 0; i < node.getNbChildren(); i++) {
     ClusNode child = (ClusNode) node.getChild(i);
     pruneRecursive(child);
   }
   RegressionStat stat = (RegressionStat) node.getClusteringStat();
   double rmsLeaf = stat.getRMSE(m_ClusteringWeights);
   double adjustedErrorLeaf = rmsLeaf * pruningFactor(stat.getTotalWeight(), 1);
   double rmsSubTree =
       Math.sqrt(node.estimateClusteringSS(m_ClusteringWeights) / stat.getTotalWeight());
   double adjustedErrorTree =
       rmsSubTree * pruningFactor(stat.getTotalWeight(), node.getModelSize());
   // System.out.println("C leaf: "+rmsLeaf+" tree: "+rmsSubTree);
   // System.out.println("C leafadj: "+adjustedErrorLeaf +" treeadj: "+rmsSubTree);
   if ((adjustedErrorLeaf <= adjustedErrorTree)
       || (adjustedErrorLeaf < (m_GlobalDeviation * 0.00001))) {
     node.makeLeaf();
   }
 }
コード例 #4
0
 public void modelUpdate(DataTuple tuple, ClusModel model) {
   ClusNode node = (ClusNode) model;
   node.getClusteringStat().updateWeighted(tuple, 0);
 }