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 LearningPipeline(ff.BaseModel): samples = ff.PickleFeature(ff.IteratorNode) shuffled = ff.PickleFeature(ShuffledSamples, nsamples=ff.Var('nsamples'), dtype=ff.Var('dtype'), needs=samples)
class FreqAdaptiveAutoEncoder(ff.BaseModel): """ Define a processing pipeline to learn a compressed representation of the Sound.freq_adaptive feature. Once this is trained and the pipeline is stored, we can apply all the pre-processing steps and the autoencoder forward and in reverse. """ docs = ff.Feature(ff.IteratorNode) shuffle = ff.PickleFeature(zounds.ShuffledSamples, nsamples=500000, dtype=np.float32, needs=docs) mu_law = ff.PickleFeature(zounds.MuLawCompressed, needs=shuffle) scaled = ff.PickleFeature(zounds.InstanceScaling, needs=mu_law) autoencoder = ff.PickleFeature( zounds.PyTorchAutoEncoder, trainer=zounds.SupervisedTrainer( AutoEncoder(), loss=nn.MSELoss(), optimizer=lambda model: optim.Adam(model.parameters(), lr=0.00005), epochs=100, batch_size=64, holdout_percent=0.5), needs=scaled) # assemble the previous steps into a re-usable pipeline, which can perform # forward and backward transformations pipeline = ff.PickleFeature(zounds.PreprocessingPipeline, needs=(mu_law, scaled, autoencoder), store=True)
class Model(ff.BaseModel): scaled = ff.PickleFeature(InstanceScaling, max_value=max_value, store=False) pipeline = ff.PickleFeature(PreprocessingPipeline, needs=(scaled, ), store=True)
class Model(ff.BaseModel): flattened = ff.PickleFeature(Reshape, new_shape=new_shape, store=False) pipeline = ff.PickleFeature(PreprocessingPipeline, needs=(flattened, ), store=True)
class Gan(ff.BaseModel): scaled = ff.PickleFeature( InstanceScaling) wgan = ff.PickleFeature( PyTorchGan, trainer=ff.Var('trainer'), needs=scaled)
class Model(ff.BaseModel): meanstd = ff.PickleFeature( MeanStdNormalization, store=False) pipeline = ff.PickleFeature( PreprocessingPipeline, needs=(meanstd,), store=True)
class Model(ff.BaseModel): log = ff.PickleFeature( Log, store=False) pipeline = ff.PickleFeature( PreprocessingPipeline, needs=(log,), store=True)
class Model(ff.BaseModel): multiply = ff.PickleFeature( Multiply, factor=factor, store=False) pipeline = ff.PickleFeature( PreprocessingPipeline, needs=(multiply,), store=True)
class Model(featureflow.BaseModel, Settings): unitnorm = featureflow.PickleFeature(UnitNorm, store=False) binary = featureflow.PickleFeature(Binarize, needs=unitnorm, store=False) pipeline = featureflow.PickleFeature(PreprocessingPipeline, needs=(unitnorm, binary), store=True)
class Model(featureflow.BaseModel, Settings): unitnorm = featureflow.PickleFeature(UnitNorm, store=False) meanstd = featureflow.PickleFeature(MeanStdNormalization, needs=unitnorm, store=False) pipeline = featureflow.PickleFeature(PreprocessingPipeline, needs=(unitnorm, meanstd), store=True)
class Model(featureflow.BaseModel): log = featureflow.PickleFeature(Log, store=False) meanstd = featureflow.PickleFeature(MeanStdNormalization, needs=log, store=False) pipeline = featureflow.PickleFeature(PreprocessingPipeline, needs=(log, meanstd), store=True)
class Model(ff.BaseModel): unitnorm = ff.PickleFeature(UnitNorm, store=False) kmeans = ff.PickleFeature(KMeans, centroids=10, needs=unitnorm, store=False) pipeline = ff.PickleFeature(PreprocessingPipeline, needs=(unitnorm, kmeans), store=True)
class Model(ff.BaseModel): weighted = ff.PickleFeature(Weighted, weighting=AWeighting(), store=False) scaled = ff.PickleFeature(InstanceScaling, needs=weighted, store=False) pipeline = ff.PickleFeature(PreprocessingPipeline, needs=(weighted, scaled), store=True)
class CategoricalAutoEncoderPipeline(ff.BaseModel): samples = ff.PickleFeature(ff.IteratorNode) shuffled = ff.PickleFeature(zounds.ShuffledSamples, nsamples=int(1e5), dtype=np.float32, needs=samples) autoencoder = ff.PickleFeature(zounds.PyTorchAutoEncoder, trainer=ff.Var('trainer'), needs=shuffled) pipeline = ff.PickleFeature(zounds.PreprocessingPipeline, needs=(autoencoder, ), store=True)
class Pipeline(ff.BaseModel): inp = ff.PickleFeature(ff.IteratorNode) samples = ff.PickleFeature(ShuffledSamples, nsamples=500, needs=inp, dtype=np.float32) scaled = ff.PickleFeature(InstanceScaling, needs=samples) network = ff.PickleFeature(PyTorchGan, apply_network='generator', trainer=trainer, needs=scaled) pipeline = ff.PickleFeature(PreprocessingPipeline, needs=(scaled, network), store=True)
class Pipeline(ff.BaseModel): inp = ff.PickleFeature(ff.IteratorNode, store=False) samples = ff.PickleFeature(ShuffledSamples, nsamples=500, dtype=np.float32, needs=inp, store=False) unitnorm = ff.PickleFeature(UnitNorm, needs=samples, store=False) network = ff.PickleFeature(PyTorchAutoEncoder, trainer=trainer, needs=unitnorm, store=False) pipeline = ff.PickleFeature(PreprocessingPipeline, needs=(unitnorm, network), store=True)
class EmbeddingPipeline(BasePipeline, Settings): scaled = ff.PickleFeature(zounds.InstanceScaling, needs=BasePipeline.shuffled) embedding = ff.PickleFeature( zounds.PyTorchNetwork, trainer=ff.Var('trainer'), post_training_func=(lambda x: x[:, anchor_slice]), needs=dict(data=scaled)) unitnorm = ff.PickleFeature(zounds.UnitNorm, needs=embedding) simhash = ff.PickleFeature(zounds.SimHash, bits=ff.Var('bits'), packbits=True, needs=unitnorm) pipeline = ff.PickleFeature(zounds.PreprocessingPipeline, needs=(scaled, embedding, unitnorm, simhash), store=True)
class Gan(ff.BaseModel): samples = ff.PickleFeature(ff.IteratorNode) shuffled = ff.PickleFeature(zounds.ShuffledSamples, nsamples=int(1e5), dtype=np.float32, needs=samples) scaled = ff.PickleFeature(zounds.InstanceScaling, needs=shuffled) wgan = ff.PickleFeature(zounds.PyTorchGan, trainer=ff.Var('trainer'), needs=scaled) pipeline = ff.PickleFeature(zounds.PreprocessingPipeline, needs=( scaled, wgan, ), 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 RichardNixonIdentifier(ff.BaseModel): docs = ff.PickleFeature(ff.IteratorNode, store=False) shuffled = ff.PickleFeature(zounds.ShuffledSamples, nsamples=int(1e5), multiplexed=True, dtype=np.float32, needs=docs, store=False) mu_law_source = ff.PickleFeature(zounds.MuLawCompressed, needs=shuffled.aspect('data'), store=False) scaled_source = ff.PickleFeature(zounds.InstanceScaling, needs=mu_law_source, store=False) network = ff.PickleFeature( zounds.PyTorchNetwork, trainer=zounds.SupervisedTrainer( model=Discriminator(), loss=nn.BCELoss(), optimizer=lambda model: optim.Adam(model.parameters(), lr=0.00005), epochs=epochs, batch_size=64, holdout_percent=0.5), needs=dict(data=scaled_source, labels=shuffled.aspect('labels')), store=False) pipeline = ff.PickleFeature(zounds.PreprocessingPipeline, needs=(mu_law_source, scaled_source, network), store=True)
class Pipeline(ff.BaseModel): inp = ff.PickleFeature(ff.IteratorNode, store=False) samples = ff.PickleFeature(ShuffledSamples, nsamples=500, multiplexed=True, dtype=np.float32, needs=inp, store=False) unitnorm = ff.PickleFeature(UnitNorm, needs=samples.aspect('data'), store=False) hard_labels = ff.PickleFeature(Binarize, needs=samples.aspect('labels'), store=False) network = ff.PickleFeature(PyTorchNetwork, trainer=trainer, needs=dict(data=unitnorm, labels=hard_labels), store=False) pipeline = ff.PickleFeature(PreprocessingPipeline, needs=(unitnorm, network), 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)
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 GanPipeline(ff.BaseModel): docs = ff.PickleFeature(ff.IteratorNode, store=False) shuffled = ff.PickleFeature(zounds.ShuffledSamples, nsamples=int(1e5), dtype=np.float32, needs=docs, store=False) mu_law = ff.PickleFeature(zounds.MuLawCompressed, needs=shuffled, store=False) scaled = ff.PickleFeature(zounds.InstanceScaling, needs=mu_law, store=False) network = ff.PickleFeature( zounds.PyTorchGan, trainer=zounds.GanTrainer( generator=Generator(), discriminator=Discriminator(), loss=nn.BCELoss(), generator_optim_func=lambda model: optim.Adam( model.parameters(), lr=0.0002, betas=(0.5, 0.999)), discriminator_optim_func=lambda model: optim.Adam( model.parameters(), lr=0.00005, betas=(0.5, 0.999)), latent_dimension=(LATENT_DIM, ), epochs=500, batch_size=64), needs=scaled, store=False) pipeline = ff.PickleFeature(zounds.PreprocessingPipeline, needs=(mu_law, scaled, network), store=True)
class SimHashPipelineWithPackedBits(ff.BaseModel): simhash = ff.PickleFeature(SimHash, packbits=True, bits=1024) pipeline = ff.PickleFeature(PreprocessingPipeline, needs=(simhash, ), store=True)
class SimHashPipeline(ff.BaseModel): simhash = ff.PickleFeature(SimHash, bits=128) pipeline = ff.PickleFeature(PreprocessingPipeline, needs=(simhash, ), store=True)
class Model(ff.BaseModel): sliced = ff.PickleFeature(Slicer, slicex=slicex, store=False) pipeline = ff.PickleFeature(PreprocessingPipeline, needs=(sliced, ), store=True)
class Document(ff.BaseModel): l = ff.PickleFeature(SklearnModel, model=MockSklearnModel()) pipeline = ff.PickleFeature(PreprocessingPipeline, needs=(l, ), store=True)
class Model(ff.BaseModel): unitnorm = ff.PickleFeature(UnitNorm, store=False) pipeline = ff.PickleFeature(PreprocessingPipeline, needs=(unitnorm, ), store=True)