楼主: Nicolle
316 24

Solving the MultiLayer Perceptron problem in Python [推广有奖]

版主

巨擘

0%

还不是VIP/贵宾

-

TA的文库  其他...

Python Programming

SAS Programming

Structural Equation Modeling

威望
15
论坛币
12197583 个
学术水平
2693 点
热心指数
2573 点
信用等级
2494 点
经验
411479 点
帖子
16673
精华
73
在线时间
6287 小时
注册时间
2005-4-23
最后登录
2018-2-23

Nicolle 学生认证  发表于 2018-2-13 10:36:43 |显示全部楼层
本帖最后由 Nicolle 于 2018-2-14 08:05 编辑
  1. The brain contains billions of neurons with tens of thousands of connections between them. Deep learning algorithms resemble the brain in many conditions, as both the brain and deep learning models involve a vast number of computation units (Neurons) that are not extraordinarily intelligent in isolation but become intelligent when they interact with each other.
  2. I think people need to understand that deep learning is making a lot of things, behind-the-scenes, much better. Deep learning is already working in Google search, and in image search; it allows you to image search a term like “hug.”— Geoffrey Hinton
复制代码

本帖隐藏的内容

Solving the Multi Layer Perceptron problem in Python.pdf (1.37 MB)



支持楼主:购买VIP购买贵宾 购买后,论坛将奖励 10 元论坛资金给楼主,以表示您对TA发好贴的支持
 
载入中......

本帖被以下文库推荐

stata SPSS
Nicolle 学生认证  发表于 2018-2-13 10:37:48 |显示全部楼层
  1. import numpy as np

  2. print("Enter the two values for input layers")

  3. print('a = ')
  4. a = int(input())
  5. # 2
  6. print('b = ')
  7. b = int(input())
  8. # 3

  9. input_data = np.array([a, b])

  10. weights = {
  11.     'node_0': np.array([1, 1]),
  12.     'node_1': np.array([-1, 1]),
  13.     'output_node': np.array([2, -1])
  14. }

  15. node_0_value = (input_data * weights['node_0']).sum()
  16. # 2 * 1 +3 * 1 = 5
  17. print('node 0_hidden: {}'.format(node_0_value))

  18. node_1_value = (input_data * weights['node_1']).sum()
  19. # 2 * -1 + 3 * 1 = 1
  20. print('node_1_hidden: {}'.format(node_1_value))

  21. hidden_layer_values = np.array([node_0_value, node_1_value])

  22. output_layer = (hidden_layer_values * weights['output_node']).sum()

  23. print("output layer : {}".format(output_layer))
复制代码
回复

使用道具 举报

军旗飞扬 发表于 2018-2-13 10:38:33 |显示全部楼层
本帖最后由 Nicolle 于 2018-2-13 10:40 编辑
  1. import numpy as np

  2. print("Enter the two values for input layers")

  3. print('a = ')
  4. a = int(input())
  5. # 2
  6. print('b = ')
  7. b = int(input())

  8. weights = {
  9.     'node_0': np.array([2, 4]),
  10.     'node_1': np.array([[4, -5]]),
  11.     'output_node': np.array([2, 7])
  12. }

  13. input_data = np.array([a, b])


  14. def relu(input):
  15.     # Rectified Linear Activation
  16.     output = max(input, 0)
  17.     return(output)


  18. node_0_input = (input_data * weights['node_0']).sum()
  19. node_0_output = relu(node_0_input)

  20. node_1_input = (input_data * weights['node_1']).sum()
  21. node_1_output = relu(node_1_input)

  22. hidden_layer_outputs = np.array([node_0_output, node_1_output])

  23. model_output = (hidden_layer_outputs * weights['output_node']).sum()

  24. print(model_output)
复制代码

回复

使用道具 举报

Nicolle 学生认证  发表于 2018-2-13 10:40:36 |显示全部楼层
  1. # Importing Keras Sequential Model
  2. from keras.models import Sequential
  3. from keras.layers import Dense
  4. import numpy

  5. # Initializing the seed value to a integer.
  6. seed = 7

  7. numpy.random.seed(seed)

  8. # Loading the data set (PIMA Diabetes Dataset)
  9. dataset = numpy.loadtxt('datasets/pima-indians-diabetes.csv', delimiter=",")

  10. # Loading the input values to X and Label values Y using slicing.
  11. X = dataset[:, 0:8]
  12. Y = dataset[:, 8]

  13. # Initializing the Sequential model from KERAS.
  14. model = Sequential()

  15. # Creating a 16 neuron hidden layer with Linear Rectified activation function.
  16. model.add(Dense(16, input_dim=8, init='uniform', activation='relu'))

  17. # Creating a 8 neuron hidden layer.
  18. model.add(Dense(8, init='uniform', activation='relu'))

  19. # Adding a output layer.
  20. model.add(Dense(1, init='uniform', activation='sigmoid'))



  21. # Compiling the model
  22. model.compile(loss='binary_crossentropy',
  23.               optimizer='adam', metrics=['accuracy'])
  24. # Fitting the model
  25. model.fit(X, Y, nb_epoch=150, batch_size=10)

  26. scores = model.evaluate(X, Y)

  27. print("%s: %.2f%%" % (model.metrics_names[1], scores[1] * 100))
复制代码
回复

使用道具 举报

啸傲江弧 发表于 2018-2-13 10:53:34 |显示全部楼层
谢谢楼主分享
已有 1 人评分经验 收起 理由
Nicolle + 20 鼓励积极发帖讨论

总评分: 经验 + 20   查看全部评分

回复

使用道具 举报

hjtoh 发表于 2018-2-13 11:12:33 来自手机 |显示全部楼层
Nicolle 发表于 2018-2-13 10:36
**** 本内容被作者隐藏 ****
谢谢分享
已有 1 人评分论坛币 收起 理由
Nicolle + 20 鼓励积极发帖讨论

总评分: 论坛币 + 20   查看全部评分

回复

使用道具 举报

fengyg 企业认证  发表于 2018-2-13 11:56:13 |显示全部楼层
kankan
回复

使用道具 举报

HappyAndy_Lo 发表于 2018-2-13 12:09:00 |显示全部楼层
回复

使用道具 举报

albertwishedu 发表于 2018-2-13 12:18:46 |显示全部楼层
回复

使用道具 举报

life_life 发表于 2018-2-13 12:52:17 |显示全部楼层
看看  看看 ,,
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 我要注册

GMT+8, 2018-2-23 20:38