<s> import numpy as np <EOL> import matplotlib . pyplot as plt <EOL> from neupy import algorithms <EOL> from base import BaseTestCase <EOL> data = np . array ( [ <EOL> [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] , <EOL> ] ) <EOL> class RBFKMeansTestCase ( BaseTestCase ) : <EOL> def test_validation ( self ) : <EOL> with self . assertRaises ( ValueError ) : <EOL> nw = algorithms . RBFKMeans ( n_clusters = <NUM_LIT:1000> , verbose = False ) <EOL> nw . train ( data , epsilon = <NUM_LIT> ) <EOL> with self . assertRaises ( ValueError ) : <EOL> nw = algorithms . RBFKMeans ( n_clusters = data . shape [ <NUM_LIT:0> ] , <EOL> verbose = False ) <EOL> nw . train ( data , epsilon = <NUM_LIT> ) <EOL> with self . assertRaises ( ValueError ) : <EOL> nw = algorithms . RBFKMeans ( n_clusters = <NUM_LIT:1> , verbose = False ) <EOL> nw . train ( data , epsilon = <NUM_LIT> ) <EOL> def test_classification ( self ) : <EOL> expected_centers = np . array ( [ <EOL> [ <NUM_LIT> , <NUM_LIT> ] , <EOL> [ <NUM_LIT> , <NUM_LIT> ] , <EOL> ] ) <EOL> nw = algorithms . RBFKMeans ( n_clusters = <NUM_LIT:2> , verbose = False ) <EOL> nw . train ( data , epsilon = <NUM_LIT> ) <EOL> np . testing . assert_array_almost_equal ( expected_centers , nw . centers , <EOL> decimal = <NUM_LIT:3> ) <EOL> def test_train_different_inputs ( self ) : <EOL> self . assertInvalidVectorTrain ( <EOL> algorithms . RBFKMeans ( n_clusters = <NUM_LIT:2> , verbose = False ) , <EOL> np . array ( [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:10> ] ) , <EOL> ) <EOL> def test_predict_different_inputs ( self ) : <EOL> kmnet = algorithms . RBFKMeans ( verbose = False , n_clusters = <NUM_LIT:2> ) <EOL> data = np . array ( [ [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:10> ] ] ) . T <EOL> target = np . array ( [ [ <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> ] ] ) . T <EOL> kmnet . train ( data ) <EOL> self . assertInvalidVectorPred ( kmnet , data . ravel ( ) , target , decimal = <NUM_LIT:2> ) </s>
