Sascha
Sascha

Reputation: 87

How to use my neural net properly with dl4j?

I implemented a feed forward model and a recurrent model with deeplearning4j to detect anomalies in a 1D signal. Maybe I'm missing an abstraction but I thought I could solve this problem the following way:

  1. Preprocess the data. I have 5 different failure categories and have roundabout 40 examples each. Each failure has his own "structure".
  2. Building a neural net with 5 output neurons, one for each failure.
  3. Train and evaluate.
  4. Now I wanted to test my net with real data and it should detect the anomalies in a very long 1D signal. The idea was, that the net should somehow "iterate" over the signal and detect these failures in it.

Is this approach even possible? Do you have any ideas?

Upvotes: -1

Views: 157

Answers (1)

Paul Dubs
Paul Dubs

Reputation: 807

It depends on how the structure to those defects looks like.

Given that you have a 1D signal, I expect that your examples are a sequence of data that is effectively a window over your continuous signal.

There are multiple ways to model that problem:

Sliding window

This works if all of your examples have the same length. In that case, you can make a normal feed forward network, that just takes a fixed number of steps as input and returns a single classification.

If your real data doesn't have enough data, you can pad it, and if it has more data than the example length, then you slide over the sequence (e.g. with a window size of 2 the sequence abcd turns into [ab], [bc], [cd] and you get 3 classifications).

As far as I know there is nothing in DL4J out of the box that implements this solution. But on the other hand it shouldn't be too hard to implement it yourself using RecordConverter.toRecord and RecordConverter.toArray to transform your real data into NDArrays.

Recurrent Network

Using a recurrent network, you can apply a neural network to any length of sequence data. This will likely be your choice if the faults you are looking for can have different lengths in the signal.

The recurrent network can have an internal state that gets updated on each call during inference and it will produce a classification after each step of your signal.

What the right solution is for you, will depend entirely on your actual concrete use case.

Upvotes: 1

Related Questions