def execute(self):
        """If the training flag is set, train the metamodel. Otherwise,
        predict outputs.
        """

        # Train first
        if self._train:

            input_data = self._param_data
            if self.warm_restart is False:
                input_data = []
                base = 0
            else:
                base = len(input_data)

            for name in self._surrogate_input_names:
                train_name = "params.%s" % name
                val = self.get(train_name)
                num_sample = len(val)

                for j in xrange(base, base + num_sample):

                    if j > len(input_data) - 1:
                        input_data.append([])
                    input_data[j].append(val[base-j])

            # Surrogate models take an (m, n) list of lists
            # m = number of training samples
            # n = number of inputs
            #
            # TODO - Why not numpy array instead?

            for name in self._surrogate_output_names:

                train_name = "responses.%s" % name
                output_data = self._response_data[name]

                if self.warm_restart is False:
                    output_data = []

                output_data.extend(self.get(train_name))
                surrogate = self._get_surrogate(name)

                if surrogate is not None:
                    surrogate.train(input_data, output_data)

            self._train = False

        # Now Predict for current inputs

        inputs = []
        for name in self._surrogate_input_names:
            val = self.get(name)
            inputs.append(val)

        for name in self._surrogate_output_names:
            surrogate = self._get_surrogate(name)
            if surrogate is not None:
                setattr(self, name, surrogate.predict(inputs))
dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.lib/src/openmdao/lib/components/metamodel.py/MetaModel.execute/swapped operands of `-`