简体   繁体   English

如何存储神经网络知识数据?

[英]How to store neural network knowledge data?

I am new to that area, so the question may seem strange. 我是那个地区的新手,所以这个问题可能看起来很奇怪。 However before asking I've read bunch of introductory articles about what are the key points about in machine learning and what are the acting parts of neural networks. 然而,在询问之前,我已经阅读了大量关于机器学习的关键点以及神经网络的作用部分的介绍性文章。 Including very useful that one What is machine learning . 包括非常有用的一个什么是机器学习 Basically as I got it - an educated NN is (correct me if it's wrong): 基本上我得到了它 - 一个受过教育的NN(如果错了,请纠正我):

  1. set of connections between neurons (maybe self-connected, may have gates, etc.) 神经元之间的连接集(可能是自连接的,可能有门等)
  2. formed activation probabilities on each connection. 在每个连接上形成激活概率。

Both things are adjusted during the training to fit expected output as close as possible. 在训练期间调整两件事以尽可能接近预期输出。 Then, what we do with an educated NN - we load the test subset of data into it and check how good it performs. 然后,我们用受过教育的NN做什么 - 我们将测试数据子集加载到其中并检查它的执行情况。 But what happens if we're happy with the test results and we want to store the education results and not run training again later when dataset get new values. 但是如果我们对测试结果感到满意并且我们想要存储教育结果而不是在数据集获得新值时再次运行训练会发生什么。

So my question is - is that education knowledge is stored somewhere except RAM? 所以我的问题是 - 教育知识存储在RAM以外的某个地方吗? can be dumped (think of object serialisation in a way) so that you don't need to educate your NN with data you get tomorrow or later. 可以转储(在某种程度上考虑对象序列化),这样您就不需要使用明天或以后获得的数据来教育您的NN。

Now I am trying to make simple demo with my dataset using synaptic.js but I could not spot that kind of concept of saving education in project's wiki. 现在我正在尝试使用synaptic.js使用我的数据集进行简单演示,但我无法发现在项目维基中保存教育的那种概念。 That library is just an example, if you reference some python lib would be good to! 那个库只是一个例子,如果你引用一些python lib会很好!

I will assume in my answer that you are working with a simple multi-layer perceptron (MLP) , although my answer is applicable to other networks too. 我将在答案中假设您正在使用简单的多层感知器(MLP) ,尽管我的答案也适用于其他网络。

The purpose of 'training' an MLP is to find the correct synaptic weights that minimise the error on the network output. “训练”MLP的目的是找到正确的突触权重 ,以最小化网络输出上的错误。

When a neuron is connected to another neuron, its input is given a weight. 当神经元连接到另一个神经元时,其输入被赋予权重。 The neuron performs a function, such as the weighted sum of all inputs, and then outputs the result. 神经元执行一个函数,例如所有输入的加权和,然后输出结果。

Once you have trained your network, and found these weights, you can verify the results using a validation set . 训练网络并找到这些权重后,您可以使用验证集验证结果。

If you are happy that your network is performing well, you simply record the weights that you applied to each connection. 如果您对网络运行良好感到满意,则只需记录应用于每个连接的权重。 You can store these weights wherever you like (along with a description of the network structure) and then retrieve them later. 您可以将这些权重存储在任何位置(以及网络结构的描述),然后再检索它们。 There is no need to re-train the network every time you would like to use it. 每次您想要使用它时都无需重新训练网络。

Hope this helps. 希望这可以帮助。

With regards to storing it via synaptic.js: 关于通过synaptic.js存储它:

This is quite easy to do! 这很容易做到! It actually has a built-in function for this. 它实际上有一个内置的功能。 There are two ways to do this. 有两种方法可以做到这一点。

If you want to use the network without training it again 如果您想在不重新训练的情况下使用网络

This will create a standalone function of your network, you can use it anywhere with javascript without requiring synaptic.js! 这将创建您的网络的独立功能,您可以使用javascript在任何地方使用它,而无需synaptic.js! Wiki 维基

var standalone = myNetwork.standalone();

If you want to modify the network later on 如果您想稍后修改网络

Just convert your network to a JSON. 只需将您的网络转换为JSON即可。 This can be loaded up anytime again with synaptic.js! 这可以随时使用synaptic.js加载! Wiki 维基

// Export the network to a JSON which you can save as plain text
var exported = myNetwork.toJSON();

// Conver the network back to useable network
var imported = Network.fromJSON(exported);

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

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