How to use the lale.lib.lale.NoOp function in lale

To help you get started, we’ve selected a few lale examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IBM / lale / test / test_core_operators.py View on Github external
def test_trainable_pipe_right(self):
        from lale.lib.lale import NoOp
        from lale.lib.sklearn import LogisticRegression
        from sklearn.decomposition import PCA
        iris = sklearn.datasets.load_iris()
        pipeline = NoOp() >> PCA() >> LogisticRegression(random_state=42)
        pipeline.fit(iris.data, iris.target)
github IBM / lale / test / test_json_pretty_viz.py View on Github external
def test_pipeline_2(self):
        from lale.lib.lale import NoOp
        from lale.lib.sklearn import Nystroem
        from lale.lib.sklearn import PCA
        from lale.lib.sklearn import LogisticRegression
        from lale.lib.sklearn import KNeighborsClassifier
        from lale.operators import make_choice, make_pipeline
        from lale.json_operator import to_json, from_json
        kernel_tfm_or_not =  make_choice(NoOp, Nystroem)
        tfm = PCA
        clf = make_choice(LogisticRegression, KNeighborsClassifier)
        operator = make_pipeline(kernel_tfm_or_not, tfm, clf)
        json = to_json(operator)
        operator_2 = from_json(json)
        json_2 = to_json(operator_2)
        self.assertEqual(json, json_2)
github IBM / lale / test / test_optimizers.py View on Github external
def test_planned_pipeline_2(self) :
        plan = (
            ( MinMaxScaler() & NoOp() ) >> ConcatFeatures() >>
            ( NoOp() & MinMaxScaler() ) >> ConcatFeatures() >>
            ( LogisticRegression | KNeighborsClassifier )
        )
        run_hyperopt_on_planned_pipeline(plan)
github IBM / lale / test / test_core_operators.py View on Github external
def test_trained_get_pipeline_fail(self):
        try:
            x = NoOp().get_pipeline
            self.fail("get_pipeline did not fail")
        except AttributeError as e:
            msg:str = str(e)
            self.assertRegex(msg, "underlying operator")
github IBM / lale / test / test_json_pretty_viz.py View on Github external
def test_nested(self):
        from lale.lib.sklearn import PCA
        from lale.lib.sklearn import LogisticRegression as LR
        from lale.lib.lale import NoOp
        lr_0 = LR(C=0.09)
        lr_1 = LR(C=0.19)
        pipeline = PCA >> (lr_0 | NoOp >> lr_1)
        expected = \
"""from lale.lib.sklearn import PCA
from lale.lib.sklearn import LogisticRegression as LR
from lale.lib.lale import NoOp
import lale
lale.wrap_imported_operators()

lr_0 = LR(C=0.09)
lr_1 = LR(C=0.19)
pipeline = PCA >> (lr_0 | NoOp >> lr_1)"""
        self._roundtrip(expected, lale.pretty_print.to_string(pipeline))
github IBM / lale / test / test_type_checking.py View on Github external
def test_transform_schema_NoOp(self):
        from lale.datasets.data_schemas import to_schema
        for ds in [self._irisArr, self._irisDf, self._digits, self._housing, self._creditG, self._movies, self._drugRev]:
            s_input = to_schema(ds['X'])
            s_output = NoOp.transform_schema(s_input)
            self.assertIs(s_input, s_output)
github IBM / lale / lale / lib / lale / both.py View on Github external
def getPipeline(self):
        params = self._hyperparams
        op1 = params.get('op1', None)
        if op1 is None:
            op1 = NoOp()
            
        op2 = params.get('op2', None)
        if op2 is None:
            op2 = NoOp()

        if params['order'] == 'backward':
            return op2 >> op1
        else:
            return op1 >> op2
github IBM / lale / lale / lib / lale / both.py View on Github external
def getPipeline(self):
        params = self._hyperparams
        op1 = params.get('op1', None)
        if op1 is None:
            op1 = NoOp()
            
        op2 = params.get('op2', None)
        if op2 is None:
            op2 = NoOp()

        if params['order'] == 'backward':
            return op2 >> op1
        else:
            return op1 >> op2