Skip to main content
Help us improve Python packaging – donate today!

No project description provided

Project Description

Build Status Coverage Status PyPI

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 notifications

This version
History Node

2.7.12

History Node

2.7.11

History Node

2.7.10

History Node

2.7.9

History Node

2.6.9

History Node

2.5.9

History Node

2.4.9

History Node

2.4.8

History Node

2.4.7

History Node

2.4.6

History Node

2.4.5

History Node

2.4.4

History Node

2.3.4

History Node

2.2.4

History Node

2.2.3

History Node

2.2.1

History Node

2.1.2

History Node

2.1.1

History Node

2.0.1

History Node

2.0.0

History Node

1.21.14

History Node

1.20.14

History Node

1.19.14

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 the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
featureflow-2.7.12.tar.gz (30.2 kB) Copy SHA256 hash SHA256 Source None Mar 1, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page