Exemple #1
0
 /**
  * Constructs an atomic model.
  *
  * @param index the index of the atomic model (-1..n), where -1 is special value (used by a single
  *     model or the master divide model) and n is number of divide models.
  * @param features the feature vector used by the atomic model.
  * @param parent the parent guide model.
  * @throws MaltChainedException
  */
 public AtomicModel(int index, FeatureVector features, Model parent) throws MaltChainedException {
   setParent(parent);
   setIndex(index);
   if (index == -1) {
     setModelName(parent.getModelName() + ".");
   } else {
     setModelName(parent.getModelName() + "." + new Formatter().format("%03d", index) + ".");
   }
   setFeatures(features);
   setFrequency(0);
   initMethod();
   if (getGuide().getGuideMode() == ClassifierGuide.GuideMode.BATCH
       && index == -1
       && getGuide().getConfiguration().getConfigurationDir().getInfoFileWriter() != null) {
     try {
       getGuide()
           .getConfiguration()
           .getConfigurationDir()
           .getInfoFileWriter()
           .write(method.toString());
       getGuide().getConfiguration().getConfigurationDir().getInfoFileWriter().flush();
     } catch (IOException e) {
       throw new GuideException("Could not write learner settings to the information file. ", e);
     }
   }
 }
 public String getModelName() throws MaltChainedException {
   try {
     return parent.getModelName();
   } catch (NullPointerException e) {
     throw new GuideException("The parent guide model cannot be found. ", e);
   }
 }