def find_segment_center(self, dataframe: pd.DataFrame, start: int, end: int) -> int: data = dataframe['value'] segment = data[start:end] segment_center_index = utils.find_pattern_center( segment, start, 'drop') return segment_center_index
def find_segment_center(self, dataframe: pd.DataFrame, start: int, end: int) -> int: data = dataframe['value'] segment = data[start:end] segment_center_index = utils.find_pattern_center( segment, start, self.get_model_type().value) return segment_center_index
def test_find_drop_parameters_center(self): segment = [ 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ] segment = pd.Series(segment) drop_center = [14, 15, 16] self.assertIn(utils.find_pattern_center(segment, 0, 'drop'), drop_center)
def test_find_jump_parameters_center(self): segment = [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 ] segment = pd.Series(segment) jump_center = [10, 11] self.assertIn(utils.find_pattern_center(segment, 0, 'jump'), jump_center)
def test_find_pattern_jump_center(self): data = [1.0, 1.0, 1.0, 5.0, 5.0, 5.0] data = pd.Series(data) median = 3.0 result = 3 self.assertEqual(result, utils.find_pattern_center(data, 0, 'jump'))