-
Notifications
You must be signed in to change notification settings - Fork 2
/
readFold.py
39 lines (33 loc) · 894 Bytes
/
readFold.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 10 21:05:17 2018
@author: USER
"""
import csv
import os
def read_csv(file_name):
array_2D = []
with open(file_name, 'rb') as csvfile:
read = csv.reader(csvfile, delimiter=';')
for row in read:
array_2D.append(row)
return array_2D
def buildFold(foldTest):
path = "data/realTraining/fold/"
#pathOutput = "D:\\KULIAH\\SEMESTER VII\\SKRIPSI - OFFLINE\\DATA01\\"
tot = os.listdir(path)
#kelas = 1
fold = []
for filename in tot:
fold.append(read_csv(path+filename)) # Fold 1
#foldTest = [0]
dataUji = []
for i in range(len(foldTest)):
dataUji.extend(fold[i])
dataLatih = []
for i in range(len(fold)):
if (i in foldTest):
dataLatih.extend(fold[i])
return dataLatih, dataUji
foldTest = [0]
buildFold(foldTest)