MembershipVector#
- class er_evaluation.data_structures.MembershipVector(data=None, dropna=False, **kwargs)[source]#
Bases:
SeriesSeries wrapper to validate membership vector format and log potential issues.
Given a Series
membershiprepresenting a membership vector, you can validate it using:membership = MembershipVector(membership)
This casts its type to the MembershipVector subclass. If
membershipis already of the MembershipVector subtype, this does absolutely nothing and simply returns themembershipobject as-is. However, ifmembershipis a Series, then it is validated, potential issues are logged, and then the object is returned as a instance of the MembershipVector subclass.This wrapper helps avoid duplicate validation and duplicate logging within the er_evaluation package. Externally, you may use
ismembership()to validate that a given pandas Series satisfies the requirements of a membership vector.Examples
>>> series = pd.Series([1,2,3,3]) >>> membership = MembershipVector(series) # Validates the series and logs potential issues. >>> membership = MembershipVector(membership) # Does nothing.