#NEWLINE# def test_standard_svm_blobs_2d( ) : #NEWLINE# #INDENT# ( X , Y ) = make_blobs ( n_samples = 80 , centers = 3 , random_state = 42 ) #NEWLINE# X = np . hstack ( [ X , np . ones ( ( X . shape [ 0 ] , 1 ) ) ] ) #NEWLINE# ( X_train , X_test , Y_train , Y_test ) = ( X [ : 40 ] , X [ 40 : ] , Y [ : 40 ] , Y [ 40 : ] ) #NEWLINE# X_train_graphs = [ ( x [ np . newaxis , : ] , np . empty ( ( 0 , 2 ) , dtype = np . int ) ) for x in X_train ] #NEWLINE# X_test_graphs = [ ( x [ np . newaxis , : ] , np . empty ( ( 0 , 2 ) , dtype = np . int ) ) for x in X_test ] #NEWLINE# pbl = GraphCRF ( n_features = 3 , n_states = 3 , inference_method = 'unary' ) #NEWLINE# svm = OneSlackSSVM ( pbl , check_constraints = True , C = 1000 ) #NEWLINE# svm . fit ( X_train_graphs , Y_train [ : , np . newaxis ] ) #NEWLINE# assert_array_equal ( Y_test , np . hstack ( svm . predict ( X_test_graphs ) ) )