Convolutional AE always overfitting time series - what's wrong?

Hi there,

I’ve build a CAE for anomaly detection in time series, but it is always overfitting. I’ve tried data augmentation, short/long inputvector, dropout rates… I don’t know what I’m doing wrong, may be you can give me a hint?

This is my architecture

class CAE(nn.Module):
    def __init__(self):
        super(CAE, self).__init__()

        self.encoder = Encoder()
        self.decoder = Decoder()

        self.encoder.to(get_device())
        self.decoder.to(get_device())

    def forward(self, x):
        x = self.encoder(x)
        x = self.decoder(x)
        return x

class Encoder(nn.Module):
    def __init__(self):
        super(Encoder, self).__init__()

        self.conv_enc = nn.Sequential(
            nn.AlphaDropout(p=0.5),
            nn.Conv1d(
                in_channels=1,
                out_channels=16,
                kernel_size=5,
                stride=2,
                padding=0
            ),
            nn.SELU(),
            nn.AlphaDropout(p=0.5),
            nn.Conv1d(
                in_channels=16,
                out_channels=8,
                kernel_size=5,
                stride=2,
                padding=0
            ),
            nn.SELU()
        )

        self.conv_enc.apply(self.init_weights)
            
    def init_weights(self, m):
        if type(m) == nn.Conv1d or type(m) == nn.ConvTranspose1d:
            torch.nn.init.xavier_normal_(m.weight)
            m.bias.data.fill_(0.01)

    def forward(self, x):
        x = self.conv_enc(x)
        return x

class Decoder(nn.Module):
    def __init__(self):
        super(Decoder, self).__init__()

        self.conv_dec = nn.Sequential(
             nn.ConvTranspose1d(
                in_channels=8,
                out_channels=16,
                kernel_size=5,
                stride=2,
                padding=0
            ),
            nn.SELU(),
            #nn.AlphaDropout(p=0.5),
            nn.ConvTranspose1d(
                in_channels=16,
                out_channels=1,
                kernel_size=6,
                stride=2,
                padding=0
            )
        )

        self.conv_dec.apply(self.init_weights)
            
    def init_weights(self, m):
        if type(m) == nn.Conv1d or type(m) == nn.ConvTranspose1d:
            torch.nn.init.xavier_normal_(m.weight)
            m.bias.data.fill_(0.01)

    def forward(self, x):
        x = self.conv_dec(x)
        return x

I’m using following setup

  • optimizer - AdamW with lr=0.0001
  • scheduler - OneCyleLR
  • Normalized Data with MinMaxScaler()
  • loss - L1Loss
  • batchsize - 250
  • trainingsize - 12000 sample
  • inputsize - 800

Thank you guys

Probably weigh too many pars; decrease channels, also you could add weight decay. Try a much larger dataset also. What kind of data aug did you try? What is long short vector?