Пример #1
0
 def test_returns_positions_three(self):
     self.assertEquals(chop(5, [1, 3, 5]), 2)
     self.assertEquals(chop(1, [1, 2, 3, 4, 5]), 0)
     self.assertEquals(chop(2, [1, 2, 3, 4, 5]), 1)
     self.assertEquals(chop(3,  [1, 2, 3, 4, 5]), 2)
     self.assertEquals(chop(4, [1, 2, 3, 4, 5]), 3)
     self.assertEquals(chop(5,  [1, 2, 3, 4, 5]), 4)
     self.assertEquals(chop(3, [1, 2, 3, 4, 5, 6]), 2)
     self.assertEquals(chop(5, [1, 2, 3, 4, 5, 6]), 4)
Пример #2
0
def digits(wild_image):
	import crop
	import chop
	import numpy as np
	
	cropped = crop.crop(wild_image)
	chopped = chop.chop(cropped)
	
	n_images = chopped.shape[0]
	
	flattened = np.reshape(n_images, -1)
	
	return flattened
Пример #3
0
    def test_chop(self):
        self.assertEqual(-1, chop(3, []))
        self.assertEqual(-1, chop(3, [1]))
        self.assertEqual(0, chop(1, [1]))

        self.assertEqual(0, chop(1, [1, 3, 5]))
        self.assertEqual(1, chop(3, [1, 3, 5]))
        self.assertEqual(2, chop(5, [1, 3, 5]))
        self.assertEqual(-1, chop(0, [1, 3, 5]))
        self.assertEqual(-1, chop(2, [1, 3, 5]))
        self.assertEqual(-1, chop(4, [1, 3, 5]))
        self.assertEqual(-1, chop(6, [1, 3, 5]))

        self.assertEqual(0, chop(1, [1, 3, 5, 7]))
        self.assertEqual(1, chop(3, [1, 3, 5, 7]))
        self.assertEqual(2, chop(5, [1, 3, 5, 7]))
        self.assertEqual(3, chop(7, [1, 3, 5, 7]))
        self.assertEqual(-1, chop(0, [1, 3, 5, 7]))
        self.assertEqual(-1, chop(2, [1, 3, 5, 7]))
        self.assertEqual(-1, chop(4, [1, 3, 5, 7]))
        self.assertEqual(-1, chop(6, [1, 3, 5, 7]))
        self.assertEqual(-1, chop(8, [1, 3, 5, 7]))
Пример #4
0
 def test_returns_minus_one_when_not_single_element(self):
     self.assertEquals(chop(2, [3]), -1)
Пример #5
0
 def test_returns_zero_when_only_number(self):
     self.assertEquals(chop(2,[2]),0)
Пример #6
0
 def test_returns_minus_one_when_array_empty(self):
     self.assertEquals(chop(2,[]),-1)
Пример #7
0
 def test_returns_positions_two(self):
     self.assertEquals(chop(3, [1, 3, 5]), 1)
Пример #8
0
 def test_returns_positions_one(self):
     self.assertEquals(chop(1, [1, 3, 5]), 0)
Пример #9
0
 def test_returns_position_when_prestn(self):
     self.assertEquals(chop(2, [1,2]), 1)
Пример #10
0
 def test_returns_minus_one_when_not_present(self):
     self.assertEquals(chop(2, [1,3,4,5,5,5,5,5,56]), -1)
Пример #11
0
                            'word_freq_1999',
                            'word_freq_parts',
                            'word_freq_pm',
                            'word_freq_direct',
                            'word_freq_cs',
                            'word_freq_meeting',
                            'word_freq_original',
                            'word_freq_project',
                            'word_freq_re',
                            'word_freq_edu',
                            'word_freq_table',
                            'word_freq_conference',
                            'char_freq_semicolon',
                            'char_freq_(',
                            'char_freq_[',
                            'char_freq_!',
                            'char_freq_$',
                            'char_freq_#',
                            'capital_run_length_average',
                            'capital_run_length_longest',
                            'capital_run_length_total']
 params['split_ratio'] = 0.7
 params['delimiter_in'] = ','
 params['delimiter_out'] = ','
 params['history_steps'] = 0
 params['history_column'] = ''
 params['predict_column'] = ''
 params['shuffle'] = True
 params['shuffleFirst'] = True
 chop(params)