so4gp.gradual_patterns.GP

class GP[source]

GP (Gradual Pattern). A class that is used to create GP objects. A GP object is a set of gradual items (GI), and its quality is measured by its computed support value. For example, given a data set with 3 columns (age, salary, cars) and 10 objects. A GP may take the form: {age+, salary-} with a support of 0.8. This implies that 8 out of 10 objects have the values of column age ‘increasing’ and column ‘salary’ decreasing.

>>> import so4gp as sgp
>>> gradual_pattern = sgp.GP()
>>> gradual_pattern.add_gradual_item(sgp.GI(0, "+"))
>>> gradual_pattern.add_gradual_item(sgp.GI(1, "-"))
>>> gradual_pattern.support = 0.5
>>> print(f"{gradual_pattern.to_string()}: {gradual_pattern.support}")
__init__()[source]

GP (Gradual Pattern). A class that is used to create GP objects. A GP object is a set of gradual items (GI), and its quality is measured by its computed support value. For example, given a data set with 3 columns (age, salary, cars) and 10 objects. A GP may take the form: {age+, salary-} with a support of 0.8. This implies that 8 out of 10 objects have the values of column age ‘increasing’ and column ‘salary’ decreasing.

>>> import so4gp as sgp
>>> gradual_pattern = sgp.GP()
>>> gradual_pattern.add_gradual_item(sgp.GI(0, "+"))
>>> gradual_pattern.add_gradual_item(sgp.GI(1, "-"))
>>> gradual_pattern.support = 0.5
>>> print(f"{gradual_pattern.to_string()}: {gradual_pattern.support}")

Methods

__init__()

GP (Gradual Pattern).

add_gradual_item(item)

Adds a gradual item (GI) into the gradual pattern (GP) :param item: gradual item

check_am(gp_list[, subset])

Anti-monotonicity check.

compute_descriptors(warping_set, obj_count)

Computes gradual warping set (GWS) descriptors for a given gradual pattern.

contains_attr(gi)

Checks if any gradual item (GI) in the gradual pattern (GP) is composed of the column :param gi: gradual item :type gi: GI

decompose()

Breaks down all the gradual items (GIs) in the gradual pattern into columns and variation symbols and returns them as separate variables.

get_computed_descriptors(descriptor_title)

Returns the computed descriptors of the gradual pattern (GP)

is_duplicate(valid_gps[, invalid_gps])

Checks if a pattern is in the list of winner GPs or loser GPs

perform_and(bin_data_1, bin_data_2, dim)

Perform logical AND operation on two bitmaps.

print(columns[, descriptor_title])

A method that returns patterns with actual column names

swap_gp_symbols(gp_obj)

Swaps the variation symbols of all the gradual items (GIs) in a gradual pattern (GP)

to_string()

Returns the GP in string format :return: string

validate_graank(d_gp)

Validates a candidate gradual pattern (GP) based on support computation.

validate_tree(d_gp)

Validates a candidate gradual pattern (GP) based on support computation.

Attributes

as_set

{'1+', '2-'}

as_swapped_set

{'1-', '2+'}

avg_deviation_from_diagonal

density

gradual_items

graph_connectivity

rank_dispersion

singularity_score

support