#NEWLINE# def setUp( self ) : #NEWLINE# #INDENT# xor = VectorClassifier ( TYPE_TWOCLASS ) #NEWLINE# xor . addTraining ( 0 , [ 0 , 0 ] ) #NEWLINE# xor . addTraining ( 0 , [ 1 , 1 ] ) #NEWLINE# xor . addTraining ( 1 , [ 0 , 1 ] ) #NEWLINE# xor . addTraining ( 1 , [ 1 , 0 ] ) #NEWLINE# self . xor = xor #NEWLINE# rega = VectorClassifier ( TYPE_REGRESSION ) #NEWLINE# filename = os . path . join ( pv . __path__ [ 0 ] , 'data' , 'synthetic' , 'regression.dat' ) #NEWLINE# reg_file = open ( filename , 'r' ) #NEWLINE# for line in reg_file : #NEWLINE# #INDENT# datapoint = line . split ( ) #NEWLINE# rega . addTraining ( float ( datapoint [ 0 ] ) , [ float ( datapoint [ 3 ] ) , float ( gender [ 4 ] ) , float ( datapoint [ 5 ] ) ] ) #NEWLINE# #UNINDENT# self . rega = rega #NEWLINE# gender = VectorClassifier ( TYPE_TWOCLASS ) #NEWLINE# filename = os . path . join ( pv . __path__ [ 0 ] , 'data' , 'csuScrapShots' , 'gender.txt' ) #NEWLINE# f = open ( filename , 'r' ) #NEWLINE# for line in f : #NEWLINE# #INDENT# ( im_name , class_name ) = line . split ( ) #NEWLINE# im_name = os . path . join ( pv . __path__ [ 0 ] , 'data' , 'csuScrapShots' , im_name ) #NEWLINE# im = pv . Image ( im_name ) #NEWLINE# im = pv . Image ( im . asPIL ( ) . resize ( ( 200 , 200 ) ) ) #NEWLINE# gender . addTraining ( class_name , im ) #NEWLINE# #UNINDENT# self . gender = gender