简体   繁体   English

如何通过 dl4j 正确使用我的神经网络?

[英]How to use my neural net properly with dl4j?

My problem:我的问题:

I implemented a feed forward model and a recurrent model with deeplearning4j to detect anomalies in a 1D signal.我使用 deeplearning4j 实现了一个前馈模型和一个循环模型来检测一维信号中的异常。 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.我有 5 个不同的故障类别,每个类别都有大约 40 个示例。 Each failure has his own "structure".每个失败都有自己的“结构”。
  2. Building a neural net with 5 output neurons, one for each failure.构建一个具有 5 个输出神经元的神经网络,每个失败一个。
  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 u have any ideas?你有什么想法吗?

Thanks in advance!提前致谢!

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 (eg with a window size of 2 the sequence abcd turns into [ab], [bc], [cd] and you get 3 classifications).如果你的真实数据没有足够的数据,你可以填充它,如果它有比示例长度更多的数据,那么你滑过序列(例如,窗口大小为 2,序列 abcd 变成 [ab], [bc]、[cd] 并获得 3 个分类)。

As far as I know there is nothing in DL4J out of the box that implements this solution.据我所知,DL4J 中没有任何东西可以实现这个解决方案。 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.但另一方面,使用RecordConverter.toRecordRecordConverter.toArray将您的真实数据转换为 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.适合您的解决方案完全取决于您的实际具体用例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM