This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

UNKNOWN

Project Description

featureflow

featureflow is a python library that allows users to build feature extraction pipelines in a declarative way, and store the results for later use

Usage

The following example computes word frequency in a text document, but featureflow isn’t limited to text data. It’s designed to work well with sequential data (e.g. audio or video) that may be processed iteratively, in smaller chunks.

Given a simple feature-extraction pipeline like this one:

import featureflow as ff

class Settings(ff.PersistenceSettings):
    id_provider = ff.UuidProvider()
    key_builder = ff.StringDelimitedKeyBuilder()
    database = ff.InMemoryDatabase(key_builder=key_builder)

class Document(ff.BaseModel, ff.PersistenceSettings):
    raw = ff.ByteStreamFeature(
            ff.ByteStream,
            chunksize=128,
            store=True)

    tokens = ff.Feature(
            Tokenizer,
            needs=raw,
            store=False)

    counts = ff.JSONFeature(
            WordCount,
            needs=tokens,
            store=True)

You can process a text document, and access the results:

if __name__ == '__main__':
    _id = Document.process(raw='http://www.something.com/something.txt')
    doc = Document(_id)
    print '"workers" appears {workers} times'.format(**doc.counts)

Your code focuses on data transformations, and leaves orchestration and persistence up to featureflow:

import featureflow as ff

class Tokenizer(ff.Node):
    def __init__(self, needs=None):
        super(Tokenizer, self).__init__(needs=needs)
        self._cache = ''
        self._pattern = re.compile('(?P<word>[a-zA-Z]+)\W+')

    def _enqueue(self, data, pusher):
        self._cache += data

    def _dequeue(self):
        matches = list(self._pattern.finditer(self._cache))
        if not matches:
            raise ff.NotEnoughData()
        self._cache = self._cache[matches[-1].end():]
        return map(lambda x: x.groupdict()['word'].lower(), matches)

    def _process(self, data):
        yield data


class WordCount(ff.Aggregator, ff.Node):
    def __init__(self, needs=None):
        super(WordCount, self).__init__(needs=needs)
        self._cache = Counter()

    def _enqueue(self, data, pusher):
        self._cache.update(data)

Installation

Python headers are required. You can install by running:

apt-get install python-dev

Numpy is optional. If you’d like to use it, the Anaconda distribution is highly recommended.

Finally, just

pip install featureflow
Release History

Release History

This version
History Node

1.17.14

History Node

1.16.14

History Node

1.16.13

History Node

1.16.12

History Node

1.16.11

History Node

1.16.10

History Node

1.15.10

History Node

1.14.10

History Node

1.13.10

History Node

1.12.10

History Node

1.11.10

History Node

1.10.10

History Node

1.9.10

History Node

1.8.10

History Node

1.8.9

History Node

0.8.9

History Node

0.7.9

History Node

0.6.9

History Node

0.5.9

History Node

0.5.8

History Node

0.5.6

History Node

0.5.5

History Node

0.5.4

History Node

0.5.1

History Node

0.4.1

History Node

0.3

History Node

0.2

History Node

0.1

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
featureflow-1.17.14.tar.gz (26.1 kB) Copy SHA256 Checksum SHA256 Source Jun 24, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting