class FrequencyEncoder extends AbstractDatasetFeatureVectorTransformer {

	@Override
	public FeatureVector apply(FeatureVector featureVector) {
		InstanceBuilder builder = new InstanceBuilder();
		for (String valueName : nominalValueNames) {
			Value value = featureVector.get(valueName);
			NominalValueStatistics valueStats = (NominalValueStatistics) statistics.getValueStatistics(valueName);
			if (!value.isNull()) {
				int count = valueStats.getCount(((NominalValue) value).getString());
				float frequency = (float) count / totalCount;
				builder.set(valueName + FEATURE_SUFFIX, frequency);
			} else if (nullValueStrategy == NullValueStrategy.ASSIGN_FREQUENCY) {
				int count = valueStats.getNumNullValues();
				float frequency = (float) count / totalCount;
				builder.set(valueName + FEATURE_SUFFIX, frequency);
			} else if (nullValueStrategy == NullValueStrategy.KEEP_NULL) {
				builder.setNull(valueName + FEATURE_SUFFIX);
			}
		}
		return new AppendedVector(featureVector, builder.create());
	}

	public  FrequencyEncoder(Dataset dataset);
	public  FrequencyEncoder(Dataset dataset, NullValueStrategy nullValueStrategy);

}