slang.snippers

Snipping: Feature vector quantization

class slang.snippers.ClassificationSnipper(wf_to_chks=<slang.snippers.DfltWfToChk object>, chk_to_fv=<class 'slang.snippers.PcaChkToFv'>, fv_to_snip=<class 'slang.snippers.KMeansFvToSnip'>, snip_to_score=<class 'slang.snip_stats.BayesFactors'>)[source]
slang.snippers.DfltChkToFv

alias of slang.snippers.PcaChkToFv

slang.snippers.DfltFvToSnip

alias of slang.snippers.KMeansFvToSnip

class slang.snippers.FittableSnipper(wf_to_chks=None, chk_to_fv=None, fv_to_snip=None)[source]
class slang.snippers.KMeansFvToSnip(n_clusters=47, **kwargs)[source]
fit(fvs: NewType.<locals>.new_type, y=None, sample_weight=None)[source]

Compute k-means clustering.

Parameters
  • X ({array-like, sparse matrix} of shape (n_samples, n_features)) – Training instances to cluster. It must be noted that the data will be converted to C ordering, which will cause a memory copy if the given data is not C-contiguous. If a sparse matrix is passed, a copy will be made if it’s not in CSR format.

  • y (Ignored) – Not used, present here for API consistency by convention.

  • sample_weight (array-like of shape (n_samples,), default=None) –

    The weights for each observation in X. If None, all observations are assigned equal weight.

    New in version 0.20.

Returns

self – Fitted estimator.

Return type

object

property fv_of_snip

array providing representative fv for each snip

fvs_to_snip_distance_pairs(fvs: NewType.<locals>.new_type)[source]

iterator of (snip, distance_to_snip_centroid) pairs

class slang.snippers.KMeansFvToSnipDist(n_clusters=47, **kwargs)[source]
class slang.snippers.LdaChkToFv(n_components=5, **kwargs)[source]
class slang.snippers.PcaChkToFv(n_components=5, **kwargs)[source]
slang.snippers.SlangClassifier

alias of slang.snippers.ClassificationSnipper

slang.snippers.is_iterable(x)[source]

Similar in nature to callable(), is_iterable returns True if an object is `iterable`_, False if not. >>> is_iterable([]) True >>> is_iterable(1) False