__init__(self,
items,
similarities,
symmetric=False,
minimal_similarity=None)
(Constructor)
|
|
x.__init__(...) initializes x; see x.__class__.__doc__ for
signature
- Parameters:
items (sequence) - a sequence of data items
similarities - similarity values for item pairs. This parameter can have one of
three forms:
-
a list if triples (index1, index2, similarity), where the
indices point into the item list and the similarity is a real
number.
-
a callable object (typically a function or a bound method)
that is called with two items and returns the similarity.
-
an array of shape (N, N), where N is the number of items,
containing the similarities. The diagonal elements are not
used.
symmetric (bool ) - if True , the similarity measure is assumed to be
symmetric. If False , no such assumption is made and
the input data (if a list) must contain both directions for each
pair. If the similarity is defined by a function, it will be
called twice of symmtric=False and once if symmetric=True. If the
similarity is defined by an array, this parameter is not used.
minimal_similarity (float ) - a cutoff value for the similarities; values smaller than this
cutoff are discarded. This is of use for large data sets because
both the runtime and the memory consumption increase with the
number of similarity values.
- Overrides:
object.__init__
|