Skip to content

Instantly share code, notes, and snippets.

@Ruhshan
Created December 9, 2017 16:57
Show Gist options
  • Save Ruhshan/7bc7b152ac11cb44c15834b4f8dbaaea to your computer and use it in GitHub Desktop.
Save Ruhshan/7bc7b152ac11cb44c15834b4f8dbaaea to your computer and use it in GitHub Desktop.
def get_train_data_batch(n):
features = []
with open('data.csv') as f:
count=0
for line in f:
splitted = line.split(';')
featureset = [int(float(x)) for x in splitted[:len(splitted)-1]]
label = int(float(splitted[-1].rstrip()))
count+=1
if count % n==0:
features = np.array(features)
train_x = list(features[:,0])
train_y = list(features[:,1])
yield train_x, train_y
features = []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment