Inference from attributes
DanielDimanov opened this issue · 3 comments
Dear @fjxmlzn,
Thank you for your great work! I was wondering if I can use the feature geenrator to generate new features out of given attributes. Based on what I've read in the paper it should be possible and I trained with my data, but I don't fully understand the generate data function. Can you please tell me how I can simply use it as some sort of inference. I want to pass the attributes (same format for the training) and then it spits a features vector conditioned by this set of attributes.
Please help.
Yes, you can do that! sample_from
has a given_attribute
parameter:
DoppelGANger/gan/doppelganger.py
Line 670 in 05f36ec
Adding that when calling sample_from
(e.g.,
Feel free to reopen the issue if you get any problems with it
Hi, thanks for the quick reply and I did manage to get a sample and it does look substantially different from my features, which might be because I didn't train for long enough, but what is stranger is the shape of my generated features, which is my sample_len squared and my array is almost fully empty. I'm slightly confused about the feature_latent_dim
and attribute_latent_dim
. I have 128 different attributes (after the normalisation the shape becomes (n_samples, 130) and then I have 1488 values for my features (31 days of half hourly data). So for generating 100 samples I use the following:
features, attributes, gen_flags, lengths = gan.sample_from( real_attribute_input_noise=real_attribute_input_noise, # shape (100, 130) addi_attribute_input_noise=addi_attribute_input_noise, #shape (100, 130) feature_input_noise=feature_input_noise, # (100, 1488, 1) feature_input_data=feature_input_data, # given_attribute=data_attribute_raw[0:100,:128] # Your normalized and actual attributes )
The problem is that the default in
DoppelGANger/gan/doppelganger.py
Line 30 in 05f36ec
Sorry for the long comment and sorry to bother you. Your help is well appreciated and I appologise if I have missed something silly.
feature_latent_dim
and attribute_latent_dim
mean the dimension of GAN input noise; it is not relevant to any shapes in the data:
DoppelGANger/gan/doppelganger.py
Lines 128 to 131 in 05f36ec
About "when I train with main, then it asks the given_attribute to be (?,5) and the time series is also wierd dimension. ", would you mind showing the error messages you got and the shape of the time series?
Thanks,
Zinan