presc.report package

presc.report.runner module

class presc.report.runner.Context(store_dir='.')[source]

Bases: object

Persistent data store for sharing report inputs across notebooks.

Note that the store implementation does not support concurrent access. It is up to the caller to ensure that multiple instances each have a unique store location.

store_dir

The dir to contain the data store, implemented as one or more database files. If not specified, defaults to the current working dir.

Type

str

property config
property model
store_inputs(model=None, test_dataset=None, train_dataset=None, config=None)[source]

Write the report inputs to the data store.

Any existing values will be overwritten.

Parameters
property test_dataset
property train_dataset
class presc.report.runner.ReportRunner(output_path='.', execution_path=None, config_filepath=None)[source]

Bases: object

Main entrypoint to run the PRESC report for the given modeling inputs.

The report is written to <output_path>/presc_report. If this dir already exists, it will be overwritten.

To generate the report: ` pr = ReportRunner() pr.run(...) `

The path to the report is accessible as pr.report_html and will open in the default browser by calling pr.open()

output_path

Path to the dir where the report will be written. If not specified, defaults to the current working dir.

Type

str

execution_path

Path from which the report is built. If not specified, a temporary dir is used.

Type

str

config_filepath

Path to a YAML file listing overrides to the default config options.

Type

str

clean()[source]

Remove artifacts from a previous run, if any.

open()[source]

Open the report in the default web browser.

property report_html

The main page of the HTML report.

run(model, test_dataset, train_dataset=None, settings=None, clean=True)[source]

Runs the PRESC report for the given modeling inputs.

The report is written to <output_path>/presc_report. If this dir already exists, it will be overwritten.

Parameters
  • model (presc.model.ClassificationModel) – A pre-trained ClassificationModel instance to evaluate

  • test_dataset (presc.dataset.Dataset) – A test Dataset instance used to evaluate model performance

  • train_dataset (presc.dataset.Dataset) – The Dataset instance used to train the model. This is not required for every evaluation.

  • settings (dict) – A dict specifying option values to override report settings, eg. {“report.title”: “My Report”}.

  • clean (book) – Should previous outputs be cleaned? Default: True