/** * Write all information stored in the classifier builder to the training directory. Typically * called by {@link DataWriter#finish()} or {@link SequenceDataWriter#finish()}. * * @param dir * The directory where classifier information should be written. */ public void saveToTrainingDirectory(File dir) throws IOException { // save the manifest to the directory FileOutputStream manifestStream = new FileOutputStream(getManifestFile(dir)); this.manifest.write(manifestStream); manifestStream.close(); }
/** * Loads a classifier builder from manifest in the training directory. * * @param dir * The training directory where the classifier builder was written by a call to * {@link #saveToTrainingDirectory(File)}. This is typically the same directory as was * used for {@link DirectoryDataWriterFactory#PARAM_OUTPUT_DIRECTORY}. * @return A new classifier builder. */ public static JarClassifierBuilder<?> fromTrainingDirectory(File dir) throws IOException { InputStream stream = new BufferedInputStream(new FileInputStream(getManifestFile(dir))); Manifest manifest = new Manifest(stream); stream.close(); return fromManifest(manifest); }