Examples
Load the provided medical diagnosis data used in the literature and classify the first patient's symptoms to the
corresponding diagnosis with the distance measure proposed by Wang and Xin (2005), with $p=2$:
from distances import wang_xin
from utils import classify
from datasets import load_patients_diagnoses
diagnoses, patients = load_patients_diagnoses()
classify(diagnoses, patients[0], wang_xin, p=2)
Fuzzy Sets are represented through the FuzzySet class which includes attributes for the corresponding membership and non-membership values. A Fuzzy Set $S$ with membership and non-membership values is initialized in the following manner
S = FuzzySet(membership_values: Iterable, non_membership_values: Iterable = None)
To represent the following Fuzzy Set patterns in $X = {x_1, x_2, x_3}$:
$S_1={(x_1, 0.5, 0.4|x_1), (x_2, 0.8, 0.0|x_2), (x_3, 0.7, 0.1|x_3)}$
$S_2={(x_1, 1.0, 0.0|x_1), (x_3, 1.0, 0.1|x_3)}$
$S_3={(x_1, 0.9, 0.5|x_1), (x_2, 0.8, 0.3|x_2)}$
use the FuzzySet class to initialize an object like so:
S1 = FuzzySet([0.5, 0.8, 0.7], [0.4, 0.0, 0.1])
S1 = FuzzySet([1.0, 0.0, 1.0], [0.0, 0.0, 0.1])
S1 = FuzzySet([0.9, 0.8, 0.0], [0.5, 0.3, 0.0])
Calculate the normalized Euclidean distance between two Fuzzy Sets A and B:
import fuzzy_sets_measures as fsm
from distances import atanassov
atanassov(A, B, fsm.DISTANCE_NORMALIZED_EUCLIDEAN)
Calculate the second similarity measure proposed by Liang and Shi (2003):
import fuzzy_sets_measures as fsm
from similarities import liang_shi
liang_shi(A, B, fsm.LIANG_SHI_SIMILARITY_2, p=2)