Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with NOMU in regression folder. #2

Open
aaron-rees opened this issue Sep 7, 2021 · 1 comment
Open

Issue with NOMU in regression folder. #2

aaron-rees opened this issue Sep 7, 2021 · 1 comment

Comments

@aaron-rees
Copy link

Hi,

I'm trying to implement the NOMU model from the regression folder (NOMU/regression/algorithms/model_classes/nomu) and am having an error that I can't seem to fix. I'm hoping you can help me solve this.

Please see the screenshot that hopefully clearly illustrates the problem I'm having but to summarise I've set the parameters, compiled and initialised the NOMU model. I have then created 20 latin hypercube samples and evaluated them with a simple function. These x values and their corresponding y values are then being used to fit the model - this is where the error is being raised and I believe it is because of the y input. I have changed the shape of the input from rows to columns etc. but no luck. Any guidance would be much appreciated.

Best,

Aaron
Screenshot 2021-09-07 at 16 25 55
Screenshot 2021-09-07 at 16 26 04

@JakobHeiss
Copy link
Collaborator

JakobHeiss commented Jun 28, 2022

Hi, sorry for the late reply. We have overlooked your message.

Unfortunately our current version of the code is not very user-friendly. In a few weeks we will update it probably.

The current version has to be used as follows:
If you call your data x_train and y_train, then you have to transform it into another format for NOMU:

First we recommend to re-scale your data to fit into the [-1,1]^d cube.

x_min_aug=-1.1 #change this value if your data has a different range (e.g. -16)
x_max_aug=1.1 #change this value if your data has a different range (e.g. 16)
x_aug = np.random.uniform(low=x_min_aug, high=x_max_aug, size=(n_aug, din)) #if you activate MCaug=True, these values do not matter because they will be overwritten internally by NOMU
y_aug = np.ones((n_aug, 1)) # these values do not matter, only the dimension matters
# data prep (concatenate training and random data & add flag)
x_train = np.concatenate((x_train, np.zeros((n_train, 1))), axis=-1)
x_aug = np.concatenate((x_aug, np.ones((x_aug.shape[0], 1))), axis=-1)
x = np.concatenate((x_train, x_aug))
y = np.concatenate((np.reshape(y_train, (n_train, 1)), y_aug))

The x and y you obtain from this algorithm can be given to NOMU.
For end-users this might seem unnecessary complicated. This is why we want to simplify this in a future version. (The reason for this code was that it gives the user the possibility to choose their own data set for the artificial data points.)

Further we recommend you to set MCaug=True. When you set MCaug=True it is important to set reasonable values for x_min_aug and x_max_aug. If you want to use latin hypercube samples as artificial data points as well, you have to change NOMU/DataGenerator.py (if you want them to be resampled every batch).

model.fit_models(
        x=x,
        y=y,
        verbose = 0,
        x_min_aug = -x_min_aug,
        x_max_aug = x_max_aug,
)

Please, let us know if you have more questions! If we don't reply within a few days, pleas write us a mail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants