diff --git a/4.人工智能/4.2机器学习(AI)快速入门(quick start).md b/4.人工智能/4.2机器学习(AI)快速入门(quick start).md
index ea935c9..5376fd1 100644
--- a/4.人工智能/4.2机器学习(AI)快速入门(quick start).md
+++ b/4.人工智能/4.2机器学习(AI)快速入门(quick start).md
@@ -84,19 +84,19 @@
```python
def estimate_house_sales_price(num_of_bedrooms, sqft, neighborhood):
- price = 0 # In my area, the average house costs $200 per sqft
+ price = 0 # In my area, the average house costs $200 per sqft
price_per_sqft = 200 if neighborhood == "hipsterton":
- # but some areas cost a bit more
+ # but some areas cost a bit more
price_per_sqft = 400 elif neighborhood == "skid row":
- # and some areas cost less
- price_per_sqft = 100 # start with a base price estimate based on how big the place is
- price = price_per_sqft * sqft # now adjust our estimate based on the number of bedrooms
+ # and some areas cost less
+ price_per_sqft = 100 # start with a base price estimate based on how big the place is
+ price = price_per_sqft * sqft # now adjust our estimate based on the number of bedrooms
if num_of_bedrooms == 0:
- # Studio apartments are cheap
+ # Studio apartments are cheap
price = price — 20000
else:
- # places with more bedrooms are usually
- # more valuable
+ # places with more bedrooms are usually
+ # more valuable
price = price + (num_of_bedrooms * 1000) return price
```
@@ -212,9 +212,9 @@ def estimate_house_sales_price(num_of_bedrooms, sqft, neighborhood):
```python
def estimate_house_sales_price(num_of_bedrooms, sqft, neighborhood):
price = 0# a little pinch of this
- price += num_of_bedrooms * 0.123# and a big pinch of that
- price += sqft * 0.41# maybe a handful of this
- price += neighborhood * 0.57
+ price += num_of_bedrooms * 0.123# and a big pinch of that
+ price += sqft * 0.41# maybe a handful of this
+ price += neighborhood * 0.57
return price
```
@@ -328,10 +328,10 @@ print('y_pred=',y_test.data)
请注意,我们的神经网络现在有了两个输出(而不仅仅是一个房子的价格)。第一个输出会预测图片是「8」的概率,而第二个则输出不是「8」的概率。概括地说,我们就可以依靠多种不同的输出,利用神经网络把要识别的物品进行分组。
```python
-model = Sequential([Dense(32, input_shape=(784,)),
- Activation('relu'),Dense(10),Activation('softmax')])# 你也可以通过 .add() 方法简单地添加层: model = Sequential()
- model.add(Dense(32, input_dim=784))
- model.add(Activation('relu'))# 激活函数,你可以理解为加上这个东西可以让他效果更好
+model = Sequential([Dense(32, input_shape=(784,)),
+ Activation('relu'),Dense(10),Activation('softmax')])# 你也可以通过 .add() 方法简单地添加层: model = Sequential()
+ model.add(Dense(32, input_dim=784))
+ model.add(Activation('relu'))# 激活函数,你可以理解为加上这个东西可以让他效果更好
```
虽然我们的神经网络要比上次大得多(这次有 324 个输入,上次只有 3 个!),但是现在的计算机一眨眼的功夫就能够对这几百个节点进行运算。当然,你的手机也可以做到。