def svm_read_problem(data_file_name):
 prob_y = []
 prob_x = []
 for line in open(data_file_name):
  line = line.split(None, 1)
  if (len(line) == 1):
   line += ['']
  (label, features) = line
  xi = {}
  for e in features.split():
   (ind, val) = e.split(':')
   xi[int(ind)] = float(val)
  prob_y += [float(label)]
  prob_x += [xi]
 return (prob_y, prob_x)

def svm_read_problem ( data_file_name ) : prob_y = [ ] prob_x = [ ] for line in open ( data_file_name ) : line = line . split ( None , 1 ) if ( len ( line ) == 1 ) : line += [ '' ] ( label , features ) = line xi = { } for e in features . split ( ) : ( ind , val ) = e . split ( ':' ) xi [ int ( ind ) ] = float ( val ) prob_y += [ float ( label ) ] prob_x += [ xi ] return ( prob_y , prob_x )
svm_read_problem -> [y .