Exemplo n.º 1
0
 /**
  * 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;
   }
 }