如何转换我的浮点数以供我的神经网络使用?

发布于 2024-10-07 10:02:12 字数 711 浏览 0 评论 0原文

我一直在阅读一些有关神经元、感知器和多层感知器概念的在线教程。现在,我想在我自己的例子中实现这个概念。我想做的是在我的网络中实现以下简单算法:

假设我们有 4 个浮点数 minus1plus1minus2plus2

if (minus2>plus2) and (minus1<plus1) then return 1
else if (minus2<plus2) and (minus1>plus1) then return -1
else return 0

但我担心的是:

  1. 如何向我的网络提供这些数字:63.8990、-165.177、1.33001 或 0.98401?

  2. 我应该如何选择输入的数量,因为我有 4 个数字,但我不知道是否应该只使用 4 个输入,还是先将所有内容转换为位,然后根据相关位数选择输入的数量?< /p>

  3. 考虑到 3 种类型的输出 (1,-1,0),我是否应该在输出层中需要 3 个神经元,每个神经元代表一种特定类型的答案,或者也许我应该训练网络分别学习每种类型的答案 (1对于第一个网络,-1 表示第二个网络,0 表示最后一个网络)?

提前感谢大家的阅读,非常感谢

Stephane的帮助

I've been reading some online tutorials about Neurons, Percepton and Multi Layer Perceptron concepts. Now, I would like to implement the concept in my own examples. What I would like to do is to implement the following simple algorithm into my network:

Assuming we have 4 floating numbers minus1, plus1, minus2, plus2

if (minus2>plus2) and (minus1<plus1) then return 1
else if (minus2<plus2) and (minus1>plus1) then return -1
else return 0

But here are my concerns:

  1. How do I feed my network with such numbers: 63.8990, -165.177, 1.33001 or 0.98401?

  2. How should I choose the number of inputs as I have 4 numbers but I don't know if I should use just 4 inputs or convert everything in bits first and choose the number of inputs according to the numbers of related bits?

  3. Considering the 3 types of output (1,-1,0) should I need 3 neurons in my output layer each one representing a specific type of answer or maybe I should train the network to learn seperately each kind of answer (1 for the first network, -1 for the second and 0 for the last one) ?

Thank you all in advance for even reading and your help is highly appreciated

Stephane

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你的背包 2024-10-14 10:02:12

问题有点模糊。我将其解释为:

您正在尝试使用神经网络实现函数 f(m1, p1, m2, p2) (由该 if 子句给出的定义)。

对于 (1),您需要考虑如何表示网络,这受到您所使用的网络类型的影响。

对于 (2),要训练网络,您需要使用真实值(即 m1、p1、m2、p2 和 f(m1、p1、m2、p2) 的实例) 。

对于 (3),您实际上并没有 3 种类型的输出。相反,您有 3 种可能的输出。当然,可以训练 3 个网络在该特定输出为答案时做出响应,但您也可以(使用适当类型的网络)使用具有一个输出的网络实现相同的效果。

The question's abit vague. I shall interpret it as:

You are trying to implement the function f(m1, p1, m2, p2) (definition given by that if clause) using neural networks.

For (1), you need to consider how you are representing the network, which is affected by what type of network you are using.

For (2), to train the network, you'll need to use use true values (i.e. instances of m1, p1, m2, p2, and f(m1, p1, m2, p2)).

For (3), you don't really have 3 types of outputs. Rather, you have 3 possible outputs. Of course, it is possible to train 3 networks to respond when that particular output is the answer, but you can also (with the proper type of network) achieve the same with a network with one output.

把梦留给海 2024-10-14 10:02:12

1)我不确定你使用什么样的数字来喂养你的神经网络(神经网络[或感知器])是否重要。这就是说,您可以使 4 个输入节点接受带符号的浮点数(或带符号的十进制,如果可用),这样您就可以让所有输入都接受相同类型的数据进行处理。当您将输入乘以加权值时,您很可能在神经网络内得到浮点数或小数值。

2) 我通常会说,由于您有 4 个数据点,因此 NN 的 4 个输入是一个很好的起点!

3) 至于输出,整个神经网络完全有可能有一个输出节点。要使用此设计,需要一个阈值函数,用于获取神经网络的最终输出并将其转换为可用值。在你的例子中,我建议将低于-0.5的任何输出分类为-1,将-0.5和+0.5之间的任何输出分类为0,将高于+0.5的任何输出分类为1。

例如

Value           | Output
----------------|----------
< -0.5          | -1
-0.5 < x < +0.5 | 0
x > +0.5        | +1 

1) I'm not sure that it matters what kind of numbers you use to feed your NN (Neural Network [or perceptron]). This is to say that you could make the 4 input nodes accept a signed floating point number (or signed Decimal if its available) This way you can have the inputs all accepting the same type of data for processing. As you will multiply the input by a weighted value you would most likely get a float or a decimal value anyway within the NN.

2) I would generally say that as you have 4 data points, that 4 inputs to the NN is a good starting point!

3) As for the output it is perfectly possibly to have one output node for the entire NN. To use this design there will need to be a threshold function which takes the final output from the NN and converts it to usable values. in your example I would suggest that anything below -0.5 you classify as -1, any output between -0.5 and +0.5 you classify as 0 and anything above +0.5 you classify as 1.

e.g.

Value           | Output
----------------|----------
< -0.5          | -1
-0.5 < x < +0.5 | 0
x > +0.5        | +1 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文