Пример #1
0
 /**
  * It checks if the complex covers a given example
  *
  * @param m The example
  * @return boolean True if it covers the example. False in other case
  */
 public boolean covered(Instance m) {
   boolean cubierto = true;
   double[] ejemplo = m.getMuest();
   for (int i = 0; i < this.size() && cubierto; i++) {
     Selector s = this.getSelector(i);
     switch (s.getOperator()) {
       case 0: // equal operator
         double[] valor = s.getValues();
         cubierto = false;
         for (int j = 0; (j < valor.length) && (!cubierto); j++) {
           cubierto = (ejemplo[s.getAttribute()] == valor[j]);
         }
         break;
       case 1: // distinct operator
         cubierto = ejemplo[s.getAttribute()] != s.getValue();
         break;
       case 2: // lower or equal
         cubierto = ejemplo[s.getAttribute()] <= s.getValue();
         break;
       case 3: // higher
         cubierto = ejemplo[s.getAttribute()] > s.getValue();
         break;
     }
   }
   return cubierto;
 }
Пример #2
0
  /**
   * It copies the complex
   *
   * @return A new cloned complex
   */
  public Complex copyRule() {
    int i;

    Complex c = new Complex(nclass);
    for (i = 0; i < compl.size(); i++) {
      Selector aux = (Selector) compl.get(i);
      Selector s = new Selector(aux.getAttribute(), aux.getOperator(), aux.getValue());
      c.addSelector(s);
    }
    c.distrib = this.getDistribution();
    c.setClass(clas);

    return c;
  }