<s> """<STR_LIT>""" <EOL> import os <EOL> import tempfile <EOL> from unittest import TestCase <EOL> import numpy as np <EOL> import sys <EOL> from hpelm import ELM <EOL> class TestCorrectness ( TestCase ) : <EOL> def test_AddNeurons_WorksWithLongType ( self ) : <EOL> if sys . version_info [ <NUM_LIT:0> ] == <NUM_LIT:2> : <EOL> ltype = long <EOL> else : <EOL> ltype = int <EOL> model = ELM ( <NUM_LIT:3> , <NUM_LIT:2> ) <EOL> L = ltype ( <NUM_LIT:10> ) <EOL> model . add_neurons ( L , '<STR_LIT>' ) <EOL> def test_CrossValidation_ReturnsError ( self ) : <EOL> model = ELM ( <NUM_LIT:5> , <NUM_LIT:2> ) <EOL> model . add_neurons ( <NUM_LIT:10> , '<STR_LIT>' ) <EOL> X = np . random . rand ( <NUM_LIT:100> , <NUM_LIT:5> ) <EOL> T = np . random . rand ( <NUM_LIT:100> , <NUM_LIT:2> ) <EOL> err = model . train ( X , T , '<STR_LIT>' , k = <NUM_LIT:3> ) <EOL> self . assertIsNotNone ( err ) <EOL> def test_ClassificationError_CorrectWithMultipleClasses ( self ) : <EOL> T = np . zeros ( ( <NUM_LIT:100> , <NUM_LIT:5> ) ) <EOL> T [ : , <NUM_LIT:0> ] = <NUM_LIT:1> <EOL> Y = np . zeros ( ( <NUM_LIT:100> , <NUM_LIT:5> ) ) <EOL> Y [ : , <NUM_LIT:1> ] = <NUM_LIT:1> <EOL> model = ELM ( <NUM_LIT:1> , <NUM_LIT:5> , classification = '<STR_LIT:c>' ) <EOL> self . assertEqual ( <NUM_LIT:1> , model . error ( T , Y ) ) <EOL> def test_MultilabelError_CorrectWithMultipleClasses ( self ) : <EOL> T = np . zeros ( ( <NUM_LIT:100> , <NUM_LIT:5> ) ) <EOL> T [ : , <NUM_LIT:0> ] = <NUM_LIT:1> <EOL> Y = np . zeros ( ( <NUM_LIT:100> , <NUM_LIT:5> ) ) <EOL> Y [ : , <NUM_LIT:1> ] = <NUM_LIT:1> <EOL> model = ELM ( <NUM_LIT:1> , <NUM_LIT:5> , classification = '<STR_LIT>' ) <EOL> self . assertEqual ( <NUM_LIT> , model . error ( T , Y ) ) <EOL> def test_LOO_CanSelectMoreThanOneNeuron ( self ) : <EOL> X = np . random . rand ( <NUM_LIT:100> , <NUM_LIT:5> ) <EOL> T = np . random . rand ( <NUM_LIT:100> , <NUM_LIT:2> ) <EOL> for _ in range ( <NUM_LIT:10> ) : <EOL> model = ELM ( <NUM_LIT:5> , <NUM_LIT:2> ) <EOL> model . add_neurons ( <NUM_LIT:5> , '<STR_LIT>' ) <EOL> model . train ( X , T , '<STR_LIT>' ) <EOL> max1 = model . nnet . L <EOL> if max1 > <NUM_LIT:1> : <EOL> break <EOL> self . assertGreater ( max1 , <NUM_LIT:1> ) <EOL> def test_LOOandOP_CanSelectMoreThanOneNeuron ( self ) : <EOL> X = np . random . rand ( <NUM_LIT:100> , <NUM_LIT:5> ) <EOL> T = np . random . rand ( <NUM_LIT:100> , <NUM_LIT:2> ) <EOL> for _ in range ( <NUM_LIT:10> ) : <EOL> model = ELM ( <NUM_LIT:5> , <NUM_LIT:2> ) <EOL> model . add_neurons ( <NUM_LIT:5> , '<STR_LIT>' ) <EOL> model . train ( X , T , '<STR_LIT>' , '<STR_LIT>' ) <EOL> max2 = model . nnet . L <EOL> if max2 > <NUM_LIT:1> : <EOL> break <EOL> self . assertGreater ( max2 , <NUM_LIT:1> ) </s>
