public boolean buildingModelTree() { return !regressionTreeOption.isSet(); }
public boolean buildingModelTree() { return !regressionTreeOption.isSet(); }
public boolean normalize() { return !doNotNormalizeOption.isSet(); }
@Override public void getModelDescription(StringBuilder out, int indent) { if(this.anomalyDetectionOption.isSet()){ if(this.Supervised.isSet()){ this.printAnomaliesSupervised(out, indent); // Get Model Description (Supervised method) }else if(this.Unsupervised.isSet()){ this.printAnomaliesUnsupervised(out, indent); // Get Model Description (Unsupervised method) } }else{ this.getModelDescriptionNoAnomalyDetection(out, indent); // Get Model Description no Anomaly detection } }
@Override public void resetLearningImpl() { breadthFirstStrat = breadthFirstStrategyOption.isSet(); negLambda = (1.0 / (double) horizonOption.getValue()) * (Math.log(weightThreshold) / Math.log(2)); maxHeight = maxHeightOption.getValue(); numberDimensions = -1; root = null; timestamp = 0; height = 0; numRootSplits = 0; numberInsertions = 0; }
public void reset(int numClasses) { if (numClasses != 2) { throw new RuntimeException("Too many classes (" + numClasses + "). AUC evaluation can be performed only for two-class problems!"); } this.numClasses = numClasses; this.aucEstimator = new Estimator(this.calculateAUC.isSet()); this.weightMajorityClassifier = new SimpleEstimator(); this.totalObservedInstances = 0; }
protected void VerboseToConsole(Instance inst) { if(VerbosityOption.getValue()>=5){ System.out.println(); System.out.println("I) Dataset: "+inst.dataset().getRelationName()); if(!this.unorderedRulesOption.isSet()){ System.out.println("I) Method Ordered"); }else{ System.out.println("I) Method Unordered"); } } }
protected void VerboseToConsole(MultiLabelInstance inst) { if(VerbosityOption.getValue()>=5){ System.out.println(); System.out.println("I) Dataset: "+inst.dataset().getRelationName()); if(!this.unorderedRulesOption.isSet()){ System.out.println("I) Method Ordered"); }else{ System.out.println("I) Method Unordered"); } } }
protected void VerboseToConsole(MultiLabelInstance inst) { if(VerbosityOption.getValue()>=5){ System.out.println(); System.out.println("I) Dataset: "+inst.dataset().getRelationName()); if(!this.unorderedRulesOption.isSet()){ System.out.println("I) Method Ordered"); }else{ System.out.println("I) Method Unordered"); } } }
boolean CanSearch() { if (IsWinFull() || !waitWinFullOption.isSet()) { if ((GetWindowEnd() - FIRST_OBJ_ID + 1) % m_QueryFreq == 0) { // perform query every m_QueryFreq objects return true; } } return false; }
@Override protected Measurement[] getModelMeasurementsImpl() { Measurement [] measurements=null; if(printWeightsOption.isSet()){ int numWeights=this.layer2Weights.length; measurements= new Measurement[numWeights*(numWeights-1)]; int ct=0; for(int j=0; j<numWeights-1; j++){ for(int i=0; i<numWeights-1; i++){ measurements[ct++]= new Measurement("W Out" + (i+1) + ": Out"+(j+1), layer2Weights[i][j]); } measurements[ct++]= new Measurement("W Bias: Out"+(j+1), layer2Weights[numWeights-1][j]); } } return measurements; }
@Override public double[] getVotesForInstance(Instance inst) { double[] votes = new double[inst.classAttribute().numValues()]; for (int i = 0; i < topK.size(); ++i) { double[] memberVotes = normalize( ensemble[topK.get(i)].getVotesForInstance(inst)); double weight = 1.0; if (weightClassifiersOption.isSet()) { weight = historyTotal[topK.get(i)]; } // make internal classifiers so-called "hard classifiers" votes[maxIndex(memberVotes)] += 1.0 * weight; } return votes; }
@Override public double[] getVotesForInstance(Instance instance) { double[] prediction = this.baseLearner.getVotesForInstance(extendWithOldLabels(instance)); if (this.labelDelayOption.isSet() == true) { // Use predicted Labels to add attributes to instances addOldLabel(Utils.maxIndex(prediction)); } return prediction; }
public void resetLearning() { if (UseMeanScoreOption.isSet()) { threshold = threshholdOption.getValue(); } else { threshold = 0.0; } oScoreK = oScoreKOption.getValue(); confK = confKOption.getValue(); super.resetLearningImpl(); }
@Override public void trainOnInstanceImpl(Instance instance) { this.baseLearner.trainOnInstance(extendWithOldLabels(instance)); if (this.labelDelayOption.isSet() == false) { // Use true old Labels to add attributes to instances addOldLabel(instance.classValue()); } }
@Override public void trainOnInstanceImpl(Instance inst) { for (int i = 0; i < this.ensemble.length; i++) { int k = 1; if ( this.useBaggingOption.isSet()) { k = MiscUtils.poisson(1.0, this.classifierRandom); } if (k > 0) { Instance weightedInst = transformInstance(inst,i); weightedInst.setWeight(inst.weight() * k); this.ensemble[i].trainOnInstance(weightedInst); } } }
@Override public void resetLearningImpl() { this.ensemble = new Classifier[this.ensembleSizeOption.getValue()]; Classifier baseLearner = (Classifier) getPreparedClassOption(this.baseLearnerOption); baseLearner.resetLearning(); for (int i = 0; i < this.ensemble.length; i++) { this.ensemble[i] = baseLearner.copy(); } this.ADError = new ADWIN[this.ensemble.length]; for (int i = 0; i < this.ensemble.length; i++) { this.ADError[i] = new ADWIN((double) this.deltaAdwinOption.getValue()); } this.numberOfChangesDetected = 0; if (this.outputCodesOption.isSet()) { this.initMatrixCodes = true; } }
public double[] getVotesForInstance(Instance inst) { DoubleVector combinedVote = new DoubleVector(); for (int i = 0; i < this.ensemble.length; i++) { DoubleVector vote = new DoubleVector(this.ensemble[i].getVotesForInstance(inst)); if (vote.sumOfValues() > 0.0) { vote.normalize(); if ((this.useWeightOption != null) && this.useWeightOption.isSet()) { vote.scaleValues(1.0 / (this.error[i] * this.error[i])); } combinedVote.addValues(vote); } } return combinedVote.getArrayRef(); }
@Override public double[] getVotesForInstance(Instance inst) { if (this.outputCodesOption.isSet()) { return getVotesForInstanceBinary(inst); } DoubleVector combinedVote = new DoubleVector(); for (int i = 0; i < this.ensemble.length; i++) { DoubleVector vote = new DoubleVector(this.ensemble[i].getVotesForInstance(inst)); if (vote.sumOfValues() > 0.0) { vote.normalize(); combinedVote.addValues(vote); } } return combinedVote.getArrayRef(); }
private Rule newRule(int ID) { Rule r=new Rule.Builder(). threshold(this.pageHinckleyThresholdOption.getValue()). alpha(this.pageHinckleyAlphaOption.getValue()). changeDetection(this.DriftDetectionOption.isSet()). predictionFunction(this.predictionFunctionOption.getChosenIndex()). statistics(new double[3]). id(ID). amRules(this).build(); r.getBuilder().setOwner(r); return r; }