001package javax.visrec.ml.classification; 002 003import java.util.Map; 004 005/** 006 * Generic classifier interface, that all classifiers should implement. Provides 007 * a method to classify instances of some class. Implementations should specify 008 * type of objects (class) that are classified. 009 * 010 * @author Zoran Sevarac 011 * @param <T> type of input objects to classify (eg. User, Product, Transaction, Image, etc.) 012 * @param <R> type of classification result map eg. String is commonly used , but Enum or Boolean as well. 013 * In general Enums should be used when there is a small number of categories and String for more categories. 014 * @since 1.0 015 */ 016@FunctionalInterface 017public interface Classifier<T, R> { 018 019 /** 020 * Classifies specified instance and returns classification results as 021 * map with class names and corresponding classification scores. 022 * 023 * @param input some instance to classify 024 * @return classification results for the specified instance 025 */ 026 public Map<R, Float> classify(T input); 027 028}