From 4aa20b3ef5fff53cf9c7073cfa5e29acd6a08e22 Mon Sep 17 00:00:00 2001
From: 46135621 <87229030+46135621@users.noreply.github.com>
Date: Thu, 20 Apr 2023 00:00:16 +0800
Subject: [PATCH] =?UTF-8?q?Update=204.2=E6=9C=BA=E5=99=A8=E5=AD=A6?=
=?UTF-8?q?=E4=B9=A0=EF=BC=88AI=EF=BC=89=E5=BF=AB=E9=80=9F=E5=85=A5?=
=?UTF-8?q?=E9=97=A8=EF=BC=88quick=20start=EF=BC=89.md?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
...(AI)快速入门(quick start).md | 30 +++++++++----------
1 file changed, 15 insertions(+), 15 deletions(-)
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 个!),但是现在的计算机一眨眼的功夫就能够对这几百个节点进行运算。当然,你的手机也可以做到。