如何在Predetor Prey数据集上实现GAN模型?

时间:2020-08-15 12:16:26

标签: statistics pytorch generative-adversarial-network

我正在尝试使用GAN架构生成Predator-Prey数据集
显然,两者具有相关性(某些数学函数)。

我需要使用GAN生成它们的数字,而无需找到方程式的参数。
* 我在GAN中相对较新

例如:

Pray     = [50.   50.  50. ...  88.  88.  89.]  # length 10000
Predator = [100.  99.  99. ... 462. 462. 462.]  # length 10000

enter image description here

您如何适应这种情况?
我什至只能使用密集/线性(+ Relu)图层来解决此问题?

我尝试了这一点:(同时从原始数据中采样了1000个值)

class Generator_distribution(nn.Module):
    def __init__(self):
        # initialize nn Module
        super().__init__()
        
        self.layers = nn.ModuleList() 
        
        # architecture
        self.layers.append(nn.Linear(1000,64))
        self.layers.append(nn.LeakyReLU())
        self.layers.append(nn.Linear(64,32))
        self.layers.append(nn.LeakyReLU())
        self.layers.append(nn.Linear(32,1))
        
    def forward(self,input_tensor):
        x = input_tensor
        for l in self.layers:
            x = l(x)
        return x
    
class Discriminator_distribution(nn.Module):
    def __init__(self):
        super().__init__()
        
        self.layers = nn.ModuleList() 
        
        self.layers.append(nn.Linear(1000,32))
        self.layers.append(nn.LeakyReLU())
        self.layers.append(nn.Linear(32,16))
        self.layers.append(nn.LeakyReLU())
        self.layers.append(nn.Linear(16,8))
        self.layers.append(nn.LeakyReLU())
        self.layers.append(nn.Linear(8,1))
        self.layers.append(nn.Sigmoid())
    
    def forward(self,input_tensor):
        x = input_tensor
        for l in self.layers:
            print(x.shape)
            x = l(x)
        return x

# later used :  nn.BCELoss() & Adam()

但是效果不佳: enter image description here

0 个答案:

没有答案