Esempio n. 1
0
def load_splice(data_folder):
    file_path = data_folder + 'dataset_46_splice.csv'
    data = pd.read_csv(file_path, delimiter=',').values
    label = trans_label(data[:, -1])
    transformed_data = [trans_label(item) for item in data[:, 1:-1].T]
    transformed_data = np.array(transformed_data).T
    transformed_data = one_hot(transformed_data).toarray()
    return transformed_data, label
Esempio n. 2
0
def load_abalone(data_folder):
    file_path = data_folder + 'abalone.csv'
    data = pd.read_csv(file_path, delimiter=',').values
    label = trans_label(data[:, -1])
    one_hot_data = one_hot(data[:, 0:1]).toarray()
    feature = np.hstack((one_hot_data, data[:, 1:-1]))
    return feature, label
Esempio n. 3
0
def load_kropt(data_folder):
    file_path = data_folder + 'dataset_188_kropt.csv'
    data = pd.read_csv(file_path, delimiter=',').values
    label = trans_label(data[:, -1])
    print(data[:, 0])
    for c in range(6):
        if c % 2 == 0:
            data[:, c] = [(ord(t) - ord('a') + 1) for t in data[:, c]]
    return data[:, :-1], label
Esempio n. 4
0
def load_credit_g(data_folder):
    file_path = data_folder + 'credit-g.csv'
    data = pd.read_csv(file_path, delimiter=',').values
    feature = data[:, :-1]
    feature_num = feature.shape[1]
    feature_indices = list(range(feature_num))
    numerical_indices = [1, 4, 7, 10, 12, 15, 17]
    one_hot_indices = [
        i for i in feature_indices if i not in numerical_indices
    ]
    one_hot_feature = one_hot(data[:, one_hot_indices]).toarray()
    print(one_hot_feature.shape[1])
    feature = np.hstack((one_hot_feature, feature[:, numerical_indices]))
    return feature, trans_label(data[:, -1])
Esempio n. 5
0
def load_satimage(data_folder):
    file_path = data_folder + 'dataset_186_satimage.csv'
    data = pd.read_csv(file_path, delimiter=',').values
    return data[:, :-1], trans_label(data[:, -1])
Esempio n. 6
0
def load_eeg_eye_state(data_folder):
    file_path = data_folder + 'eeg-eye-state.csv'
    data = pd.read_csv(file_path, delimiter=',').values
    return data[:, :-1], trans_label(data[:, -1])
Esempio n. 7
0
def load_mammography(data_folder):
    file_path = data_folder + 'mammography.csv'
    data = pd.read_csv(file_path, delimiter=',').values
    return data[:, :-1], trans_label(data[:, -1])
Esempio n. 8
0
def load_vehicle(data_folder):
    file_path = data_folder + 'vehicle.csv'
    data = pd.read_csv(file_path, delimiter=',').values
    return data[:, :-1], trans_label(data[:, -1])
Esempio n. 9
0
def load_electricity(data_folder):
    file_path = data_folder + 'electricity.csv'
    data = pd.read_csv(file_path, delimiter=',').values
    return data[:, :-1], trans_label(data[:, -1])
Esempio n. 10
0
def load_sick(data_folder):
    file_path = data_folder + 'dataset_38_sick.csv'
    data = pd.read_csv(file_path, delimiter=',').values
    features = data[:, :-1]
    print(features[0, :])
    return data[:, :-1], trans_label(data[:, -1])
Esempio n. 11
0
def load_segment(data_folder):
    file_path = data_folder + 'phpyM5ND4.csv'
    data = pd.read_csv(file_path, delimiter=',').values
    return data[:, :-1], trans_label(data[:, -1])
Esempio n. 12
0
def load_wine_quality(data_folder):
    file_path = data_folder + 'wine-quality-red.csv'
    data = pd.read_csv(file_path, delimiter=',').values
    return data[:, :-1], trans_label(data[:, -1])
Esempio n. 13
0
def load_cifar10s(data_folder):
    file_path = data_folder + 'cifar-10-small.csv'
    data = pd.read_csv(file_path, delimiter=',').values
    return data[:, :-1], trans_label(data[:, -1])