@Override public void resetLearningImpl() { this.kernels = new ClustreamKernel[maxNumKernelsOption.getValue()]; this.timeWindow = timeWindowOption.getValue(); this.initialized = false; this.buffer = new LinkedList<ClustreamKernel>(); this.bufferSize = maxNumKernelsOption.getValue(); t = kernelRadiFactorOption.getValue(); m = maxNumKernelsOption.getValue(); }
@Override public void setRandomSeed(int s) { this.randomSeed = s; if (this.randomSeedOption != null) { // keep option consistent this.randomSeedOption.setValue(s); } }
@Override public void setValueViaCLIString(String s) { setValue(cliStringToInt(s)); }
/** * Checks if the memory limit is exceeded and if so prunes the classifiers in the ensemble. */ protected void enforceMemoryLimit() { double memoryLimit = this.maxByteSizeOption.getValue() / (double) (this.learners.length + 1); for (int i = 0; i < this.learners.length; i++) { ((HoeffdingTree) this.learners[(int) this.weights[i][1]]).maxByteSizeOption.setValue((int) Math .round(memoryLimit)); ((HoeffdingTree) this.learners[(int) this.weights[i][1]]).enforceTrackerLimit(); } }
/** * Creates an classifier and setups the random seed option * if the classifier is randomizable. */ public AbstractClassifier() { if (isRandomizable()) { this.randomSeedOption = new IntOption("randomSeed", 'r', "Seed for random behaviour of the classifier.", 1); } }
fileProgressMonitor = new InputStreamProgressMonitor(fileStream); fileReader = new BufferedReader(new InputStreamReader(fileProgressMonitor)); instances = new Instances(fileReader, 1, this.classIndexOption.getValue()); if (classIndexOption.getValue() < 0) { instances.setClassIndex(instances.numAttributes() - 1); } else if (classIndexOption.getValue() > 0) { instances.setClassIndex(classIndexOption.getValue() - 1); Option[] rawAttributeList = removeAttributesOption.getList(); for (int i = 0; i < rawAttributeList.length; i++) { int attribute = ((IntOption)rawAttributeList[i]).getValue(); if(1 <= attribute && attribute <= instances.numAttributes()) attributes.add(attribute-1); numAttsOption = new IntOption("numAtts", 'a',"", instances.numAttributes() - removeAttributes.length);
@Override public String getValueAsCLIString() { return intToCLIString(this.currentVal); }
public IntOption(String name, char cliChar, String purpose, int defaultVal, int minVal, int maxVal) { super(name, cliChar, purpose); this.defaultVal = defaultVal; this.minVal = minVal; this.maxVal = maxVal; resetToDefault(); }
public void setValue(int v) { if (v < this.minVal) { throw new IllegalArgumentException("Option " + getName() + " cannot be less than " + this.minVal + ", out of range: " + v); } if (v > this.maxVal) { throw new IllegalArgumentException("Option " + getName() + " cannot be greater than " + this.maxVal + ", out of range: " + v); } this.currentVal = v; }
@Override public void setEditState(String cliString) { this.spinner.setValue(IntOption.cliStringToInt(cliString)); } }
/** * Creates an classifier and setups the random seed option if the classifier is randomizable. */ public AbstractClassifier() { if (isRandomizable()) { this.randomSeedOption = new IntOption("randomSeed", 'r', "Seed for random behaviour of the classifier.", 1); } }
/** * Checks if the memory limit is exceeded and if so prunes the classifiers in the ensemble. */ protected void enforceMemoryLimit() { double memoryLimit = this.maxByteSizeOption.getValue() / (double) (this.ensemble.length + 1); for (int i = 0; i < this.ensemble.length; i++) { ((HoeffdingTree) this.ensemble[(int) this.weights[i][1]].classifier).maxByteSizeOption.setValue((int) Math .round(memoryLimit)); ((HoeffdingTree) this.ensemble[(int) this.weights[i][1]].classifier).enforceTrackerLimit(); } }
@Override public String getValueAsCLIString() { return intToCLIString(this.currentVal); }
public IntOption(String name, char cliChar, String purpose, int defaultVal, int minVal, int maxVal) { super(name, cliChar, purpose); this.defaultVal = defaultVal; this.minVal = minVal; this.maxVal = maxVal; resetToDefault(); }
public void setValue(int v) { if (v < this.minVal) { throw new IllegalArgumentException("Option " + getName() + " cannot be less than " + this.minVal + ", out of range: " + v); } if (v > this.maxVal) { throw new IllegalArgumentException("Option " + getName() + " cannot be greater than " + this.maxVal + ", out of range: " + v); } this.currentVal = v; }
@Override public void resetLearningImpl() { this.kernels = new ClustreamKernel[maxNumKernelsOption.getValue()]; this.timeWindow = timeWindowOption.getValue(); this.initialized = false; this.buffer = new LinkedList<>(); this.bufferSize = maxNumKernelsOption.getValue(); t = kernelRadiFactorOption.getValue(); m = maxNumKernelsOption.getValue(); }
public void setRandomSeed(int s) { this.randomSeed = s; if (this.randomSeedOption != null) { // keep option consistent this.randomSeedOption.setValue(s); } }
/** * Creates an classifier and setups the random seed option if the classifier is randomizable. */ public AbstractClassifier() { if (isRandomizable()) { this.randomSeedOption = new IntOption("randomSeed", 'r', "Seed for random behaviour of the classifier.", 1); } }
@Override public void prepareForUseImpl(TaskMonitor monitor, ObjectRepository repository) { this.inputStream = (InstanceStream) getPreparedClassOption(this.streamOption); this.driftStream = (InstanceStream) getPreparedClassOption(this.driftstreamOption); this.random = new Random(this.randomSeedOption.getValue()); numberInstanceStream = 0; if (this.alphaOption.getValue() != 0.0) { this.widthOption.setValue((int) (1 / Math.tan(this.alphaOption.getValue() * Math.PI / 180))); } }