class BarkKmeans(ff.BaseModel): docs = ff.Feature( ff.IteratorNode, store=False) shuffle = ff.NumpyFeature( zounds.ShuffledSamples, nsamples=int(1e6), needs=docs, store=True) unitnorm = ff.PickleFeature( zounds.UnitNorm, needs=shuffle, store=False) kmeans = ff.PickleFeature( zounds.KMeans, centroids=128, needs=unitnorm, store=False) pipeline = ff.PickleFeature( zounds.PreprocessingPipeline, needs=(unitnorm, kmeans), store=True)
class DctKmeansWithLogAmplitude(ff.BaseModel): """ A pipeline that applies a logarithmic weighting to the magnitudes of the spectrum before learning centroids, """ docs = ff.Feature( ff.IteratorNode, store=False) # randomize the order of the data shuffle = ff.NumpyFeature( zounds.ReservoirSampler, nsamples=1e6, needs=docs, store=True) log = ff.PickleFeature( zounds.Log, needs=shuffle, store=False) # give each frame unit norm, since we care about the shape of the spectrum # and not its magnitude unit_norm = ff.PickleFeature( zounds.UnitNorm, needs=log, store=False) # learn 512 centroids, or basis functions kmeans = ff.PickleFeature( zounds.KMeans, centroids=512, needs=unit_norm, store=False) # assemble the previous steps into a re-usable pipeline, which can perform # forward and backward transformations pipeline = ff.PickleFeature( zounds.PreprocessingPipeline, needs=(log, unit_norm, kmeans), store=True)
class Rbm(featureflow.BaseModel, Settings): iterator = featureflow.Feature(Iterator, store=False) shuffle = featureflow.NumpyFeature(ReservoirSampler, nsamples=1000, needs=iterator, store=True) unitnorm = featureflow.PickleFeature(UnitNorm, needs=shuffle, store=False) meanstd = featureflow.PickleFeature(MeanStdNormalization, needs=unitnorm, store=False) rbm = featureflow.PickleFeature(KMeans, centroids=3, needs=meanstd, store=False) pipeline = featureflow.PickleFeature(PreprocessingPipeline, needs=(unitnorm, meanstd, rbm), store=True)
class DctKmeans(ff.BaseModel): """ A pipeline that does example-wise normalization by giving each example unit-norm, and learns 512 centroids from those examples. """ docs = ff.Feature( ff.IteratorNode, store=False) # randomize the order of the data shuffle = ff.NumpyFeature( zounds.ReservoirSampler, nsamples=1e6, needs=docs, store=True) # give each frame unit norm, since we care about the shape of the spectrum # and not its magnitude unit_norm = ff.PickleFeature( zounds.UnitNorm, needs=shuffle, store=False) # learn 512 centroids, or basis functions kmeans = ff.PickleFeature( zounds.KMeans, centroids=512, needs=unit_norm, store=False) # assemble the previous steps into a re-usable pipeline, which can perform # forward and backward transformations pipeline = ff.PickleFeature( zounds.PreprocessingPipeline, needs=(unit_norm, kmeans), store=True)