public void createRule ( Instance inst ) { int remainder = ( int ) Double . MAX_VALUE ; int numInstanciaObservers = ( int ) this . observedClassDistribution . sumOfValues ( ) ; if ( numInstanciaObservers != 0 && this . gracePeriodOption . getValue ( ) != 0 ) { remainder = ( numInstanciaObservers ) % ( this . gracePeriodOption . getValue ( ) ) ; } if ( remainder == 0 ) { this . saveBestValGlobalEntropy = new ArrayList < ArrayList < Double > > ( ) ; this . saveBestGlobalEntropy = new DoubleVector ( ) ; this . saveTheBest = new ArrayList < Double > ( ) ; this . minEntropyTemp = Double . MAX_VALUE ; this . minEntropyNominalAttrib = Double . MAX_VALUE ; theBestAttributes ( inst , this . attributeObservers ) ; boolean HB = checkBestAttrib ( numInstanciaObservers , this . attributeObservers , this . observedClassDistribution ) ; if ( HB == true ) { // System.out.print("this.saveTheBest"+this.saveTheBest+"\n"); double attributeValue = this . saveTheBest . get ( 3 ) ; double symbol = this . saveTheBest . get ( 2 ) ; // =, <=, > : (0.0, -1.0, 1.0). double value = this . saveTheBest . get ( 0 ) ; // Value of the attribute this . pred = new Predicates ( attributeValue , symbol , value ) ; RuleClassification Rl = new RuleClassification ( ) ; // Create RuleClassification. Rl . predicateSet . add ( pred ) ; this . ruleSet . add ( Rl ) ; if ( Rl . predicateSet . get ( 0 ) . getSymbol ( ) == - 1.0 || Rl . predicateSet . get ( 0 ) . getSymbol ( ) == 1.0 ) { double posClassDouble = this . saveTheBest . get ( 4 ) ; this . ruleClassIndex . setValue ( this . ruleSet . size ( ) - 1 , posClassDouble ) ; } else { this . ruleClassIndex . setValue ( ruleSet . size ( ) - 1 , 0.0 ) ; } this . observedClassDistribution = new DoubleVector ( ) ; this . attributeObservers = new AutoExpandVector < AttributeClassObserver > ( ) ; this . attributeObserversGauss = new AutoExpandVector < AttributeClassObserver > ( ) ; } } }
This function creates a rule