tensorflow玻尔兹曼机_采用TensorFlow框架实现一个全连接神经网络拟合正弦函数y=sin(x)...

本文通过TensorFlow实现了一个全连接神经网络,以拟合正弦函数y=sin(x)。文章展示了如何定义三层隐藏层的网络结构,使用sigmoid激活函数,并使用梯度下降优化器进行训练。经过100,000次迭代,对比了标准正弦函数和训练后的神经网络输出,以验证模型效果。" 124895374,10854995,使用C语言实现水仙花数判断与打印,['c语言'],"['水仙花数', 'C语言', '函数', '编程题', '区间', '判断', '打印']
摘要由CSDN通过智能技术生成

import tensorflow as tf

import math

import numpy as np

import matplotlib.pyplot as plt

import types

import pylab

# draw standard sin function

def draw_correct_line():

x=np.arange(0,2*np.pi,0.01)

x=x.reshape(len(x),1)

y=np.sin(x)

pylab.plot(x,y)

plt.axhline(linewidth=1,color='r')

# get train data y=sin(x) 0-2pi take one value

def get_train_data():

train_x=np.random.uniform(0.0,2*np.pi,(1)) # train_input

train_y=np.sin(train_x) # train_label

return train_x,train_y

# define three hidden nets structure

# caution: different variable defined in different scope

# caution: use tf.multiply and tf.matmul matrix calculation

def inference(input_data):

with tf.variable_scope('hidden1',):

weights=tf.get_variabl

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值