Created
December 9, 2017 16:57
-
-
Save Ruhshan/7bc7b152ac11cb44c15834b4f8dbaaea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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