mlpy.knowledgerep.cbr.similarity.SimilarityFactory.create

static SimilarityFactory.create(_type, **kwargs)[source]

Create a feature of the given type.

Parameters:

_type : str

The feature type. Valid feature types are:

knn

A k-nearest-neighbor algorithm is used to determine similarity between cases (NeighborSimilarity). The value n_neighbors must be specified.

radius-n

Similarity between cases is determined by the nearest neighbors within a radius (NeighborSimilarity). The value radius must be specified.

kmeans

Similarity is determined by a KMeans clustering algorithm (KMeansSimilarity). The value n_clusters must be specified.

exact-match

Only exact matches are considered similar (ExactMatchSimilarity).

cosine

A cosine similarity measure is used to determine similarity between cases (CosineSimilarity).

kwargs : dict, optional

Non-positional arguments to pass to the class of the given type for initialization.

Returns:

ISimilarity :

A similarity instance of the given type.