示例#1
0
文件: CombStat.java 项目: vrodic/Clus
 /**
  * Checks weather values of a target attribute are significantly different
  *
  * @return
  */
 public boolean targetSignDifferent() {
   boolean res = false;
   int att = -1;
   String att_name;
   String att_name2;
   ClusStatistic targetStat = m_StatManager.getStatistic(ClusAttrType.ATTR_USE_TARGET);
   if (targetStat instanceof ClassificationStat) {
     for (int i = 0; i < targetStat.getNbNominalAttributes(); i++) {
       att_name = ((ClassificationStat) targetStat).getAttribute(i).getName();
       for (int j = 0; j < m_ClassStat.getNbNominalAttributes(); j++) {
         att_name2 = m_ClassStat.getAttribute(j).getName();
         if (att_name.equals(att_name2)) {
           att = j;
           break;
         }
       }
       if (SignDifferentNom(att)) {
         res = true;
         break; // TODO: If one target att significant, the whole rule significant!?
       }
     }
     // System.out.println("Target sign. testing: " + res);
     return res;
   } else if (targetStat instanceof RegressionStat) {
     for (int i = 0; i < targetStat.getNbNumericAttributes(); i++) {
       att_name = ((RegressionStat) targetStat).getAttribute(i).getName();
       for (int j = 0; j < m_RegStat.getNbNumericAttributes(); j++) {
         att_name2 = m_RegStat.getAttribute(j).getName();
         if (att_name.equals(att_name2)) {
           att = j;
           break;
         }
       }
       try {
         if (SignDifferentNum(att)) {
           res = true;
           break; // TODO: If one target att significant, the whole rule significant!?
         }
       } catch (IllegalArgumentException e) {
         e.printStackTrace();
       } catch (MathException e) {
         e.printStackTrace();
       }
     }
     return res;
   } else {
     // TODO: Classification and regression
     return true;
   }
 }
示例#2
0
文件: CombStat.java 项目: vrodic/Clus
 /** Returns a number of attributes with significantly different distributions */
 public int signDifferent() {
   int sign_diff = 0;
   // Nominal attributes
   for (int i = 0; i < m_ClassStat.getNbAttributes(); i++) {
     if (SignDifferentNom(i)) {
       sign_diff++;
     }
   }
   // Numeric attributes
   for (int i = 0; i < m_RegStat.getNbAttributes(); i++) {
     try {
       if (SignDifferentNum(i)) {
         sign_diff++;
       }
     } catch (IllegalArgumentException e) {
       e.printStackTrace();
     } catch (MathException e) {
       e.printStackTrace();
     }
   }
   System.out.println("Nb.sig.atts: " + sign_diff);
   return sign_diff;
 }