网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 时尚美容

【Mathematica】用神经网络来拟合数据

时间:2024-10-12 15:22:29

1、把非线性数据,转化为训练集:data = Table[x -> Sin[10 x]*Exp[-x^2], {x, -3, 3, .1}]训练集一定是个集合的元素的一一对应。

【Mathematica】用神经网络来拟合数据

3、创建一个神经网络:net = NetChain[{10, Ramp, 10, Tanh, 1}, "Input" -> "Sc锾攒揉敫alar", "Output" -> "Scalar"];里面有五个层。

【Mathematica】用神经网络来拟合数据

5、可视化训练结果:Show[ListLinePlot[d0,PlotStyle->Red,PlotRange->All],Plot[tnet[x],{x,-3,3},PlotStyle->Green,PlotRange->All]]

【Mathematica】用神经网络来拟合数据

7、下面是训练2秒的结果:

【Mathematica】用神经网络来拟合数据
© 一点知道