Skip to main content

A simple co-training library built on Keras.

Project description

A simple co-training library built with Keras.

  • Free software: MIT license

Installation

Before installing simple-co-train, please install one of Keras’ backend engines: TensorFlow, Theano, or CNTK.

pip install simple-co-train

Documentation

Basic usage:

from sctrain import CoTrainer, SelectionStrategy
from sctrain.results import print_results

trainer = CoTrainer(
    data_path='imdb.csv',  # this can be a directory, e.g. 'data'
    x_name='review',  # optional, defaults to 'text'
    y_name='sentiment',  # optional, defaults to 'label'
    unlabelled_size=0.9, # optional, what portion of total data should be used as unlabelled
    train_size=0.8, # optional, what portion of labelled data should be used as training data
    mapping={'negative': 0, 'positive': 1}  # optional mapping, y column must be 0 or 1
    selection = SelectionStrategy.UNSURE_ONLY # optional, can be CONFIDENT_ONLY or BOTH
)
# run the co-training, this may take a while...
trainer.run()
# print out accuracy, f1 score, precision, recall, and labelled samples at each co-training round
print_results(trainer)

Development

To run the all tests run:

tox

Note, to combine the coverage data from all the tox environments run:

Windows
set PYTEST_ADDOPTS=--cov-append
tox
Other
PYTEST_ADDOPTS=--cov-append tox

Changelog

0.1.0 (2020-05-07)

  • First release on PyPI.

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 simple-co-train, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size simple_co_train-1.0.0-py2.py3-none-any.whl (10.0 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size simple-co-train-1.0.0.tar.gz (14.9 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