Skip to main content

Feature collections for DossierStack

Project description

`dossier.fc` is a Python package that provides an implementation of feature
collections. Abstractly, a feature collection is a map from feature name to
a feature. While any type of feature can be supported, the core focus of this
package is on *multisets* or "bags of words" (BOW). In this package, the
default multiset implementation is a `StringCounter`, which maps Unicode
strings to counts.

This package also includes utilities for serializing and deserializating
collections of feature collections to CBOR (Concise Binary Object

### Installation

`dossier.fc` is on PyPI and can be installed with `pip`:

pip install dossier.fc

Currently, `dossier.fc` requires Python 2.7. It is not yet Python 3 compatible.

### Documentation

API documentation with examples is available as part of the Dossier Stack

### Examples and basic usage

By default, feature collections use `StringCounter` for feature representation:

from dossier.fc import FeatureCollection

fc = FeatureCollection()
fc['NAME']['alice'] += 1
fc['NAME']['bob'] = 5

print type(fc['NAME'])
# output: StringCounter

As the name suggests, a `StringCounter` is a subclass of the `Counter` class
found in the Python standard library `collections` module. As such, it supports
binary operations like addition, subtraction, equality testing, etc.
The `FeatureCollection` class also provides these binary operations which are
performed on corresponding features. For example:

from dossier.fc import FeatureCollection

fc1 = FeatureCollection({'NAME': {'alice': 1, 'bob': 1}})
fc2 = FeatureCollection({'NAME': {'alice': 1}})
fc3 = fc1 + fc2

assert fc3 == FeatureCollection({'NAME': {'alice': 2, 'bob': 1}})

Project details

Download files

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

Files for dossier.fc, version 0.3.5
Filename, size File type Python version Upload date Hashes
Filename, size dossier.fc-0.3.5-py2.7.egg (76.4 kB) File type Egg Python version 2.7 Upload date Hashes View
Filename, size dossier.fc-0.3.5.tar.gz (24.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page