so4gp.gradual_patterns.GI¶
- class GI(attr_col, symbol)[source]¶
- Parameters:
attr_col (int) – Column index
symbol (str) – Variation symbol either “+” or “-”
- __init__(attr_col, symbol)[source]¶
GI (Gradual Item). A class that is used to create GI objects. A GI is a pair (i,v) where is a column, and v is a variation symbol - increasing/decreasing. Each column of a data set yields 2 GIs; for example, column age yields GI age+ or age-.
>>> import so4gp as sgp >>> gradual_item = sgp.GI(1, "+") >>> print(gradual_item.to_string()) 1+
- Parameters:
attr_col (int) – Column index
symbol (str) – Variation symbol either “+” or “-”
Methods
__init__(attr_col, symbol)GI (Gradual Item).
from_string(gi_str)Creates a GI from a string like '1+', '12-', or '125+'
parse_gi(gi_str)Converts a stringified GI into normal GI.
swap_gi_symbol(gi_obj)Inverts a GI symbol to the opposite variation (i.e., from - to +; or, from + to -) :return: inverted GI object
to_string()Returns a GI in string format :return: string
Attributes
as_tupleThe Gradual Item (GI) in tuple format
attribute_colThe column index of a GI
symbolThe variation symbol of a GI