Class ModelUtil


  • public final class ModelUtil
    extends java.lang.Object
    Utility class for handling of MaxentModels.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void addCutoffAndIterations​(java.util.Map<java.lang.String,​java.lang.String> manifestInfoEntries, int cutoff, int iterations)  
      static TrainingParameters createDefaultTrainingParameters()
      Creates the default training parameters in case they are not provided.
      static byte[] read​(java.io.InputStream in)
      Writes the provided InputStream into a byte array which is returned
      static boolean validateOutcomes​(MaxentModel model, java.lang.String... expectedOutcomes)
      Checks if the expected outcomes are all contained as outcomes in the given model.
      static void writeModel​(MaxentModel model, java.io.OutputStream out)
      Writes the given model to the given OutputStream.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • writeModel

        public static void writeModel​(MaxentModel model,
                                      java.io.OutputStream out)
                               throws java.io.IOException,
                                      java.lang.IllegalArgumentException
        Writes the given model to the given OutputStream. This methods does not closes the provided stream.
        Parameters:
        model - the model to be written
        out - the stream the model should be written to
        Throws:
        java.io.IOException
        java.lang.IllegalArgumentException - in case one of the parameters is null
      • validateOutcomes

        public static boolean validateOutcomes​(MaxentModel model,
                                               java.lang.String... expectedOutcomes)
        Checks if the expected outcomes are all contained as outcomes in the given model.
        Parameters:
        model -
        expectedOutcomes -
        Returns:
        true if all expected outcomes are the only outcomes of the model.
      • read

        public static byte[] read​(java.io.InputStream in)
                           throws java.io.IOException
        Writes the provided InputStream into a byte array which is returned
        Parameters:
        in - stream to read data for the byte array from
        Returns:
        byte array with the contents of the stream
        Throws:
        java.io.IOException - if an exception is thrown while reading from the provided InputStream
      • addCutoffAndIterations

        public static void addCutoffAndIterations​(java.util.Map<java.lang.String,​java.lang.String> manifestInfoEntries,
                                                  int cutoff,
                                                  int iterations)
      • createDefaultTrainingParameters

        public static TrainingParameters createDefaultTrainingParameters()
        Creates the default training parameters in case they are not provided. Note: Do not use this method, internal use only!
        Returns:
        training parameters instance