Skip to content

Instantly share code, notes, and snippets.

@tengpeng
Created April 2, 2016 19:41
Show Gist options
  • Save tengpeng/74417f65e4a2abcbdafc168578fee5af to your computer and use it in GitHub Desktop.
Save tengpeng/74417f65e4a2abcbdafc168578fee5af to your computer and use it in GitHub Desktop.
convert py
def convert_label_to_array(str_label):
str_label = str_label[1:-1]
str_label = str_label.split(',')
return [int(x) for x in str_label if len(x)>0]
def convert_feature_to_vector(str_feature):
str_feature = str_feature[1:-1]
str_feature = str_feature.split(',')
return [float(x) for x in str_feature]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment