Previous topic

Getting started

Next topic

Configurations

This Page

DataContext

class ramp.context.DataContext(store=None, data=None, train_index=None, prep_index=None)

All Ramp analyses require a DataContext. A DataContext represents the environment of the analysis. Most importantly this means for a given store and pandas index value, Ramp will consider the data immutable – it will not check the data again to see if it has changed.

Args

store: An instance of store.Store or a path. If a path
Ramp will default to an HDFPickleStore at that path if PyTables is installed, a PickleStore otherwise. Defaults to MemoryStore.
data: a pandas DataFrame. If all data has been precomputed this
may not be required.
train_index: a pandas Index specifying the data instances to be
used in training. Stored results will be cached against this. If not provided, the entire index of data will be used.
prep_index: a pandas Index specifying the data instances to be
used in prepping (“x” values). Stored results will be cached against this. If not provided, the entire index of data will be used.
load_context(name)

Loads a previously saved context with given name, assigning the stored training and prep indices and returning any stored config.

save_context(name, config=None)

Saves this context (specifically it’s train and prep indices) to it’s store with the given name, along with the config, if provided.