Exemple #1
0
def create_test_case_invalid_step_choosen():
    a_callback = TapeCallbackFunction()
    b_callback = TapeCallbackFunction()

    return NeuraxleTestCase(pipeline=Pipeline([
        ChooseOneOrManyStepsOf([
            ('a',
             TransformCallbackStep(a_callback,
                                   transform_function=lambda di: di * 2)),
            ('b',
             TransformCallbackStep(b_callback,
                                   transform_function=lambda di: di * 2))
        ]),
    ]),
                            callbacks=[a_callback, b_callback],
                            expected_callbacks_data=[DATA_INPUTS, DATA_INPUTS],
                            hyperparams={
                                'ChooseOneOrManyStepsOf__c__enabled': True,
                                'ChooseOneOrManyStepsOf__b__enabled': False
                            },
                            hyperparams_space={
                                'ChooseOneOrManyStepsOf__a__enabled':
                                Boolean(),
                                'ChooseOneOrManyStepsOf__b__enabled':
                                Boolean()
                            },
                            expected_processed_outputs=np.array(
                                [0, 2, 4, 6, 8, 10, 12, 14, 16, 18]))
Exemple #2
0
def create_test_case_fit_multiple_steps_choosen():
    a_callback = TapeCallbackFunction()
    b_callback = TapeCallbackFunction()
    c_callback = TapeCallbackFunction()
    d_callback = TapeCallbackFunction()

    return NeuraxleTestCase(
        pipeline=Pipeline([
            ChooseOneOrManyStepsOf([
                ('a', FitTransformCallbackStep(a_callback, c_callback, transform_function=lambda di: di * 2)),
                ('b', FitTransformCallbackStep(b_callback, d_callback, transform_function=lambda di: di * 2))
            ]),
        ]),
        callbacks=[a_callback, c_callback, b_callback, d_callback],
        expected_callbacks_data=[
            [],
            (DATA_INPUTS, EXPECTED_OUTPUTS),
            [],
            (DATA_INPUTS, EXPECTED_OUTPUTS)
        ],
        hyperparams={
            'ChooseOneOrManyStepsOf__a__enabled': True,
            'ChooseOneOrManyStepsOf__b__enabled': True
        },
        hyperparams_space={
            'ChooseOneOrManyStepsOf__a__enabled': Boolean(),
            'ChooseOneOrManyStepsOf__b__enabled': Boolean()
        },
        expected_processed_outputs=np.array([0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18])
    )