def test_trim_2D(random): node = Pipeline(steps=dummy_classifier) data = DummyData(rate=1).next(20) node._X_train = data.values node._X_train_indices = np.array(data.index.values, dtype=np.datetime64) start = np.datetime64('2018-01-01T00:00:05') stop = np.datetime64('2018-01-01T00:00:15') node._dimensions = 2 node._accumulate(start, stop) assert len(node._X_train_indices) == 10 assert len(node._X_train) == 10
def test_fit_reset(caplog): caplog.set_level(logging.DEBUG) node = Pipeline(steps=dummy_classifier, event_reset='reset') node._status = -1 # bypass accumulation node._X_train = np.array([-1, 1, 1, 1]) node._y_train = np.array([0, 1, 1, 1]) node.i_events.data = make_event('training_starts') node.update() node.i_events.data = make_event('reset') node.update() assert caplog.record_tuples[0][2] == 'Start training' assert caplog.record_tuples[1][2] == 'Reset' assert node._status == 0
def test_fit_success(caplog): caplog.set_level(logging.DEBUG) node = Pipeline(steps=dummy_classifier) node._status = -1 # bypass accumulation assert hasattr(node._pipeline[0], 'n_classes_') == False node._X_train = np.array([-1, 1, 1, 1]) node._y_train = np.array([0, 1, 1, 1]) node.i_events.data = make_event('training_starts') while node._status != 3: node.update() assert node._pipeline[0].n_classes_ == 2 assert caplog.record_tuples[0][2] == 'Start training' assert caplog.record_tuples[1][2].startswith('Model fitted in')