Skip to content

GPX doesn't support vector outputs #679

@fzahle

Description

@fzahle

The GPX surrogate doesn't seem to support outputs with ny>1, which works for the other surrogates. It runs, but seems to return the response for the first element only. I guess it could be fixed in here in SMT, but possibly also in the upstream egobox tool. Here's a small test that shows the difference between KRG and GPX:

import unittest
import numpy as np

from smt.surrogate_models import GPX, KRG

from smt.examples.rans_crm_wing.rans_crm_wing import get_rans_crm_wing


class TestNY(unittest.TestCase):
    def test_ny_gpx(self):
        xt, yt, _ = get_rans_crm_wing()

        interp = GPX()
        interp.set_training_values(xt, yt)
        interp.train()
        v0 = np.zeros((4, 2))
        for ix, i in enumerate([10, 11, 12, 13]):
            v0[ix, :] = interp.predict_values(np.atleast_2d(xt[i, :]))
        v1 = interp.predict_values(np.atleast_2d(xt[10:14, :]))

        self.assertEqual(v1.shape[1], yt.shape[1])

    def test_ny_krg(self):
        xt, yt, _ = get_rans_crm_wing()

        interp = KRG()
        interp.set_training_values(xt, yt)
        interp.train()
        v0 = np.zeros((4, 2))
        for ix, i in enumerate([10, 11, 12, 13]):
            v0[ix, :] = interp.predict_values(np.atleast_2d(xt[i, :]))
        v1 = interp.predict_values(np.atleast_2d(xt[10:14, :]))
        self.assertEqual(v1.shape[1], yt.shape[1])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions