How to use the mleap.sklearn.preprocessing.data.MathBinary function in mleap

To help you get started, we’ve selected a few mleap 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 combust / mleap / python / mleap / sklearn / preprocessing / tests.py View on Github external
def math_binary_deserialize_exp_test(self):

        math_binary_tf = MathBinary(input_features=['a', 'b'], output_features=['a_plus_b'], transform_type='add')

        Xres = math_binary_tf.fit_transform(self.df[['a', 'b']])

        self.assertEqual( self.df.a[0] + self.df.b[0], Xres[0])

        math_binary_tf.serialize_to_bundle(self.tmp_dir, math_binary_tf.name)

        node_name = "{}.node".format(math_binary_tf.name)
        math_binary_ds_tf = MathBinary()
        math_binary_ds_tf = math_binary_ds_tf.deserialize_from_bundle(self.tmp_dir, node_name)

        res_a = math_binary_tf.transform(self.df[['a', 'b']])
        res_b = math_binary_ds_tf.transform(self.df[['a', 'b']])

        self.assertEqual(res_a[0], res_b[0])
github combust / mleap / python / mleap / sklearn / preprocessing / tests.py View on Github external
def math_binary_divide_test(self):

        math_binary_tf = MathBinary(input_features=['a', 'b'], output_features=['a_mul_b'], transform_type='div')

        Xres = math_binary_tf.fit_transform(self.df[['a', 'b']])

        self.assertEqual(self.df.a[0] / self.df.b[0], Xres[0])

        math_binary_tf.serialize_to_bundle(self.tmp_dir, math_binary_tf.name)

        expected_model = {
          "op": "math_binary",
          "attributes": {
            "operation": {
              "string": 'div'
            }
          }
        }
github combust / mleap / python / mleap / sklearn / preprocessing / tests.py View on Github external
def math_binary_multiply_test(self):

        math_binary_tf = MathBinary(input_features=['a', 'b'], output_features=['a_mul_b'], transform_type='mul')

        Xres = math_binary_tf.fit_transform(self.df[['a', 'b']])

        self.assertEqual(self.df.a[0] * self.df.b[0], Xres[0])

        math_binary_tf.serialize_to_bundle(self.tmp_dir, math_binary_tf.name)

        expected_model = {
          "op": "math_binary",
          "attributes": {
            "operation": {
              "string": 'mul'
            }
          }
        }
github combust / mleap / python / mleap / sklearn / preprocessing / tests.py View on Github external
def math_binary_subtract_test(self):

        math_binary_tf = MathBinary(input_features=['a', 'b'], output_features=['a_less_b'], transform_type='sub')

        Xres = math_binary_tf.fit_transform(self.df[['a', 'b']])

        self.assertEqual(self.df.a[0] - self.df.b[0], Xres[0])

        math_binary_tf.serialize_to_bundle(self.tmp_dir, math_binary_tf.name)

        expected_model = {
          "op": "math_binary",
          "attributes": {
            "operation": {
              "string": 'sub'
            }
          }
        }
github combust / mleap / python / mleap / sklearn / preprocessing / tests.py View on Github external
def math_binary_deserialize_exp_test(self):

        math_binary_tf = MathBinary(input_features=['a', 'b'], output_features=['a_plus_b'], transform_type='add')

        Xres = math_binary_tf.fit_transform(self.df[['a', 'b']])

        self.assertEqual( self.df.a[0] + self.df.b[0], Xres[0])

        math_binary_tf.serialize_to_bundle(self.tmp_dir, math_binary_tf.name)

        node_name = "{}.node".format(math_binary_tf.name)
        math_binary_ds_tf = MathBinary()
        math_binary_ds_tf = math_binary_ds_tf.deserialize_from_bundle(self.tmp_dir, node_name)

        res_a = math_binary_tf.transform(self.df[['a', 'b']])
        res_b = math_binary_ds_tf.transform(self.df[['a', 'b']])

        self.assertEqual(res_a[0], res_b[0])
github combust / mleap / python / mleap / sklearn / preprocessing / tests.py View on Github external
def math_binary_test(self):

        math_binary_tf = MathBinary(input_features=['a', 'b'], output_features=['a_plus_b'], transform_type='add')

        Xres = math_binary_tf.fit_transform(self.df[['a', 'b']])

        self.assertEqual( self.df.a[0] + self.df.b[0], Xres[0])

        math_binary_tf.serialize_to_bundle(self.tmp_dir, math_binary_tf.name)

        expected_model = {
          "op": "math_binary",
          "attributes": {
            "operation": {
              "string": 'add'
            }
          }
        }