Module ImportFrom alias Import alias identifier ClassDef bases body Expr Str FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults body Expr Str Assign NameStore BinOpAdd BinOpDiv BinOpDiv Num Num BinOpPow NameLoad Num BinOpDiv BinOpDiv Num Num BinOpPow NameLoad Num Assign NameStore BinOpSub BinOpDiv NameLoad BinOpPow NameLoad Num BinOpDiv NameLoad BinOpPow NameLoad Num Assign NameStore BinOpSub BinOpAdd BinOpAdd BinOpDiv BinOpMult BinOpDiv Num Num BinOpPow NameLoad Num BinOpPow NameLoad Num BinOpDiv BinOpMult BinOpDiv Num Num BinOpPow NameLoad Num BinOpPow NameLoad Num Call AttributeLoad NameLoad attr BinOpDiv NameLoad NameLoad Call AttributeLoad NameLoad attr BinOpDiv NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr ListLoad BinOpMult Num NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr BinOpSub BinOpPow NameLoad Num BinOpMult BinOpMult Num NameLoad NameLoad Assign NameStore BinOpDiv BinOpAdd UnaryOpUSub NameLoad NameLoad BinOpMult Num NameLoad Assign NameStore BinOpDiv BinOpSub UnaryOpUSub NameLoad NameLoad BinOpMult Num NameLoad Assign NameStore ListLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign AttributeStore NameLoad attr SubscriptLoad NameLoad Index NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign TupleStore NameStore NameStore TupleLoad AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr AttributeLoad Call AttributeLoad NameLoad attr NameLoad attr Assign TupleStore NameStore NameStore TupleLoad AttributeLoad SubscriptLoad NameLoad Index Num attr AttributeLoad SubscriptLoad NameLoad Index Num attr Assign TupleStore NameStore NameStore TupleLoad Call AttributeLoad NameLoad attr NameLoad keyword Num Call AttributeLoad NameLoad attr NameLoad keyword Num Assign NameStore BinOpAdd Call AttributeLoad NameLoad attr NameLoad keyword BinOpSub NameLoad Num Call AttributeLoad NameLoad attr NameLoad keyword BinOpSub NameLoad Num Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad BinOpSub NameLoad NameLoad Assign AttributeStore NameLoad attr BinOpDiv NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad Assign NameStore BinOpAdd NameLoad NameLoad Assign TupleStore NameStore NameStore TupleLoad BinOpDiv NameLoad NameLoad BinOpDiv NameLoad NameLoad Assign TupleStore NameStore NameStore TupleLoad Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad Assign TupleStore NameStore NameStore TupleLoad Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad Call AttributeLoad AttributeLoad AttributeLoad NameLoad attr attr attr NameLoad Assign TupleStore NameStore NameStore TupleLoad Call AttributeLoad NameLoad attr NameLoad Call AttributeLoad NameLoad attr NameLoad Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore Call AttributeLoad NameLoad attr NameLoad Return Call AttributeLoad Call AttributeLoad CompareGtE Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr attr NameLoad attr decorator_list decorator_list
N/A __future__ division N/A numpy np Fisher N/A N/A N/A  This class offers methods to train and classify data using the Fisher's
        Linear Discriminant. Based on Chapter 4.1 from C.M. Bishop, Pattern
        Recognition and Machine Learning, Springer, 2007.

    Attributes
    ----------
    w : array of float
        Weight vector. Used to project the data to classify
    c : float
        Threshold used to compare the projections

     __init__ N/A N/A self N/A N/A N/A  Attribute intitialization  N/A N/A self w None N/A N/A self c None N/A c_comp N/A N/A self p0 p1 sigma0 sigma1 m0_proy m1_proy N/A N/A N/A  Computes the c threshold to assign a class to a (projected) point.
            We obtain the exact roots that are local optima of the error
            estimation and then we choose the one that minimizes it.

        Parameters
        ----------
        p0 : float
            prior probability for the first class
        p1 : float
            prior probability for the second class
        sigma0 : float
            maximum likelihood estimator for the std deviation of the
            projected first class
        sigma1 : float
            maximum likelihood estimator for the std deviation of the
            projected second class
        m0_proy : float
            maximum likelihood estimator for the mean of the projected
            first class
        m1_proy : float
            maximum likelihood estimator for the mean of the projected
            second class

         N/A a N/A N/A N/A -1 2 N/A sigma0 2 N/A N/A 1 2 N/A sigma1 2 N/A b N/A N/A m0_proy N/A sigma0 2 N/A m1_proy N/A sigma1 2 N/A c N/A N/A N/A N/A N/A N/A -1 2 N/A m0_proy 2 N/A sigma0 2 N/A N/A N/A 1 2 N/A m1_proy 2 N/A sigma1 2 N/A N/A np log N/A p0 sigma0 N/A N/A np log N/A p1 sigma1 N/A pol_der N/A N/A np array N/A N/A 2 a b N/A disc N/A N/A np sqrt N/A N/A b 2 N/A N/A 4 a c N/A rootp N/A N/A N/A b disc N/A 2 a N/A rootm N/A N/A N/A b disc N/A 2 a N/A roots N/A rootp rootm N/A index N/A N/A np argmin N/A N/A np polyval pol_der roots N/A N/A self c N/A roots N/A index N/A train_fisher N/A N/A self x0 x1 N/A N/A N/A  Trains with the sample data provided for the Fisher's Linear
        discriminant. It computes the weight vector w and the threshold c.

        Parameters
        ----------
        x0 : list of points from the first class, given as
            [[x0,...,xD],...,[z0,...,zD]] where D is the number of dimensions
        x1 : list of points from the second class, given as
            [[x0,...,xD],...,[z0,...,zD]] where D is the number of dimensions

         N/A N/A x0 x1 N/A N/A N/A N/A np asarray x0 T N/A N/A N/A np asarray x1 T N/A N/A n0 n1 N/A N/A N/A x0 N/A 1 size N/A N/A x1 N/A 1 size N/A N/A m0 m1 N/A N/A N/A np mean x0 axis 1 N/A N/A np mean x1 axis 1 N/A sw N/A N/A N/A np cov x0 ddof N/A n0 1 N/A N/A np cov x1 ddof N/A n1 1 N/A w_no_norm N/A N/A N/A np linalg solve sw N/A m1 m0 N/A N/A self w N/A w_no_norm N/A N/A N/A np linalg norm w_no_norm N/A n N/A n0 n1 N/A N/A p0 p1 N/A N/A n0 n N/A n1 n N/A N/A m0_proy m1_proy N/A N/A N/A N/A N/A self w T dot m0 N/A N/A N/A N/A self w T dot m1 N/A N/A x0_proy x1_proy N/A N/A N/A N/A N/A self w T dot x0 N/A N/A N/A N/A self w T dot x1 N/A N/A sigma0 sigma1 N/A N/A N/A np std x0_proy N/A N/A np std x1_proy N/A N/A N/A self c_comp p0 p1 sigma0 sigma1 m0_proy m1_proy N/A classify_fisher N/A N/A self x N/A N/A N/A  Classifies the given points thanks to the previous training.

        Parameters
        ----------
        x : list of points from the first class, given as
            [[x0,...,xD],...,[z0,...,zD]] where D is the number of dimensions

        Returns
        -------
        list of integers
            [c0,c1,...,cM] : where ci is the class of the ith point for each i
            from 0 to M, and ci = 0 or ci = 1

         N/A x N/A N/A np asarray x N/A N/A N/A N/A N/A N/A N/A N/A x dot N/A self w N/A self c astype int tolist N/A N/A