ML4GW / aframev2

Detecting binary black hole mergers in LIGO with neural networks
MIT License
4 stars 14 forks source link

Frequency domain implementation #196

Closed EthanMarx closed 1 week ago

EthanMarx commented 1 month ago

Adds frequency domain implementation. A bit of refactoring is done so the TimeDomainDataset, FrequencyDomainDataset, and SpectrogramDataset can all use build_val_batches. Specifically, the whitening step is now done in the subclasses, since frequency domain whitening is done differently than time domain.

When using frequency domain dataset, there are now some redundant steps (for example, we go to the freq domain to compute SNR). This can be addressed in a separate PR, likely to ml4gw to include tools for working directly in freq domain

EthanMarx commented 1 month ago

@wbenoit26 @deepchatterjeeligo Would appreciate some sanity checking on the frequency domain implementation here whenever you get a chance.

Have a hp search running, and (it appears) we aren't going to come close to the validation score we see in time domain (~0.6). https://wandb.ai/ethanmarx/aframe?nw=nwuserethanmarx

Could be a couple of reasons (e.g. ConvNet may not be as good in freq domain, etc) but curious if there's a data processing thing that I overlooked.

EthanMarx commented 1 month ago

Couple of notes:

We now use kernel_length + fduration of fft'ed data to pass to the network. Motivation being the edges are windowed (see below) to mitigate fft artifacts.

I apply a hann_window to mitigate fft artifacts. It might be that this window is more aggressive than say a tukey window, and killing too much SNR.

I pass the whitened real, imaginary, abs(), and angle of the complex vector. I realize now I probably should standard scale each these since they are different magnitudes (e.g. abs() ~ real**2)

EthanMarx commented 4 weeks ago

@wbenoit26 Made a couple other clean up changes you might want to look at.

EthanMarx commented 4 weeks ago

And FWIW did a test run with the TimeDomainDataset and original training behavior is reproduced over ~20 epochs

wbenoit26 commented 4 weeks ago

Have you started a training with this setup? Just using the real and imaginary parts, I mean

EthanMarx commented 4 weeks ago

No, will launch a run soon trying out the best hps from that search. Will eventually re run a search with just real and imaginary / try out a dense net