Created
January 7, 2017 15:50
-
-
Save thmain/d4db8d952b4a5464bcaf56e0f322934a to your computer and use it in GitHub Desktop.
This file contains 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
items = []; | |
for i in range(1,len(lines)): | |
line = lines[i].split(','); | |
itemFeatures = {"Class" : line[-1]}; | |
for j in range(len(features)): | |
#Iterate through the features | |
f = features[j]; #Get the feature at index j | |
#The first item in the line is the class, skip it | |
v = float(line[j]); #Convert value to integer | |
itemFeatures[f] = v; #Add feature to dict | |
items.append(itemFeatures); #Append temp dict to items | |
shuffle(items); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment