当前位置: 首页>>代码示例>>Python>>正文


Python NeuralNet.forwordProp方法代码示例

本文整理汇总了Python中neuralnet.NeuralNet.forwordProp方法的典型用法代码示例。如果您正苦于以下问题:Python NeuralNet.forwordProp方法的具体用法?Python NeuralNet.forwordProp怎么用?Python NeuralNet.forwordProp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在neuralnet.NeuralNet的用法示例。


在下文中一共展示了NeuralNet.forwordProp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: NeuralNet

# 需要导入模块: from neuralnet import NeuralNet [as 别名]
# 或者: from neuralnet.NeuralNet import forwordProp [as 别名]
    training_one.append(Instance(inp[i][0],inp[i][1])) #Encapsulation of a `input signal : output signal
#------------------------------------------------------------------------------

n_inputs = 4            # Number of  input feature 
n_outputs = 3           # Number of neuron output
n_hiddens = 8           # Number of neuron at each hidden layer
n_hidden_layers = 2     # number of hidden layer
# here 2 Hidden layer with 8 node each and 1 output layer with 3 node 

#------------------------DEclaration of activation or Transfer function at each layer --------------------------------------#
# specify activation functions per layer eg: [ hidden_layer_1, hidden_layer_2, output_layer ]
activation_functions = [symmetric_elliot_function,]*n_hidden_layers + [ sigmoid_function ]

# initialize the neural network
network = NeuralNet(n_inputs, n_outputs, n_hiddens, n_hidden_layers, activation_functions)
# network is Instance of class Neuralnet

# start training on test set one
network.backpropagation(training_one, ERROR_LIMIT=.05, learning_rate=0.2, momentum_factor=0.2  )

# save the trained network
network.save_to_file( "trained_configuration.pkl" )

# load a stored network configuration
# network = NeuralNet.load_from_file( "trained_configuration.pkl" )

# print out the result
for instance in training_one:
    print instance.features, network.forwordProp( np.array([instance.features]) ), "\ttarget:", instance.targets

开发者ID:sudhanshuptl,项目名称:python-neural-network,代码行数:31,代码来源:main.py


注:本文中的neuralnet.NeuralNet.forwordProp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。