examples.py
def read_bone_marrow_data(only_first_n=None):
    """Reads a certain csv file of cytometric data and returns both the data
    and the class labels.
    """

    def partial_csv(file_):
        """Given an CSV file, generates its 2d array without header and only the
        first n lines. Reads all if only_first_n is None.
        """
        return islice(csv.reader(file_), 1, only_first_n)

    # Read the files
    with open('data/BoneMarrow_Basal1.csv') as file_:
        data = [list(map(float, x)) for x in partial_csv(file_)]
    with open('data/manualGating.csv') as file_:
        labels = (x[1] for x in partial_csv(file_))
        labels = [None if x == 'Unknown' else x for x in labels]

    # Make sure there is no bias by shuffling the data
    both = list(zip(data, labels))
    random.shuffle(both)
    data, labels = tuple(zip(*both))

    # Normalize the data
    data = list(normalize(data))

    return data, labels
Reads a certain csv file of cytometric data and returns both the data
    and the class labels.
    
Reads a certain csv file of cytometric data and returns both the data
and the class labels.
Reads a certain csv file of cytometric data and returns both the data and the class labels .
def read_bone_marrow_data(only_first_n=None):
    def partial_csv(file_):
        return islice(csv.reader(file_), 1, only_first_n)
    with open('data/BoneMarrow_Basal1.csv') as file_:
        data = [list(map(float, x)) for x in partial_csv(file_)]
    with open('data/manualGating.csv') as file_:
        labels = (x[1] for x in partial_csv(file_))
        labels = [None if x == 'Unknown' else x for x in labels]
    both = list(zip(data, labels))
    random.shuffle(both)
    data, labels = tuple(zip(*both))
    data = list(normalize(data))
    return data, labels
def read_bone_marrow_data ( only_first_n = None ) : def partial_csv ( file_ ) : """Given an CSV file, generates its 2d array without header and only the
        first n lines. Reads all if only_first_n is None.
        """ return islice ( csv . reader ( file_ ) , 1 , only_first_n ) with open ( 'data/BoneMarrow_Basal1.csv' ) as file_ : data = [ list ( map ( float , x ) ) for x in partial_csv ( file_ ) ] with open ( 'data/manualGating.csv' ) as file_ : labels = ( x [ 1 ] for x in partial_csv ( file_ ) ) labels = [ None if x == 'Unknown' else x for x in labels ] both = list ( zip ( data , labels ) ) random . shuffle ( both ) data , labels = tuple ( zip ( * both ) ) data = list ( normalize ( data ) ) return data , labels
Reads a certain csv file of cytometric data and returns both the data
and the class labels.
Reads a certain csv file of cytometric data and returns both the data and the class labels .
"""Reads a certain csv file of cytometric data and returns both the data
    and the class labels.
    """ """Given an CSV file, generates its 2d array without header and only the
        first n lines. Reads all if only_first_n is None.
        """ # Read the files # Make sure there is no bias by shuffling the data # Normalize the data
only_first_n