class NaiveBayesClassifier implements Classifier<NaiveBayesModel> {

    @Override
    public CategoryEntries classify(FeatureVector featureVector, NaiveBayesModel model) {

        CategoryEntriesBuilder categoryEntriesBuilder = new CategoryEntriesBuilder();

        for (String category : model.getCategories()) {

            // initially set all category probabilities to their priors
            double probability = model.getPrior(category);
            if (logSpace) {
            	probability = Math.log(probability);
            }
            
            for (String featureName : model.getLearnedFeatures()) {
                Value value = featureVector.get(featureName);
                if (value instanceof NominalValue) {
                    String nominalValue = ((NominalValue)value).getString();
                    double currentProbability = model.getProbability(featureName, nominalValue, category, laplace);
					if (logSpace) {
                    	probability += Math.log(currentProbability);
                    } else {
                    	probability *= currentProbability;
                    }
                } else if (value instanceof NumericValue) {
                    double doubleValue = ((NumericValue)value).getDouble();
                    double density = model.getDensity(featureName, doubleValue, category);
                    if (density > 0) {
                    	if (logSpace) {
                    		probability += Math.log(density);
                    	} else {
                    		probability *= density;
                    	}
                    }
                }
            }
            categoryEntriesBuilder.set(category, probability);
        }

        return categoryEntriesBuilder.create();
    }

    public  NaiveBayesClassifier();
    public  NaiveBayesClassifier(double laplaceCorrector);
    public  NaiveBayesClassifier(double laplaceCorrector, boolean logSpace);

}