def load_type(self, filename, verbose=True):
     """Get the variable types."""
     if verbose:
         print('========= Reading ' + filename)
     start = time.time()
     type_list = []
     if os.path.isfile(filename):
         if competition_c_functions_is_there:
             type_list = file_to_array(
                 filename,
                 verbose=False)
         else:
             type_list = file_to_array(filename, verbose=False)
     else:
         n = self.info['feat_num']
         type_list = [self.info['feat_type']] * n
     type_list = np.array(type_list).ravel()
     end = time.time()
     if verbose:
         print('[+] Success in %5.2f sec' % (end - start))
     return type_list
def _data_binary_sparse(filename, feat_type):
    # This function takes as an argument a file representing a binary sparse
    # matrix
    # binary_sparse_matrix[i][j] = a means matrix[i][j] = 1
    # It converts it into a numpy array an returns this array.

    inner_data = file_to_array(filename)
    nbr_samples = len(inner_data)
    # the construction is easier w/ dok_sparse
    dok_sparse = scipy.sparse.dok_matrix((nbr_samples, len(feat_type)))
    print('Converting {} to dok sparse matrix'.format(filename))
    for row in range(nbr_samples):
        for feature in inner_data[row]:
            dok_sparse[row, int(feature) - 1] = 1
    print('Converting {} to csr sparse matrix'.format(filename))
    return dok_sparse.tocsr()