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

Is it possible to apply tensorflow custom function? #12

Closed
sungreong opened this issue Aug 25, 2019 · 4 comments
Closed

Is it possible to apply tensorflow custom function? #12

sungreong opened this issue Aug 25, 2019 · 4 comments
Labels
question General question about the software

Comments

@sungreong
Copy link

hello, I see sdgym/synthesizers.

the functions are written by PyTorch.

I usually use TensorFlow.
Is this package also applicable to the TensorFlow code?

and how can I save the learned model?

Thanks

@csala
Copy link
Contributor

csala commented Aug 26, 2019

Hello @sungreong

I'm not entirely sure about understanding you properly, but if you mean whether it is possible to use the benchmarking tool for tensorflow based synthesizers, yes, it is possible.

All you need to do is prepare your synthesizer function following the specification and pass it to the benchmark function:

from sdgym import benchmark
from your_package import your_tensorflow_synthesizer

def your_synthesizer_function(real_data, categorical_columns, ordinal_columns):
    # put the code here to use your_tensorflow_synthesizer to model and sample data
    return sampled_data

benchmark(your_synthesizer_function)

Please, let me know if this is what you were looking for.

@csala csala added the question General question about the software label Aug 26, 2019
@csala
Copy link
Contributor

csala commented Aug 26, 2019

and how can I save the learned model?

You can do so using PyTorch save and load

For this, after fitting your model, you save it using:

import torch

torch.save(synthesizer, '/path/to/your/model.pkl')

And later on load it doing:

import torch

synthesizer = torch.load('/path/to/your/model.pkl')

@sungreong
Copy link
Author

Thank you very much for your quick answer.
If you have time later, I think it will be helpful if you make a brief example of other frameworks such as Tensorflow and Keras.

Oh, I have one question about TGAN paper.
In the paper, there is a way to deal with category missing value variables, and I think it's right to do so.

But if there's no explanation in the paper about a numerical variable that can't be substituted for missing values, is there any way you can recommend it?

@csala
Copy link
Contributor

csala commented Jun 23, 2020

This question has already been answered here, so I'm closing this issue for now.

@csala csala closed this as completed Jun 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question General question about the software
Projects
None yet
Development

No branches or pull requests

2 participants