/** * Resets the internal bookkeeping. **/ public void forget() { super.forget(); numClasses = numFeatures = 0; allLabels = null; allExamples = null; weights = null; conjunctiveLabels = false; }
/** * Clears <code>weakLearners</code> and <code>alpha</code>, although this is not necessary since * <code>learn(Object[])</code> will overwrite them fresh each time it is called. **/ public void forget() { super.forget(); weakLearners = null; alpha = null; allExamples = new OVector(); }
/** Resets the weight vector to all zeros. */ public void forget() { super.forget(); weightVector = weightVector.emptyClone(); bias = 0; }
/** Clears the network. */ public void forget() { super.forget(); network = new OVector(); }
/** Clears the network. */ public void forget() { super.forget(); network = new OVector(); }
/** Clears the network. */ public void forget() { super.forget(); network = new OVector(); }
/** * Returns a new, emtpy learner into which all of the parameters that control the behavior of * the algorithm have been copied. Here, "emtpy" means no learning has taken place. **/ public Learner emptyClone() { Learner clone = (Learner) super.clone(); clone.forget(); return clone; }
/** Clears the network. */ public void forget() { super.forget(); network = new OVector(); }
/** * Destroys the learned version of the WEKA classifier and empties the {@link #instances} * collection of examples. **/ public void forget() { super.forget(); try { baseClassifier = weka.classifiers.Classifier.makeCopy(freshClassifier); } catch (Exception e) { System.err.println("LBJava ERROR: WekaWrapper.forget: Can't copy classifier:"); e.printStackTrace(); System.exit(1); } instances = new Instances(name, attributeInfo, 0); instances.setClassIndex(0); trained = false; }
/** * Resets the weight vector to associate the default weight with all features. **/ public void forget() { super.forget(); weightVector = weightVector.emptyClone(); bias = initialWeight; setLabeler(labeler); }
/** * Destroys the learned version of the WEKA classifier and empties the {@link #wekaInstances} * collection of wekaInstances. **/ public void forget() { super.forget(); try { baseClassifier = weka.classifiers.Classifier.makeCopy(freshClassifier); } catch (Exception e) { System.err.println("LBJava ERROR: WekaWrapper.forget: Can't copy classifier:"); e.printStackTrace(); System.exit(1); } lbjavaInstances = new ArrayList<>(); wekaInstances = new Instances(name, attributeInfo, 0); wekaInstances.setClassIndex(0); trained = false; }
messageIndent = messageIndent.substring(2); learner.forget(); if (labelLexicon != null && labelLexicon.size() > 0 && learner.getLabelLexicon().size() == 0)
learner.forget(); if (labelLexicon != null && labelLexicon.size() > 0 && learner.getLabelLexicon().size() == 0)
/** * Resets the weight vector to all zeros. */ public void forget() { super.forget(); if (this.getInputCount() != -1) { this.layerSizes = new int[3]; this.layerSizes[0] = this.getInputCount(); this.layerSizes[1] = this.getHiddenCount(); this.layerSizes[2] = this.getOutputCount(); parameters.layers = new Layer[layerSizes.length-1]; Layer[] l = this.parameters.layers; Random r = new Random (1234); for (int i = 0; i < layerSizes.length-1; i++) { l[i] = new Layer(layerSizes[i], layerSizes[i+1], r); } inputs = new float[l[0].getNumberInputs()]; outputs = new float[l[l.length-1].getNumberOutputs()]; trainer = new SimpleNNTrainer(parameters.layers, parameters.learningRate, parameters.momentum); } }
/** * Reads the binary representation of any type of learner (including the label lexicon, but not * including the feature lexicon), with the option of cutting off the reading process after the * label lexicon and before any learned parameters. When <code>whole</code> is * <code>false</code>, the reading process is cut off in this way. * * <p> * This method is appropriate for reading learners as written by * {@link #write(ExceptionlessOutputStream)}. * * @param in The input stream. * @param whole Whether or not to read the whole model. * @return The learner read from the stream. **/ public static Learner readLearner(ExceptionlessInputStream in, boolean whole) { String name = in.readString(); if (name == null) return null; Learner result = ClassUtils.getLearner(name); result.unclone(); if (whole) result.read(in); // Overridden by decendents else { result.readLabelLexicon(in); // Should not be overridden by decendents Lexicon labelLexicon = result.getLabelLexicon(); result.forget(); result.setLabelLexicon(labelLexicon); } return result; }