NaiveBayesModel { public static void validate(NaiveBayesModel model) { if (model == null) { return; } if (model.getAlphaI() <= 0) { throw new IllegalArgumentException( "Error: AlphaI has to be greater than 0!"); } if (model.getVocabCount() <= 0) { throw new IllegalArgumentException( "Error: The vocab count has to be greater than 0!"); } if (model.getVocabCount() <= 0) { throw new IllegalArgumentException( "Error: The vocab count has to be greater than 0!"); } if (model.getTotalSum() <= 0) { throw new IllegalArgumentException( "Error: The vocab count has to be greater than 0!"); } if (model.getLabelSum() == null || model.getLabelSum().getNumNondefaultElements() <= 0) { throw new IllegalArgumentException( "Error: The number of labels has to be greater than 0 or defined!"); } if (model.getPerlabelThetaNormalizer() == null || model.getPerlabelThetaNormalizer().getNumNondefaultElements() <= 0) { throw new IllegalArgumentException( "Error: The number of theta normalizers has to be greater than 0 or defined!"); } if (model.getFeatureSum() == null || model.getFeatureSum().getNumNondefaultElements() <= 0) { throw new IllegalArgumentException( "Error: The number of features has to be greater than 0 or defined!"); } } private  NaiveBayesModel();  NaiveBayesModel(Matrix matrix, Vector featureSum, Vector labelSum, Vector thetaNormalizer, float alphaI); void setPerlabelThetaNormalizer(Vector perlabelThetaNormalizer); void setFeatureSum(Vector featureSum); void setWeightMatrix(Matrix weightMatrix); void setAlphaI(float alphaI); void setVocabCount(double vocabCount); void setTotalSum(double totalSum); Vector getLabelSum(); Vector getPerlabelThetaNormalizer(); Vector getFeatureSum(); Matrix getWeightMatrix(); float getAlphaI(); double getVocabCount(); double getTotalSum(); int getNumLabels(); static String getModelName(); static NaiveBayesModel fromMRTrainerOutput(Path output, Configuration conf); static void validate(NaiveBayesModel model);  }
@Test public void testRandomModelGeneration() { NaiveBayesModel model = getModel(); NaiveBayesModel.validate(model); }