Codota Logo
BinaryPerceptronModelWriter.<init>
Code IndexAdd Codota to your IDE (free)

How to use
opennlp.tools.ml.perceptron.BinaryPerceptronModelWriter
constructor

Best Java code snippets using opennlp.tools.ml.perceptron.BinaryPerceptronModelWriter.<init> (Showing top 4 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
FileOutputStream f =
  • Codota IconFile file;new FileOutputStream(file)
  • Codota IconString name;new FileOutputStream(name)
  • Codota IconFile file;new FileOutputStream(file, true)
  • Smart code suggestions by Codota
}
origin: apache/opennlp

private void init(AbstractModel model, DataOutputStream dos) {
 if (model.getModelType() == ModelType.Perceptron) {
  delegateWriter = new BinaryPerceptronModelWriter(model, dos);
 } else if (model.getModelType() == ModelType.Maxent) {
  delegateWriter = new BinaryGISModelWriter(model, dos);
 } else if (model.getModelType() == ModelType.MaxentQn) {
  delegateWriter = new BinaryQNModelWriter(model, dos);
 }
 if (model.getModelType() == ModelType.NaiveBayes) {
  delegateWriter = new BinaryNaiveBayesModelWriter(model, dos);
 }
}
origin: apache/opennlp

@Test
public void testModelSerialization() throws IOException {
 TrainingParameters trainParams = new TrainingParameters();
 trainParams.put(AbstractTrainer.ALGORITHM_PARAM, PerceptronTrainer.PERCEPTRON_VALUE);
 trainParams.put(AbstractTrainer.CUTOFF_PARAM, 1);
 trainParams.put("UseSkippedAveraging", true);
 EventTrainer trainer = TrainerFactory.getEventTrainer(trainParams, null);
 AbstractModel model = (AbstractModel) trainer.train(PrepAttachDataUtil.createTrainingStream());
 PrepAttachDataUtil.testModel(model, 0.773706362961129);
 // serialize and load model, then check if it still works as expected
 ByteArrayOutputStream modelBytes = new ByteArrayOutputStream();
 BinaryPerceptronModelWriter writer = new BinaryPerceptronModelWriter(model,
   new DataOutputStream(modelBytes));
 writer.persist();
 writer.close();
 MaxentModel restoredModel = new BinaryPerceptronModelReader(
   new DataInputStream(new ByteArrayInputStream(modelBytes.toByteArray()))).getModel();
 PrepAttachDataUtil.testModel(restoredModel, 0.773706362961129);
}
origin: ai.idylnlp/idylnlp-opennlp-tools-1.8.3

private void init(AbstractModel model, EncryptedDataOutputStream dos) {
 if (model.getModelType() == ModelType.Perceptron) {
  delegateWriter = new BinaryPerceptronModelWriter(model, dos);
 } else if (model.getModelType() == ModelType.Maxent) {
  delegateWriter = new BinaryGISModelWriter(model, dos);
 } else if (model.getModelType() == ModelType.MaxentQn) {
  delegateWriter = new BinaryQNModelWriter(model, dos);
 }
 if (model.getModelType() == ModelType.NaiveBayes) {
  delegateWriter = new BinaryNaiveBayesModelWriter(model, dos);
 }
}
origin: org.apache.opennlp/opennlp-tools

private void init(AbstractModel model, DataOutputStream dos) {
 if (model.getModelType() == ModelType.Perceptron) {
  delegateWriter = new BinaryPerceptronModelWriter(model, dos);
 } else if (model.getModelType() == ModelType.Maxent) {
  delegateWriter = new BinaryGISModelWriter(model, dos);
 } else if (model.getModelType() == ModelType.MaxentQn) {
  delegateWriter = new BinaryQNModelWriter(model, dos);
 }
 if (model.getModelType() == ModelType.NaiveBayes) {
  delegateWriter = new BinaryNaiveBayesModelWriter(model, dos);
 }
}
opennlp.tools.ml.perceptronBinaryPerceptronModelWriter<init>

Javadoc

Constructor which takes a GISModel and a DataOutputStream and prepares itself to write the model to that stream.

Popular methods of BinaryPerceptronModelWriter

  • close
  • persist

Popular in Java

  • Creating JSON documents from java classes using gson
  • setScale (BigDecimal)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now