gpsea.analysis.predicate package

class gpsea.analysis.predicate.PolyPredicate[source]

Bases: Generic[C], Partitioning

PolyPredicate partitions a Patient into one of several discrete groups represented by a Categorization.

The groups must be exclusive - the patient can be binned into one and only one group, and exhaustive - the groups must cover all possible scenarios.

However, if the patient cannot be assigned into any meaningful category, None can be returned. As a rule of thumb, returning None will exclude the patient from the analysis.

abstract get_categorizations() Sequence[C][source]

Get a sequence of all categories which the predicate can produce.

get_categories() Iterator[PatientCategory][source]

Get an iterator with PatientCategory instances that the predicate can produce.

property group_labels: Collection[str]

Get a collection with names of the PatientCategory items that the predicate can produce.

summarize_groups() str[source]
summarize(out: TextIO)[source]

Summarize the predicate into the out handle.

The summary includes the name, summary, and the groups the predicate can assign individuals into.

n_categorizations() int[source]

Get the number of categorizations the predicate can produce.

get_category(cat_id: int) PatientCategory[source]

Get the category name for a PatientCategory.cat_id.

Parameters:

cat_id – an int with the id.

Raises:

ValueError if there is no such category was defined.

get_category_name(cat_id: int) str[source]

Get the category name for a PatientCategory.cat_id.

Parameters:

cat_id – an int with the id.

Raises:

ValueError if there is no such category was defined.

abstract test(patient: Patient) C | None[source]

Assign a patient into a categorization.

Return None if the patient cannot be assigned into any meaningful category.

Subpackages