@Test public void testInvalidTrainer() { mlParams.put(TrainingParameters.ALGORITHM_PARAM, "xyz"); Assert.assertFalse(TrainerFactory.isValid(mlParams)); }
public static boolean isValid(TrainingParameters trainParams) { String algorithmName = trainParams.getStringParameter(AbstractTrainer.ALGORITHM_PARAM,null); if (algorithmName != null && !(BUILTIN_TRAINERS.containsKey(algorithmName) || getTrainerType(trainParams) != null)) { return false; } try { trainParams.getIntParameter(AbstractTrainer.CUTOFF_PARAM, 0); trainParams.getIntParameter(AbstractTrainer.ITERATIONS_PARAM, 0); } catch (NumberFormatException e) { return false; } trainParams.getStringParameter(AbstractEventTrainer.DATA_INDEXER_PARAM, null); return true; }
TrainerFactory { public static boolean isValid(TrainingParameters trainParams) { String algorithmName = trainParams.getStringParameter(AbstractTrainer.ALGORITHM_PARAM,null); if (algorithmName != null && !(BUILTIN_TRAINERS.containsKey(algorithmName) || getTrainerType(trainParams) != null)) { return false; } try { trainParams.getIntParameter(AbstractTrainer.CUTOFF_PARAM, 0); trainParams.getIntParameter(AbstractTrainer.ITERATIONS_PARAM, 0); } catch (NumberFormatException e) { return false; } trainParams.getStringParameter(AbstractEventTrainer.DATA_INDEXER_PARAM, null); return true; } }
TrainerFactory { public static boolean isValid(TrainingParameters trainParams) { String algorithmName = trainParams.getStringParameter(AbstractTrainer.ALGORITHM_PARAM,null); if (algorithmName != null && !(BUILTIN_TRAINERS.containsKey(algorithmName) || getTrainerType(trainParams) != null)) { return false; } try { trainParams.getIntParameter(AbstractTrainer.CUTOFF_PARAM, 0); trainParams.getIntParameter(AbstractTrainer.ITERATIONS_PARAM, 0); } catch (NumberFormatException e) { return false; } trainParams.getStringParameter(AbstractEventTrainer.DATA_INDEXER_PARAM, null); return true; }  }
TrainerFactory { public static boolean isValid(TrainingParameters trainParams) { String algorithmName = trainParams.getStringParameter(AbstractTrainer.ALGORITHM_PARAM,null); if (algorithmName != null && !(BUILTIN_TRAINERS.containsKey(algorithmName) || getTrainerType(trainParams) != null)) { return false; } try { trainParams.getIntParameter(AbstractTrainer.CUTOFF_PARAM, 0); trainParams.getIntParameter(AbstractTrainer.ITERATIONS_PARAM, 0); } catch (NumberFormatException e) { return false; } trainParams.getStringParameter(AbstractEventTrainer.DATA_INDEXER_PARAM, null); return true; }  static TrainerType getTrainerType(TrainingParameters trainParams); static SequenceTrainer getSequenceModelTrainer(TrainingParameters trainParams,
      Map<String, String> reportMap); static EventModelSequenceTrainer getEventModelSequenceTrainer(TrainingParameters trainParams,
      Map<String, String> reportMap); static EventTrainer getEventTrainer(TrainingParameters trainParams,
      Map<String, String> reportMap); static boolean isValid(TrainingParameters trainParams); }
TrainerFactory { public static boolean isValid(TrainingParameters trainParams) { String algorithmName = trainParams.getStringParameter(AbstractTrainer.ALGORITHM_PARAM,null); if (algorithmName != null && !(BUILTIN_TRAINERS.containsKey(algorithmName) || getTrainerType(trainParams) != null)) { return false; } try { trainParams.getIntParameter(AbstractTrainer.CUTOFF_PARAM, 0); trainParams.getIntParameter(AbstractTrainer.ITERATIONS_PARAM, 0); } catch (NumberFormatException e) { return false; } trainParams.getStringParameter(AbstractEventTrainer.DATA_INDEXER_PARAM, null); return true; }  static TrainerType getTrainerType(TrainingParameters trainParams); static SequenceTrainer getSequenceModelTrainer(TrainingParameters trainParams,
      Map<String, String> reportMap); static EventModelSequenceTrainer getEventModelSequenceTrainer(TrainingParameters trainParams,
      Map<String, String> reportMap); static EventTrainer getEventTrainer(TrainingParameters trainParams,
      Map<String, String> reportMap); static boolean isValid(TrainingParameters trainParams);  }