NaiveBayesModel { public void validate() { Preconditions.checkState(alphaI > 0, "alphaI has to be greater than 0!"); Preconditions.checkArgument(numFeatures > 0, "the vocab count has to be greater than 0!"); Preconditions.checkArgument(totalWeightSum > 0, "the totalWeightSum has to be greater than 0!"); Preconditions.checkArgument(weightsPerLabel != null, "the number of labels has to be defined!"); Preconditions.checkArgument(weightsPerLabel.getNumNondefaultElements() > 0, "the number of labels has to be greater than 0!"); Preconditions.checkArgument(perlabelThetaNormalizer != null, "the theta normalizers have to be defined"); Preconditions.checkArgument(perlabelThetaNormalizer.getNumNondefaultElements() > 0, "the number of theta normalizers has to be greater than 0!"); Preconditions.checkArgument(weightsPerFeature != null, "the feature sums have to be defined"); Preconditions.checkArgument(weightsPerFeature.getNumNondefaultElements() > 0, "the feature sums have to be greater than 0!"); } NaiveBayesModel(Matrix weightMatrix,
                         Vector weightsPerFeature,
                         Vector weightsPerLabel,
                         Vector thetaNormalizer,
                         float alphaI); double labelWeight(int label); double thetaNormalizer(int label); double featureWeight(int feature); double weight(int label, int feature); float alphaI(); double numFeatures(); double totalWeightSum(); int numLabels(); Vector createScoringVector(); static NaiveBayesModel materialize(Path output, Configuration conf); void serialize(Path output, Configuration conf); void validate();  }
@Test public void testRandomModelGeneration() { NaiveBayesModel model = getModel(); model.validate(); }