Ejemplo n.º 1
0
    def _build_model(self, X, y):
        Validation.check_dataset(X, y)

        if Validation.is_variable_length(X):
            raise ValueError("Variable length inputs to CXPlain are currently not supported.")

        n, p = Validation.get_input_dimension(X)
        output_dim = Validation.get_output_dimension(y)

        if self.model is None:
            if self.num_models == 1:
                build_fun = self._build_single
            else:
                build_fun = self._build_ensemble

            self.model, self.prediction_model = build_fun(input_dim=p, output_dim=output_dim)
Ejemplo n.º 2
0
 def test_is_variable_length_padded_false(self):
     (x, _), _ = TestUtil.get_random_variable_length_dataset(max_value=1024)
     x = pad_sequences(x, padding="post", truncating="post", dtype=int)
     return_value = Validation.is_variable_length(x)
     self.assertEqual(return_value, False)
Ejemplo n.º 3
0
 def test_is_variable_length_ndarray_true(self):
     (x, _), _ = TestUtil.get_random_variable_length_dataset(max_value=1024)
     x = np.array(x)
     return_value = Validation.is_variable_length(x)
     self.assertEqual(return_value, True)