From c55f956656cdbdd7c24c12d177e6898ed90af062 Mon Sep 17 00:00:00 2001 From: xiaopeng <1509442308@qq.com> Date: Fri, 29 May 2026 15:13:27 +0800 Subject: [PATCH] =?UTF-8?q?sync(latex):=20=E4=BB=8E=20Word=20=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E7=AC=AC=E4=BA=8C=E7=AB=A0=E5=92=8C=E9=99=84=E5=BD=95?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ch02: 第5节重写为"环境-智能体框架",新增表2.1/2.2和图2.1 - ch01: 补充 Garrity 引用来源 - 全部附录(ap01-ap09)从 Word 重新转换,修复 \sub 等转换错误 - 新增 ch13 结语占位、上下篇分隔页 Co-Authored-By: Claude Opus 4.7 --- appendices/ap00-divider.tex | 4 +- appendices/ap01-programming.tex | 404 ++++---- appendices/ap02-vibe-coding.tex | 235 +++-- appendices/ap03-academic-writing.tex | 45 +- appendices/ap04-web-tools.tex | 170 ++-- appendices/ap05-online-resources.tex | 48 +- appendices/ap06-more-resources.tex | 47 +- appendices/ap07-references.tex | 3 +- appendices/ap08-glossary.tex | 26 +- appendices/ap09-tips.tex | 5 +- chapters/ch01-intro.tex | 340 +++---- chapters/ch02-framework.tex | 1302 +++++++++++++------------- chapters/ch13-conclusion.tex | 49 + chapters/divider-lower.tex | 2 + chapters/divider-upper.tex | 2 + main.tex | 5 + 16 files changed, 1414 insertions(+), 1273 deletions(-) create mode 100644 chapters/ch13-conclusion.tex create mode 100644 chapters/divider-lower.tex create mode 100644 chapters/divider-upper.tex diff --git a/appendices/ap00-divider.tex b/appendices/ap00-divider.tex index a7ac3ae..05d4efc 100644 --- a/appendices/ap00-divider.tex +++ b/appendices/ap00-divider.tex @@ -1,2 +1,2 @@ -\chapter{附录} - +\chapter*{附录} +\addcontentsline{toc}{chapter}{附录} diff --git a/appendices/ap01-programming.tex b/appendices/ap01-programming.tex index dcd3289..fe2d08e 100644 --- a/appendices/ap01-programming.tex +++ b/appendices/ap01-programming.tex @@ -1,18 +1,18 @@ -\chapter{附录1:计算机基础与编程环境} +\chapter{计算机基础与编程环境} 本附录介绍计算机的基本构成、操作系统常见操作、程序设计语言的概念、Python编程语言的系统学习指南,以及机器学习与深度学习的实践入门。 -\subsubsection{计算机的基本构成与操作系统常见操作} +\subsection{计算机的基本构成与操作系统常见操作} -\paragraph{计算机基本构成} +\subsubsection{计算机基本构成} 了解计算机的基本组成有助于理解AI程序运行时的资源需求。 {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2194}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2599}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3778}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2368}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3026}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.4342}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 组件 @@ -33,11 +33,12 @@ GPU & 图形处理器,并行计算 & 深度学习训练与推理的核心硬 \end{longtable} } -\paragraph{操作系统常见操作} +\subsubsection{操作系统常见操作} -本书以 macOS/Linux 为主要环境,Windows 用户推荐使用 WSL2(Windows Subsystem for Linux)。 +本书以 macOS/Linux 为主要环境,Windows 用户推荐使用 WSL2(Windows +Subsystem for Linux)。 -\subparagraph{文件与目录操作:} +\paragraph{文件与目录操作:} \emph{\# 查看当前路径}\\ pwd\\ @@ -56,7 +57,7 @@ cp file.txt backup.txt\\ mv old.txt new.txt\\ rm unwanted.txt -\subparagraph{环境与进程管理:} +\paragraph{环境与进程管理:} \emph{\# 查看系统资源}\\ top \emph{\# CPU和内存使用}\\ @@ -67,17 +68,18 @@ nvidia-smi \emph{\# GPU状态(NVIDIA显卡)}\\ brew install xxx \emph{\# macOS Homebrew}\\ apt install xxx \emph{\# Ubuntu/Debian} -\paragraph{硬件资源推荐} +\subsubsection{硬件资源推荐} -\textbf{本地GPU配置}: - GPU:RTX 3060 (12GB) 或更高 - 内存:16GB+ - 存储:至少100GB SSD +\textbf{本地GPU配置}: - GPU:RTX 3060 (12GB) 或更高 - 内存:16GB+ - +存储:至少100GB SSD \textbf{云平台}: {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2003}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1245}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1185}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2639}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1528}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1528}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 平台 @@ -97,9 +99,11 @@ AutoDL & 按时计费 & 中期项目 \\ \end{longtable} } -\paragraph{软件安装与运行} +\subsubsection{软件安装与运行} -\textbf{“安装”的本质就是}:把编译好的二进制文件放到 PATH 某个目录下,让 shell 能找到它。例如git的安装和使用: \textbf{总结:三层抽象} +\textbf{``安装''的本质就是}:把编译好的二进制文件放到 PATH +某个目录下,让 shell 能找到它。例如git的安装和使用: +\textbf{总结:三层抽象} ┌─────────────────────────────────────────────┐\\ │ 用户层:brew install git / git clone │ ← 你看到的\\ @@ -111,23 +115,26 @@ AutoDL & 按时计费 & 中期项目 \\ │ 硬件层:CPU 执行指令、网卡收发数据、磁盘写入 │ ← 物理上发生了什么\\ └─────────────────────────────────────────────┘ -所以整个链条是:\textbf{包管理器下载编译好的二进制 → 放到 PATH 目录 → shell 通过 PATH 找到它 → execve 加载到内存 →} +所以整个链条是:\textbf{包管理器下载编译好的二进制 → 放到 PATH 目录 → +shell 通过 PATH 找到它 → execve 加载到内存 →} -\textbf{二进制内部调用 OS API 完成实际工作}。没有任何“魔法”,本质上就是文件操作和进程管理的组合。 +\textbf{二进制内部调用 OS API +完成实际工作}。没有任何“魔法”,本质上就是文件操作和进程管理的组合。 -\subsubsection{程序设计语言与软件开发} +\subsection{程序设计语言与软件开发} -\paragraph{什么是程序设计语言} +\subsubsection{什么是程序设计语言} -计算机只能执行由0和1组成的\textbf{机器码}(machine code),但人类直接阅读和编写机器码极其困难。程序设计语言就是人与计算机之间的桥梁------用人类可读的语法表达逻辑,再通过特定工具转换为机器可执行的指令。 +计算机只能执行由0和1组成的\textbf{机器码}(machine +code),但人类直接阅读和编写机器码极其困难。程序设计语言就是人与计算机之间的桥梁——用人类可读的语法表达逻辑,再通过特定工具转换为机器可执行的指令。 从底层到高层的演进: {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1185}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2548}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.4249}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1429}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3506}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.4805}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 层级 @@ -147,7 +154,7 @@ AutoDL & 按时计费 & 中期项目 \\ \end{longtable} } -\paragraph{编译型与解释型语言} +\subsubsection{编译型与解释型语言} 高级语言需要转换为机器码才能运行,根据转换方式的不同,分为两大类: @@ -175,16 +182,17 @@ Ruby:Web开发(Ruby on Rails) 特点:开发灵活、调试方便,但运行速度通常慢于编译型语言。 -\textbf{混合模式}:Java 采用“编译为字节码 → 虚拟机解释执行”的混合方式,兼顾了跨平台和性能。 +\textbf{混合模式}:Java 采用“编译为字节码 → +虚拟机解释执行”的混合方式,兼顾了跨平台和性能。 -\paragraph{常见编程语言概览} +\subsubsection{常见编程语言概览} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1266}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.0951}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.3546}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.3258}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1512}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1047}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.3605}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.3605}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 语言 @@ -200,7 +208,8 @@ Ruby:Web开发(Ruby on Rails) \bottomrule\noalign{} \endlastfoot Python & 解释型 & AI、数据科学、自动化 & 本书主要编程语言 \\ -C/C++ & 编译型 & 操作系统、嵌入式、高性能计算 & 深度学习框架的底层实现 \\ +C/C++ & 编译型 & 操作系统、嵌入式、高性能计算 & +深度学习框架的底层实现 \\ Java & 混合型 & 企业应用、Android开发 & 大数据处理(Hadoop/Spark) \\ JavaScript & 解释型 & 网页前端、Node.js后端 & Web可视化、交互设计 \\ Shell/Bash & 解释型 & 命令行脚本、系统管理 & 自动化任务、环境管理 \\ @@ -208,15 +217,19 @@ SQL & 声明式 & 数据库查询 & 数据管理与提取 \\ \end{longtable} } -\textbf{命令行界面(CLI)}:CLI(Command Line Interface)是通过文本命令与计算机交互的方式。终端中输入的每一条命令(如 ls、git commit)本质上都是调用某个程序。掌握 CLI 是进行AI开发的基础技能,许多工具(如 conda、pip、git)主要通过命令行操作。 +\textbf{命令行界面(CLI)}:CLI(Command Line +Interface)是通过文本命令与计算机交互的方式。终端中输入的每一条命令(如 +ls、git commit)本质上都是调用某个程序。掌握 CLI +是进行AI开发的基础技能,许多工具(如 +conda、pip、git)主要通过命令行操作。 -\paragraph{软件开发基本概念} +\subsubsection{软件开发基本概念} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1379}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3042}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.5579}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1327}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3186}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.5310}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 概念 @@ -229,18 +242,21 @@ SQL & 声明式 & 数据库查询 & 数据管理与提取 \\ \endhead \bottomrule\noalign{} \endlastfoot -集成开发环境 & IDE & 集成代码编辑、调试、运行的开发工具(如 VS Code、PyCharm) \\ +集成开发环境 & IDE & 集成代码编辑、调试、运行的开发工具(如 VS +Code、PyCharm) \\ 编译器 & Compiler & 将源代码翻译为机器码的程序 \\ 解释器 & Interpreter & 逐行读取并执行源代码的程序 \\ 调试器 & Debugger & 帮助定位和修复代码错误的工具 \\ -包管理器 & Package Manager & 管理第三方库的安装和更新(如 pip、conda、npm) \\ -API & Application Programming Interface & 程序之间交互的接口(如调用AI模型的API) \\ +包管理器 & Package Manager & 管理第三方库的安装和更新(如 +pip、conda、npm) \\ +API & Application Programming Interface & +程序之间交互的接口(如调用AI模型的API) \\ 开源 & Open Source & 源代码公开,可自由使用和修改 \\ 版本控制 & Version Control & 管理代码的修改历史(如 Git) \\ \end{longtable} } -\paragraph{Python环境配置}\label{pythonux73afux5883ux914dux7f6e} +\subsubsection{Python环境配置} Python是本书使用的核心编程语言,以下介绍环境搭建方法。 @@ -248,10 +264,10 @@ Anaconda vs Miniconda {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1265}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1092}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1422}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1599}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1165}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.0971}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1262}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.6408}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 工具 @@ -266,8 +282,10 @@ Anaconda vs Miniconda \endhead \bottomrule\noalign{} \endlastfoot -Anaconda & \textasciitilde500MB & 预装常用库 & \href{https://www.anaconda.com/download}{anaconda.com} \\ -Miniconda & \textasciitilde50MB & 精简安装 & \href{https://docs.conda.io/en/latest/miniconda.html}{docs.conda.io} \\ +Anaconda & \textasciitilde500MB & 预装常用库 & +\href{https://www.anaconda.com/download}{anaconda.com} \\ +Miniconda & \textasciitilde50MB & 精简安装 & +\href{https://docs.conda.io/en/latest/miniconda.html}{docs.conda.io} \\ \end{longtable} } @@ -285,15 +303,18 @@ conda install numpy pandas scipy\\ \# 4. 安装深度学习框架\\ pip install torch torchvision -\subsubsection{Python编程语言}\label{pythonux7f16ux7a0bux8bedux8a00} +\subsection{Python编程语言} -\subparagraph{Python概述与特点}\label{pythonux6982ux8ff0ux4e0eux7279ux70b9} +\paragraph{Python概述与特点} -Python由Guido van Rossum于1991年发布,以”优雅”\,”简洁”\,”可读性强”为设计哲学。它是当前AI和数据科学领域使用最广泛的编程语言。 +Python由Guido van +Rossum于1991年发布,以“优雅”\,``简洁“``可读性强”为设计哲学。它是当前AI和数据科学领域使用最广泛的编程语言。 -\textbf{核心特点}: - 语法简洁,接近自然语言,入门门槛低 - 丰富的第三方库生态(AI、数据处理、Web等) - 跨平台运行(Windows、macOS、Linux) - 活跃的开源社区支持 +\textbf{核心特点}: - 语法简洁,接近自然语言,入门门槛低 - +丰富的第三方库生态(AI、数据处理、Web等) - +跨平台运行(Windows、macOS、Linux) - 活跃的开源社区支持 -\subparagraph{基础语法} +\paragraph{基础语法} 变量与数据类型 @@ -304,7 +325,8 @@ chapter\_count = 26 \emph{\# 整数 int}\\ is\_published = True \emph{\# 布尔值 bool}\\ \strut \\ \emph{\# 查看类型}\\ -print(type(name)) \emph{\# \textless class \textquotesingle str\textquotesingle\textgreater{}} +print(type(name)) \emph{\# \textless class +\textquotesingle str\textquotesingle\textgreater{}} 字符串操作 @@ -332,7 +354,7 @@ print(len(title)) \emph{\# 长度} \strut \\ \emph{\# 好的注释解释"为什么",而不是"做什么"} -\subparagraph{数据结构} +\paragraph{数据结构} 列表(List) @@ -387,10 +409,9 @@ rgb = (255, 128, 0) \begin{enumerate} \def\labelenumi{\arabic{enumi}.} +\tightlist \item -\begin{verbatim} -g, b = rgb -\end{verbatim} + g, b = rgb \end{enumerate} 集合(Set) @@ -404,7 +425,7 @@ tools\_b = \{"Figma", "Blender", "Rhino"\}\\ print(tools\_a \& tools\_b) \emph{\# 交集: \{"Figma"\}}\\ print(tools\_a \textbar{} tools\_b) \emph{\# 并集} -\subparagraph{控制流} +\paragraph{控制流} 条件判断 @@ -446,9 +467,10 @@ squares.append(x ** 2)\\ squares = {[}x ** 2 \textbf{for} x \textbf{in} range(10){]}\\ \strut \\ \emph{\# 带条件过滤}\\ -even\_squares = {[}x ** 2 \textbf{for} x \textbf{in} range(10) \textbf{if} x \% 2 == 0{]} +even\_squares = {[}x ** 2 \textbf{for} x \textbf{in} range(10) +\textbf{if} x \% 2 == 0{]} -\subparagraph{函数与模块} +\paragraph{函数与模块} 定义函数 @@ -484,25 +506,19 @@ train\_model(100, optimizer="SGD", lr=0.1) \textbf{import} pandas \textbf{as} pd -\begin{verbatim} -\end{verbatim} - \emph{\# 从模块中导入特定功能} \textbf{from} pathlib \textbf{import} Path \textbf{from} collections \textbf{import} Counter -\begin{verbatim} -\end{verbatim} - \emph{\# 安装第三方库(在终端中执行)} -\begin{verbatim} +\begin{lstlisting} # pip install numpy pandas matplotlib -\end{verbatim} +\end{lstlisting} -\subparagraph{3.6 文件读写} +\paragraph{3.6 文件读写} \emph{\# 读取文件} @@ -518,9 +534,6 @@ content = f.read() print(line.strip()) -\begin{verbatim} -\end{verbatim} - \emph{\# 写入文件} \textbf{with} open("output.txt", "w", encoding="utf-8") \textbf{as} f: @@ -529,46 +542,35 @@ f.write("分析结果\textbackslash n") f.write(f"准确率: \{acc:.4f\}\textbackslash n") -\begin{verbatim} -\end{verbatim} - \emph{\# 读写JSON(AI应用中常用的数据格式)} \textbf{import} json -\begin{verbatim} -\end{verbatim} - data = \{"model": "ResNet", "accuracy": 0.96\} -\begin{verbatim} -\end{verbatim} - \emph{\# 写入JSON} \textbf{with} open("result.json", "w") \textbf{as} f: json.dump(data, f, indent=2) -\begin{verbatim} -\end{verbatim} - \emph{\# 读取JSON} \textbf{with} open("result.json", "r") \textbf{as} f: -\begin{verbatim} +\begin{lstlisting} loaded = json.load(f) -\end{verbatim} +\end{lstlisting} -\subparagraph{面向对象编程基础} +\paragraph{面向对象编程基础} 面向对象编程(OOP)是Python的重要范式,许多AI库都基于OOP设计。 \textbf{class} NeuralNetwork:\\ \emph{"""简单的神经网络类"""}\\ \strut \\ -\textbf{def} \_\_init\_\_(self, input\_size, hidden\_size, output\_size):\\ +\textbf{def} \_\_init\_\_(self, input\_size, hidden\_size, +output\_size):\\ \emph{"""初始化网络结构"""}\\ self.input\_size = input\_size\\ self.hidden\_size = hidden\_size\\ @@ -578,7 +580,8 @@ self.loss\_history = {[}{]}\\ \textbf{def} forward(self, x):\\ \emph{"""前向传播"""}\\ \emph{\# 这里简化为概念演示}\\ -\textbf{return} f"输出: 输入\{x\}经过\{self.hidden\_size\}个隐藏层神经元"\\ +\textbf{return} f"输出: +输入\{x\}经过\{self.hidden\_size\}个隐藏层神经元"\\ \strut \\ \textbf{def} train(self, data, epochs=10):\\ \emph{"""训练网络"""}\\ @@ -588,13 +591,14 @@ self.loss\_history.append(loss)\\ print(f"Epoch \{epoch+1\}, Loss: \{loss:.4f\}")\\ \strut \\ \emph{\# 创建实例}\\ -model = NeuralNetwork(input\_size=784, hidden\_size=128, output\_size=10)\\ +model = NeuralNetwork(input\_size=784, hidden\_size=128, +output\_size=10)\\ \strut \\ \emph{\# 使用}\\ output = model.forward({[}0.5, 0.3, 0.8{]})\\ model.train(data=None, epochs=5) -\paragraph{核心科学计算库} +\subsubsection{核心科学计算库} NumPy:数值计算基础 @@ -615,7 +619,7 @@ print(np.mean(x)) \emph{\# 均值}\\ print(np.std(x)) \emph{\# 标准差}\\ print(np.max(x)) \emph{\# 最大值} -\subparagraph{Pandas:数据处理}\label{pandasux6570ux636eux5904ux7406} +\paragraph{Pandas:数据处理} \textbf{import} pandas \textbf{as} pd\\ \strut \\ @@ -634,9 +638,10 @@ df = df.dropna() \emph{\# 删除缺失值}\\ print(df.describe()) \emph{\# 描述性统计}\\ \strut \\ \emph{\# 筛选数据}\\ -filtered = df{[}df{[}\textquotesingle accuracy\textquotesingle{]} \textgreater{} 0.9{]} +filtered = df{[}df{[}\textquotesingle accuracy\textquotesingle{]} +\textgreater{} 0.9{]} -\subparagraph{Matplotlib:数据可视化}\label{matplotlibux6570ux636eux53efux89c6ux5316} +\paragraph{Matplotlib:数据可视化} \textbf{import} matplotlib.pyplot \textbf{as} plt\\ \strut \\ @@ -651,16 +656,16 @@ plt.title(\textquotesingle Training Loss Curve\textquotesingle)\\ plt.savefig(\textquotesingle loss\_curve.png\textquotesingle, dpi=150)\\ plt.show() -\subsubsection{AI工具库速查与模型资源}\label{aiux5de5ux5177ux5e93ux901fux67e5ux4e0eux6a21ux578bux8d44ux6e90} +\subsection{AI工具库速查与模型资源} -\paragraph{工具库速查} +\subsubsection{工具库速查} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1422}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1383}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.3840}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.3081}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1340}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1443}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.4227}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.2784}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 类别 @@ -676,17 +681,22 @@ plt.show() \bottomrule\noalign{} \endlastfoot 计算机视觉 & OpenCV & pip install opencv-python & 图像处理、视频分析 \\ -目标检测 & Ultralytics & pip install ultralytics & YOLO目标检测、实例分割 \\ -图像生成 & Diffusers & pip install diffusers & Stable Diffusion模型调用 \\ -Agent开发 & LangChain & pip install langchain langchain-openai & LLM应用开发框架 \\ +目标检测 & Ultralytics & pip install ultralytics & +YOLO目标检测、实例分割 \\ +图像生成 & Diffusers & pip install diffusers & Stable +Diffusion模型调用 \\ +Agent开发 & LangChain & pip install langchain langchain-openai & +LLM应用开发框架 \\ Agent开发 & LangGraph & pip install langgraph & 状态机式Agent开发 \\ -数据检索 & LlamaIndex & pip install llama-index & 数据索引与检索(RAG) \\ +数据检索 & LlamaIndex & pip install llama-index & +数据索引与检索(RAG) \\ \end{longtable} } -\paragraph{模型资源} +\subsubsection{模型资源} -\subparagraph{\texorpdfstring{Hugging Face:\href{https://huggingface.co/}{huggingface.co}}{Hugging Face:huggingface.co}}\label{hugging-facehuggingface.co} +\paragraph{\texorpdfstring{Hugging +Face:\href{https://huggingface.co/}{huggingface.co}}{Hugging Face:huggingface.co}}\label{hugging-facehuggingface.co} 功能:模型仓库、数据集、Spaces在线演示 @@ -694,9 +704,9 @@ Agent开发 & LangGraph & pip install langgraph & 状态机式Agent开发 \\ {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1421}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2163}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3845}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1625}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2750}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.5375}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 任务 @@ -709,24 +719,25 @@ Hugging Face ID \endhead \bottomrule\noalign{} \endlastfoot -文生图 & Stable Diffusion XL & stabilityai/stable-diffusion-xl-base-1.0 \\ +文生图 & Stable Diffusion XL & +stabilityai/stable-diffusion-xl-base-1.0 \\ 目标检测 & YOLOv8 & Ultralytics \\ 语义分割 & SAM & segment-anything \\ 大语言模型 & Llama 3 & meta-llama/Meta-Llama-3-8B \\ \end{longtable} } -\subsubsection{4 机器学习与深度学习入门教程} +\section{机器学习与深度学习入门教程} 本节通过一个完整的实践流程,带领读者从数据准备到模型训练,体验机器学习和深度学习的核心步骤。 -\paragraph{机器学习 vs 深度学习} +\subsubsection{机器学习 vs 深度学习} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1185}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.4054}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3778}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1358}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.4198}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.4198}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 维度 @@ -747,15 +758,15 @@ Hugging Face ID \end{longtable} } -\paragraph{scikit-learn:机器学习实践}\label{scikit-learnux673aux5668ux5b66ux4e60ux5b9eux8df5} +\subsubsection{scikit-learn:机器学习实践} scikit-learn是Python最经典的机器学习库,提供了丰富的算法和工具。 -\subparagraph{安装} +\paragraph{安装} pip install scikit-learn -\subparagraph{完整示例:鸢尾花分类} +\paragraph{完整示例:鸢尾花分类} \textbf{import} numpy \textbf{as} np @@ -763,7 +774,8 @@ pip install scikit-learn \textbf{from} sklearn \textbf{import} datasets -\textbf{from} sklearn.model\_selection \textbf{import} train\_test\_split +\textbf{from} sklearn.model\_selection \textbf{import} +train\_test\_split \textbf{from} sklearn.preprocessing \textbf{import} StandardScaler @@ -773,9 +785,10 @@ pip install scikit-learn \textbf{from} sklearn.ensemble \textbf{import} RandomForestClassifier -\textbf{from} sklearn.metrics \textbf{import} accuracy\_score, classification\_report +\textbf{from} sklearn.metrics \textbf{import} accuracy\_score, +classification\_report -\paragraph{}\label{section-6} +\subsubsection{}\label{section} \emph{\# 1. 加载数据} @@ -787,22 +800,16 @@ y = iris.target \emph{\# 标签:三种鸢尾花} print(f"数据集大小: \{X.shape\}, 类别数: \{len(np.unique(y))\}") -\begin{verbatim} -\end{verbatim} - \emph{\# 2. 划分训练集和测试集} X\_train, X\_test, y\_train, y\_test = train\_test\_split( -\begin{verbatim} +\begin{lstlisting} X, y, test_size=0.3, random_state=42 -\end{verbatim} +\end{lstlisting} ) -\begin{verbatim} -\end{verbatim} - \emph{\# 3. 数据标准化} scaler = StandardScaler() @@ -811,9 +818,6 @@ X\_train = scaler.fit\_transform(X\_train) X\_test = scaler.transform(X\_test) -\begin{verbatim} -\end{verbatim} - \emph{\# 4. 训练多个模型并比较} models = \{ @@ -826,9 +830,9 @@ models = \{ "随机森林": RandomForestClassifier(n\_estimaors=100), \end{quote} -\begin{verbatim} +\begin{lstlisting} } -\end{verbatim} +\end{lstlisting} \textbf{for} name, model \textbf{in} models.items(): @@ -848,20 +852,21 @@ y\_pred = best\_model.predict(X\_test) print("\textbackslash n分类报告:") -\begin{verbatim} +\begin{lstlisting} print(classification_report(y_test, y_pred, target_names=iris.target_names)) -\end{verbatim} +\end{lstlisting} -\subparagraph{机器学习工作流总结} +\paragraph{机器学习工作流总结} 数据收集 → 数据预处理 → 特征工程 → 划分训练/测试集\\ → 选择模型 → 训练 → 评估 → 调优 → 部署 -\paragraph{PyTorch:深度学习实践}\label{pytorchux6df1ux5ea6ux5b66ux4e60ux5b9eux8df5} +\subsubsection{PyTorch:深度学习实践} -PyTorch是当前研究和实验中最流行的深度学习框架,以动态计算图和Pythonic API著称。 +PyTorch是当前研究和实验中最流行的深度学习框架,以动态计算图和Pythonic +API著称。 -\subparagraph{张量(Tensor)基础} +\paragraph{张量(Tensor)基础} 张量是PyTorch的核心数据结构,类似于NumPy数组,但可以在GPU上运算。 @@ -884,7 +889,7 @@ arr = np.array({[}1, 2, 3{]})\\ tensor = torch.from\_numpy(arr) \emph{\# NumPy → Tensor}\\ back = tensor.numpy() \emph{\# Tensor → NumPy} -\subparagraph{自动求导(Autograd)} +\paragraph{自动求导(Autograd)} PyTorch的autograd模块可以自动计算梯度,是训练神经网络的核心。 @@ -898,7 +903,7 @@ y = x ** 2 + 3 * x + 1 \emph{\# y = x² + 3x + 1}\\ y.backward()\\ print(f"dy/dx = \{x.grad\}") \emph{\# 应为 2x + 3 = 7(x=2时)} -\subparagraph{完整示例:手写数字识别} +\paragraph{完整示例:手写数字识别} 以下是一个完整的神经网络训练流程,使用经典的MNIST数据集。 @@ -910,33 +915,31 @@ print(f"dy/dx = \{x.grad\}") \emph{\# 应为 2x + 3 = 7(x=2时)} \textbf{from} torchvision \textbf{import} datasets, transforms -\subparagraph{}\label{section-7} +\paragraph{}\label{section-4} \emph{\# 1. 数据准备} transform = transforms.Compose({[} -\begin{verbatim} +\begin{lstlisting} transforms.ToTensor(), # 转为张量 -\end{verbatim} +\end{lstlisting} transforms.Normalize((0.1307,), (0.3081,)) \emph{\# 标准化} {]}) -train\_dataset = datasets.MNIST(\textquotesingle./data\textquotesingle, train=True, download=True, transform=transform) +train\_dataset = datasets.MNIST(\textquotesingle./data\textquotesingle, +train=True, download=True, transform=transform) -test\_dataset = datasets.MNIST(\textquotesingle./data\textquotesingle, train=False, transform=transform) +test\_dataset = datasets.MNIST(\textquotesingle./data\textquotesingle, +train=False, transform=transform) -\begin{verbatim} -\end{verbatim} +train\_loader = torch.utils.data.DataLoader(train\_dataset, +batch\_size=64, shuffle=True) -train\_loader = torch.utils.data.DataLoader(train\_dataset, batch\_size=64, shuffle=True) - -test\_loader = torch.utils.data.DataLoader(test\_dataset, batch\_size=1000) - -\begin{verbatim} -\end{verbatim} +test\_loader = torch.utils.data.DataLoader(test\_dataset, +batch\_size=1000) \emph{\# 2. 定义模型} @@ -952,42 +955,30 @@ self.fc2 = nn.Linear(128, 64) \emph{\# 隐藏层 → 隐藏层} self.fc3 = nn.Linear(64, 10) \emph{\# 隐藏层 → 输出层(10个数字)} -\begin{verbatim} -\end{verbatim} - \textbf{def} forward(self, x): -\begin{verbatim} +\begin{lstlisting} x = x.view(-1, 28 * 28) # 展平图像 -\end{verbatim} +\end{lstlisting} x = torch.relu(self.fc1(x)) \emph{\# ReLU激活} x = torch.relu(self.fc2(x)) -\begin{verbatim} +\begin{lstlisting} x = self.fc3(x) # 输出层不加激活 -\end{verbatim} +\end{lstlisting} \textbf{return} x -\begin{verbatim} -\end{verbatim} - model = Net() -\begin{verbatim} -\end{verbatim} - \emph{\# 3. 定义损失函数和优化器} criterion = nn.CrossEntropyLoss() optimizer = optim.Adam(model.parameters(), lr=0.001) -\begin{verbatim} -\end{verbatim} - \emph{\# 4. 训练} \textbf{for} epoch \textbf{in} range(5): @@ -998,25 +989,26 @@ total\_loss = 0 \textbf{for} batch\_x, batch\_y \textbf{in} train\_loader: -\begin{verbatim} +\begin{lstlisting} optimizer.zero_grad() # 清零梯度 output = model(batch_x) # 前向传播 -\end{verbatim} +\end{lstlisting} loss = criterion(output, batch\_y) \emph{\# 计算损失} -\begin{verbatim} +\begin{lstlisting} loss.backward() # 反向传播 optimizer.step() # 更新参数 -\end{verbatim} +\end{lstlisting} total\_loss += loss.item() -print(f"Epoch \{epoch+1\}, Loss: \{total\_loss/len(train\_loader):.4f\}") +print(f"Epoch \{epoch+1\}, Loss: +\{total\_loss/len(train\_loader):.4f\}") -\begin{verbatim} +\begin{lstlisting} # 5. 测试 -\end{verbatim} +\end{lstlisting} model.eval() @@ -1036,12 +1028,11 @@ total += batch\_y.size(0) correct += (predicted == batch\_y).sum() -\begin{verbatim} - +\begin{lstlisting} print(f"\n测试准确率: {correct/total:.2%}") -\end{verbatim} +\end{lstlisting} -\paragraph{使用预训练模型} +\subsubsection{使用预训练模型} 在实际应用中,通常不需要从头训练模型,而是使用预训练模型进行微调或直接推理。 @@ -1055,37 +1046,32 @@ print(f"\n测试准确率: {correct/total:.2%}") classifier = pipeline("sentiment-analysis")\\ result = classifier("This design is amazing!")\\ print(result)\\ -\emph{\# {[}\{\textquotesingle label\textquotesingle: \textquotesingle POSITIVE\textquotesingle, \textquotesingle score\textquotesingle: 0.9998\}{]}}\\ +\emph{\# {[}\{\textquotesingle label\textquotesingle: +\textquotesingle POSITIVE\textquotesingle, +\textquotesingle score\textquotesingle: 0.9998\}{]}}\\ \strut \\ \emph{\# 图像分类}\\ image\_classifier = pipeline("image-classification")\\ result = image\_classifier("building.jpg")\\ print(result)\\ -\emph{\# {[}\{\textquotesingle score\textquotesingle: 0.92, \textquotesingle label\textquotesingle: \textquotesingle palace\textquotesingle\}, ...{]}} +\emph{\# {[}\{\textquotesingle score\textquotesingle: 0.92, +\textquotesingle label\textquotesingle: +\textquotesingle palace\textquotesingle\}, ...{]}} -\subparagraph{使用Ultralytics YOLO} +\paragraph{使用Ultralytics YOLO} \emph{\# 安装: pip install ultralytics} \textbf{from} ultralytics \textbf{import} YOLO -\begin{verbatim} -\end{verbatim} - \emph{\# 加载预训练模型} model = YOLO("yolov8n.pt") -\begin{verbatim} -\end{verbatim} - \emph{\# 目标检测} results = model("street\_photo.jpg") -\begin{verbatim} -\end{verbatim} - \emph{\# 查看结果} \textbf{for} result \textbf{in} results: @@ -1100,16 +1086,17 @@ conf = float(box.conf{[}0{]}) label = model.names{[}cls{]} -\begin{verbatim} +\begin{lstlisting} print(f"检测到: {label}, 置信度: {conf:.2f}") -\end{verbatim} +\end{lstlisting} -\paragraph{GPU加速}\label{gpuux52a0ux901f} +\subsubsection{GPU加速} 深度学习训练在GPU上可以快数十倍。PyTorch的GPU使用非常简洁: \emph{\# 检查GPU是否可用}\\ -device = torch.device("cuda" \textbf{if} torch.cuda.is\_available() \textbf{else} "cpu")\\ +device = torch.device("cuda" \textbf{if} torch.cuda.is\_available() +\textbf{else} "cpu")\\ print(f"使用设备: \{device\}")\\ \strut \\ \emph{\# 将模型和数据移动到GPU}\\ @@ -1121,15 +1108,17 @@ batch\_x = batch\_x.to(device)\\ batch\_y = batch\_y.to(device)\\ \emph{\# ... 后续训练代码不变} -在没有本地GPU的情况下,可以使用 \href{https://colab.research.google.com/}{Google Colab} 免费使用云端GPU运行上述代码。 +在没有本地GPU的情况下,可以使用 +\href{https://colab.research.google.com/}{Google Colab} +免费使用云端GPU运行上述代码。 -\paragraph{学习路径建议} +\subsubsection{学习路径建议} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1657}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3204}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2490}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1327}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2478}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.6018}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 阶段 @@ -1143,12 +1132,13 @@ batch\_y = batch\_y.to(device)\\ \bottomrule\noalign{} \endlastfoot 入门 & Python基础 + NumPy/Pandas & 本附录 §3 \\ -机器学习 & scikit-learn实践 & \href{https://scikit-learn.org/stable/tutorial/}{scikit-learn官方教程} \\ -深度学习基础 & PyTorch入门 + MLP & \href{https://pytorch.org/tutorials/}{PyTorch官方教程} \\ +机器学习 & scikit-learn实践 & +\href{https://scikit-learn.org/stable/tutorial/}{scikit-learn官方教程} \\ +深度学习基础 & PyTorch入门 + MLP & +\href{https://pytorch.org/tutorials/}{PyTorch官方教程} \\ 计算机视觉 & CNN + 图像分类/检测 & 本书第三篇 + CS231n \\ 自然语言处理 & Transformer + LLM & 本书第四篇 + CS224n \\ 生成式AI & Diffusion + AIGC工具 & 本书第五篇 \\ 前沿探索 & Agent + 具身智能 & 本书第六篇 \\ \end{longtable} } - diff --git a/appendices/ap02-vibe-coding.tex b/appendices/ap02-vibe-coding.tex index ec685d0..1fca14b 100644 --- a/appendices/ap02-vibe-coding.tex +++ b/appendices/ap02-vibe-coding.tex @@ -1,26 +1,29 @@ -\chapter{附录2:Vibe Coding与工具链} +\chapter{Vibe Coding与工具链} -本附录介绍Vibe Coding的概念与实践,以及VsCode、Claude Code、Markdown/Obsidian、Git/GitHub等核心工具的使用方法。 +本附录介绍Vibe Coding的概念与实践,以及VsCode、Claude +Code、Markdown/Obsidian、Git/GitHub等核心工具的使用方法。 -\subsubsection{Vibe Coding的概念与工具}\label{vibe-codingux7684ux6982ux5ff5ux4e0eux5de5ux5177} +\section{Vibe Coding的概念与工具} -\paragraph{什么是Vibe Coding} +\subsubsection{什么是Vibe Coding} 传统编程:\textbf{明确需求 → 设计算法 → 编写代码} Vibe Coding:\textbf{模糊想法 → AI辅助 → 迭代完善} -Vibe Coding是一种以AI为核心的编程新模式:开发者用自然语言描述意图,AI生成代码,再通过迭代对话逐步完善。对于编程经验较少的设计专业读者而言,这种模式大幅降低了技术门槛------不需要记住语法细节,只需要清楚地表达“想要什么”。 +Vibe +Coding是一种以AI为核心的编程新模式:开发者用自然语言描述意图,AI生成代码,再通过迭代对话逐步完善。对于编程经验较少的设计专业读者而言,这种模式大幅降低了技术门槛——不需要记住语法细节,只需要清楚地表达“想要什么”。 -\paragraph{工作流程} +\subsubsection{工作流程} \begin{enumerate} \def\labelenumi{\arabic{enumi}.} +\tightlist \item \textbf{描述意图}:用自然语言说明需求 \end{enumerate} -“帮我创建一个简单的图像分类模型” +``帮我创建一个简单的图像分类模型'' \begin{enumerate} \def\labelenumi{\arabic{enumi}.} @@ -33,21 +36,22 @@ Vibe Coding是一种以AI为核心的编程新模式:开发者用自然语言 \textbf{迭代优化}:通过对话逐步改进 \end{enumerate} -“把隐藏层改成128个神经元” +``把隐藏层改成128个神经元'' \begin{enumerate} \def\labelenumi{\arabic{enumi}.} \setcounter{enumi}{4} +\tightlist \item \textbf{理解学习}:阅读AI生成的代码,理解实现原理 \end{enumerate} -\paragraph{实践技巧} +\subsubsection{实践技巧} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.1184}} - >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.3905}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.1528}} + >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.4583}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 技巧 @@ -65,14 +69,14 @@ Vibe Coding是一种以AI为核心的编程新模式:开发者用自然语言 \end{longtable} } -\paragraph{工具生态} +\subsubsection{工具生态} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1982}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1475}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.2970}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.2366}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.2375}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1625}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.3125}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.2625}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 工具 @@ -95,13 +99,14 @@ Replit Agent & 在线平台 & 端到端开发 & 小型项目、学习实验 \\ \end{longtable} } -\subsubsection{Claude Code简介与使用}\label{claude-codeux7b80ux4ecbux4e0eux4f7fux7528} +\section{Claude Code简介与使用} -\paragraph{什么是Claude Code} +\subsubsection{什么是Claude Code} -Claude Code是Anthropic推出的命令行AI编程工具(CLI),能够直接在终端中理解项目上下文、读写文件、执行命令,实现端到端的AI辅助开发。它也提供VSCode扩展,可以在编辑器中无缝使用。 +Claude +Code是Anthropic推出的命令行AI编程工具(CLI),能够直接在终端中理解项目上下文、读写文件、执行命令,实现端到端的AI辅助开发。它也提供VSCode扩展,可以在编辑器中无缝使用。 -\paragraph{安装与配置} +\subsubsection{安装与配置} \emph{\# 安装(需要 Node.js 18+)}\\ npm install -g @anthropic-ai/claude-code\\ @@ -112,24 +117,29 @@ claude 启动后进入交互式对话界面,直接用自然语言描述需求即可。 -\paragraph{核心使用方式} +\subsubsection{核心使用方式} -\textbf{对话式开发}:用自然语言描述任务,Claude Code会自动读取相关文件、编写代码、执行测试。 +\textbf{对话式开发}:用自然语言描述任务,Claude +Code会自动读取相关文件、编写代码、执行测试。 -\textgreater{} 帮我创建一个数据预处理的Python脚本,读取CSV文件并清洗缺失值 +\textgreater{} +帮我创建一个数据预处理的Python脚本,读取CSV文件并清洗缺失值 -\textbf{文件操作}:Claude Code可以直接读取、创建和编辑项目中的文件,每次修改前会征得确认。 +\textbf{文件操作}:Claude +Code可以直接读取、创建和编辑项目中的文件,每次修改前会征得确认。 -\textbf{命令执行}:可以请求Claude Code运行终端命令,如安装依赖、运行脚本等。 +\textbf{命令执行}:可以请求Claude +Code运行终端命令,如安装依赖、运行脚本等。 -\paragraph{VSCode中的Claude Code}\label{vscodeux4e2dux7684claude-code} +\subsubsection{VSCode中的Claude +Code} Claude Code提供VSCode扩展,在编辑器中获得同样的AI辅助能力: \begin{enumerate} \def\labelenumi{\arabic{enumi}.} \item - 在VSCode扩展商店搜索 ``Claude Code'' 并安装 + 在VSCode扩展商店搜索 ``Claude Code“ 并安装 \item 打开项目文件夹 \item @@ -138,9 +148,10 @@ Claude Code提供VSCode扩展,在编辑器中获得同样的AI辅助能力: 在编辑器中选中代码后,可以直接向Claude提问或请求修改 \end{enumerate} -\textbf{常用场景}: - 选中一段代码,请求“解释这段代码” - 选中函数,请求“添加错误处理” - 在Claude面板中输入“帮我写单元测试” +\textbf{常用场景}: - 选中一段代码,请求”解释这段代码“ - +选中函数,请求”添加错误处理” - 在Claude面板中输入”帮我写单元测试” -\paragraph{典型项目工作流} +\subsubsection{典型项目工作流} \textbf{推荐项目结构}: @@ -154,7 +165,7 @@ project/\\ ├── requirements.txt \# 依赖列表\\ └── README.md \# 项目说明 -\subparagraph{开发流程:} +\paragraph{开发流程:} \emph{\# 1. 创建环境}\\ conda create -n myproject python=3.10\\ @@ -169,15 +180,15 @@ claude\\ \emph{\# 4. 保存环境}\\ conda env export \textgreater{} environment.yml -\subsubsection{Markdown语法及Obsidian工具}\label{markdownux8bedux6cd5ux53caobsidianux5de5ux5177} +\subsection{Markdown语法及Obsidian工具} -\paragraph{Markdown简介}\label{markdownux7b80ux4ecb} +\subsubsection{Markdown简介} Markdown是一种轻量级标记语言,用纯文本格式编写文档,可以方便地转换为HTML、PDF等格式。它的语法简洁直观,是技术文档、笔记、学术写作的常用工具。 本书全部内容即使用Markdown编写。 -\paragraph{基础语法} +\subsubsection{基础语法} \textbf{标题}: @@ -189,9 +200,13 @@ Markdown是一种轻量级标记语言,用纯文本格式编写文档,可以 \textbf{文本格式}: -*斜体* **加粗** ***粗斜体*** \textasciitilde\textasciitilde 删除线\textasciitilde\textasciitilde{} \textless{}\textbf{u}\textgreater 下划线\textless/\textbf{u}\textgreater{} \emph{\textbf{`行内代码`}} \textbf{==高亮文本==} \_\_\_分隔线 +*斜体* **加粗** ***粗斜体*** +\textasciitilde\textasciitilde 删除线\textasciitilde\textasciitilde{} +\textless{}\textbf{u}\textgreater 下划线\textless/\textbf{u}\textgreater{} +\textbf{\emph{`行内代码`}} \textbf{==高亮文本==} \_\_\_分隔线 -包含反引号的代码:当代码本身包含反引号时,使用两个反引号包围,使用 `code` 这样的格式 +包含反引号的代码:当代码本身包含反引号时,使用两个反引号包围,使用 +`code` 这样的格式 \textbf{列表}: 列表可以嵌套使用 @@ -201,50 +216,55 @@ Markdown是一种轻量级标记语言,用纯文本格式编写文档,可以 \begin{enumerate} \def\labelenumi{\arabic{enumi}.} +\tightlist \item 有序列表项1 \end{enumerate} -\begin{verbatim} +\begin{lstlisting} 2. 有序列表项2 -\end{verbatim} +\end{lstlisting} - {[} {]} 未完成的任务 -\begin{verbatim} +\begin{lstlisting} - [x] 已完成的任务 -\end{verbatim} +\end{lstlisting} \textbf{链接与图片}: -{[}链接文字{]}(https://example.com) \textless!-\/- 行内链接 -\/-\textgreater{}\\ +{[}链接文字{]}(https://example.com) \textless!-\/- 行内链接 +-\/-\textgreater{}\\ {[}链接文字{]}{[}1{]} \textless!-\/- 参考式链接 -\/-\textgreater{}\\ {[}跳转到基础{]}(\#基础) \textless!-\/- 锚点链接 -\/-\textgreater{}\\ \strut \\ -{[}1{]}: https://www.example.com \textless!-\/- 参考链接定义 -\/-\textgreater{}\\ +{[}1{]}: https://www.example.com \textless!-\/- 参考链接定义 +-\/-\textgreater{}\\ \strut \\ !{[}图片说明{]}(image.png) \textless!-\/- 基本图片 -\/-\textgreater{}\\ -*图7.8 路杀动物* \textless!-\/- 图片下方用斜体作为图注 -\/-\textgreater{}\\ +*图7.8 路杀动物* \textless!-\/- 图片下方用斜体作为图注 +-\/-\textgreater{}\\ \strut \\ \textless!-\/- 图片居中对齐并指定宽度 -\/-\textgreater{}\\ \textless div align="center"\textgreater{}\\ -\textless img src="image.png" alt="说明" style="width:10cm;"/\textgreater{}\\ +\textless img src="image.png" alt="说明" +style="width:10cm;"/\textgreater{}\\ \textless p\textgreater\textless em\textgreater 图片标题\textless/em\textgreater\textless/p\textgreater{}\\ \textless/div\textgreater{} \textbf{代码块}: -\emph{\textbf{```python}}\\ +\textbf{\emph{```python}}\\ print("Hello, World!")\\ -\emph{\textbf{```}} +\textbf{\emph{```}} 带行号的代码区块(需要渲染器支持,如 Docusaurus、VuePress): -\emph{\textbf{```javascript linenums="1"}}\\ -\emph{\textbf{function greet(name) \{}}\\ -\emph{\textbf{console.log(`Hello, \$\{name\}!{\kern0pt}`);}}\\ -\emph{\textbf{\}}}\\ -\emph{\textbf{```}} +\textbf{\emph{```javascript linenums="1"}}\\ +\textbf{\emph{function greet(name) \{}}\\ +\textbf{\emph{console.log(`Hello, \$\{name\}!{\kern0pt}`);}}\\ +\textbf{\emph{\}}}\\ +\textbf{\emph{```}} 表格: @@ -255,7 +275,8 @@ print("Hello, World!")\\ 对齐方式::-\/-\/- 左对齐,:-\/-\/-: 居中,-\/-\/-: 右对齐: \textbar{} 左对齐 \textbar{} 居中对齐 \textbar{} 右对齐 \textbar{}\\ -\textbar{} :-\/-\/-\/-\/- \textbar{} :-\/-\/-\/-\/-\/-: \textbar{} -\/-\/-\/-\/-: \textbar{}\\ +\textbar{} :-\/-\/-\/-\/- \textbar{} :-\/-\/-\/-\/-\/-: \textbar{} +-\/-\/-\/-\/-: \textbar{}\\ \textbar{} 内容 \textbar{} 内容 \textbar{} 100 \textbar{} \textbf{注记}: 输入后在Obsidian编辑器中会自动弹出添加注记模块 @@ -275,63 +296,63 @@ print("Hello, World!")\\ \textgreater{} - 了解项目背景和目标\\ \textgreater{} - 掌握核心功能特性 -\subparagraph{图表绘制(Mermaid):} +\paragraph{图表绘制(Mermaid):} 使用 ```mermaid 代码块,部分渲染器(GitHub、Typora、Obsidian)支持: 流程图: -\emph{\textbf{```mermaid}} +\textbf{\emph{```mermaid}} -\emph{\textbf{graph LR}} +\textbf{\emph{graph LR}} \begin{enumerate} \def\labelenumi{\Alph{enumi}.} \item - \emph{\textbf{{[}开始{]} -\/-\textgreater{} B\{条件判断\}}} + \textbf{\emph{{[}开始{]} -\/-\textgreater{} B\{条件判断\}}} \item - \emph{\textbf{-\/-\textgreater\textbar 是\textbar{} C{[}执行操作1{]}}} + \textbf{\emph{-\/-\textgreater\textbar 是\textbar{} C{[}执行操作1{]}}} \item - \emph{\textbf{-\/-\textgreater\textbar 否\textbar{} D{[}执行操作2{]}}} + \textbf{\emph{-\/-\textgreater\textbar 否\textbar{} D{[}执行操作2{]}}} \item - \emph{\textbf{-\/-\textgreater{} E{[}结束{]}}} + \textbf{\emph{-\/-\textgreater{} E{[}结束{]}}} \item - \emph{\textbf{-\/-\textgreater{} E}} + \textbf{\emph{-\/-\textgreater{} E}} \end{enumerate} -\emph{\textbf{```}} +\textbf{\emph{```}} 时序图: -\emph{\textbf{```mermaid}}\\ -\emph{\textbf{sequenceDiagram}}\\ -\emph{\textbf{participant 用户}}\\ -\emph{\textbf{participant 系统}}\\ -\emph{\textbf{用户-\textgreater\textgreater 系统: 登录请求}}\\ -\emph{\textbf{系统-\/-\textgreater\textgreater 用户: 返回结果}}\\ -\emph{\textbf{```}} +\textbf{\emph{```mermaid}}\\ +\textbf{\emph{sequenceDiagram}}\\ +\textbf{\emph{participant 用户}}\\ +\textbf{\emph{participant 系统}}\\ +\textbf{\emph{用户-\textgreater\textgreater 系统: 登录请求}}\\ +\textbf{\emph{系统-\/-\textgreater\textgreater 用户: 返回结果}}\\ +\textbf{\emph{```}} 甘特图: -\emph{\textbf{```mermaid}}\\ -\emph{\textbf{gantt}}\\ -\emph{\textbf{title 项目计划}}\\ -\emph{\textbf{dateFormat YYYY-MM-DD}}\\ -\emph{\textbf{section 设计}}\\ -\emph{\textbf{需求分析 :done, 2024-01-01, 15d}}\\ -\emph{\textbf{section 开发}}\\ -\emph{\textbf{编码实现 :active, 2024-01-16, 30d}}\\ -\emph{\textbf{```}} +\textbf{\emph{```mermaid}}\\ +\textbf{\emph{gantt}}\\ +\textbf{\emph{title 项目计划}}\\ +\textbf{\emph{dateFormat YYYY-MM-DD}}\\ +\textbf{\emph{section 设计}}\\ +\textbf{\emph{需求分析 :done, 2024-01-01, 15d}}\\ +\textbf{\emph{section 开发}}\\ +\textbf{\emph{编码实现 :active, 2024-01-16, 30d}}\\ +\textbf{\emph{```}} 饼图: -\emph{\textbf{```mermaid}}\\ -\emph{\textbf{pie}}\\ -\emph{\textbf{title 市场份额}}\\ -\emph{\textbf{"Chrome" : 65}}\\ -\emph{\textbf{"Safari" : 15}}\\ -\emph{\textbf{"其他" : 20}}\\ -\emph{\textbf{```}} +\textbf{\emph{```mermaid}}\\ +\textbf{\emph{pie}}\\ +\textbf{\emph{title 市场份额}}\\ +\textbf{\emph{"Chrome" : 65}}\\ +\textbf{\emph{"Safari" : 15}}\\ +\textbf{\emph{"其他" : 20}}\\ +\textbf{\emph{```}} \textbf{数学公式}: @@ -355,31 +376,43 @@ a & b \\ c & d \end{pmatrix}\] -\paragraph{Obsidian:Markdown笔记工具}\label{obsidianmarkdownux7b14ux8bb0ux5de5ux5177} +\subsubsection{Obsidian:Markdown笔记工具} -\href{https://obsidian.md/}{Obsidian} 是一款基于Markdown的知识管理工具,适合构建个人知识库和笔记系统。 +\href{https://obsidian.md/}{Obsidian} +是一款基于Markdown的知识管理工具,适合构建个人知识库和笔记系统。 -\textbf{核心特性}: - \textbf{本地存储}:所有笔记以Markdown文件保存在本地,数据完全自主 - \textbf{双向链接}:用 {[}{[}笔记名{]}{]} 在笔记之间建立链接,形成知识网络 - \textbf{图谱视图}:可视化笔记之间的关联关系 - \textbf{插件生态}:丰富的社区插件扩展功能(如日历、看板、模板等) - \textbf{实时预览}:编辑Markdown时实时渲染效果 +\textbf{核心特性}: - +\textbf{本地存储}:所有笔记以Markdown文件保存在本地,数据完全自主 - +\textbf{双向链接}:用 {[}{[}笔记名{]}{]} +在笔记之间建立链接,形成知识网络 - +\textbf{图谱视图}:可视化笔记之间的关联关系 - +\textbf{插件生态}:丰富的社区插件扩展功能(如日历、看板、模板等) - +\textbf{实时预览}:编辑Markdown时实时渲染效果 -\textbf{使用建议}: - 用Obsidian打开本教材的根目录,即可获得完整的阅读与编辑体验 - 建议安装“目录”插件,方便在长文档中快速导航 - 利用双向链接功能,将学习笔记与教材内容关联起来 +\textbf{使用建议}: - +用Obsidian打开本教材的根目录,即可获得完整的阅读与编辑体验 - +建议安装“目录”插件,方便在长文档中快速导航 - +利用双向链接功能,将学习笔记与教材内容关联起来 -\subsubsection{Git版本管理与GitHub协作}\label{gitux7248ux672cux7ba1ux7406ux4e0egithubux534fux4f5c} +\subsection{Git版本管理与GitHub协作} -\paragraph{为什么需要版本管理} +\subsubsection{为什么需要版本管理} -在项目开发过程中,文件会不断修改。版本管理工具可以: - 记录每一次修改的内容和时间 - 随时回退到之前的任意版本 - 多人协作时避免互相覆盖 +在项目开发过程中,文件会不断修改。版本管理工具可以: - +记录每一次修改的内容和时间 - 随时回退到之前的任意版本 - +多人协作时避免互相覆盖 Git是当前最流行的分布式版本管理系统。 -\paragraph{Git基础操作}\label{gitux57faux7840ux64cdux4f5c} +\subsubsection{Git基础操作} -\subparagraph{初始化仓库:} +\paragraph{初始化仓库:} \emph{\# 在项目目录中初始化Git}\\ cd my\_project\\ git init -\subparagraph{日常三步曲:} +\paragraph{日常三步曲:} \emph{\# 1. 查看当前修改状态}\\ git status\\ @@ -407,11 +440,15 @@ git log -\/- filename.md\\ \emph{\# 恢复某个文件到指定版本}\\ git checkout abc1234 -\/- filename.md -\paragraph{GitHub:云端协作平台}\label{githubux4e91ux7aefux534fux4f5cux5e73ux53f0} +\subsubsection{GitHub:云端协作平台} -\href{https://github.com/}{GitHub} 是基于Git的代码托管平台,提供云端存储和协作功能。 +\href{https://github.com/}{GitHub} +是基于Git的代码托管平台,提供云端存储和协作功能。 -\textbf{核心概念}: - \textbf{仓库(Repository)}:项目的存储空间,包含所有文件和历史记录 - \textbf{远程同步}:将本地仓库推送到GitHub,或从GitHub拉取更新 - \textbf{协作}:多人通过分支和合并协同工作 +\textbf{核心概念}: - +\textbf{仓库(Repository)}:项目的存储空间,包含所有文件和历史记录 - +\textbf{远程同步}:将本地仓库推送到GitHub,或从GitHub拉取更新 - +\textbf{协作}:多人通过分支和合并协同工作 \textbf{常用操作}: @@ -426,13 +463,13 @@ git pull \textbf{本书的Git管理}: -本书内容即通过Git进行版本管理。每个章节的修改都有完整的提交记录,可以通过 git log 查看内容的演变历史。 +本书内容即通过Git进行版本管理。每个章节的修改都有完整的提交记录,可以通过 +git log 查看内容的演变历史。 -\paragraph{推荐工作流} +\subsubsection{推荐工作流} 对于设计专业的学习和研究项目,建议采用以下简化工作流: 编写/修改文档 → git add → git commit → git push 每次完成一个阶段性工作(如写完一节内容、完成一次实验)后提交一次,附上简洁的说明。这样既保留了完整的历史记录,也不会因为误操作而丢失工作成果。 - diff --git a/appendices/ap03-academic-writing.tex b/appendices/ap03-academic-writing.tex index cff6ebd..6224501 100644 --- a/appendices/ap03-academic-writing.tex +++ b/appendices/ap03-academic-writing.tex @@ -1,16 +1,16 @@ -\chapter{附录3:学术论文撰写工作流} +\chapter{学术论文撰写工作流} 本附录介绍文献检索管理、论文写作工具、AI辅助写作流程及引用格式规范。 -\subsection{文献检索与管理} +\section{文献检索与管理} -\subsubsection{检索平台} +\subsection{检索平台} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1899}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1965}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2117}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1979}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1771}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.6042}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 平台 @@ -23,19 +23,21 @@ \endhead \bottomrule\noalign{} \endlastfoot -Google Scholar & 综合学术搜索 & \href{https://scholar.google.com/}{scholar.google.com} \\ +Google Scholar & 综合学术搜索 & +\href{https://scholar.google.com/}{scholar.google.com} \\ arXiv & AI领域预印本 & \href{https://arxiv.org/}{arxiv.org} \\ -Semantic Scholar & AI辅助文献搜索 & \href{https://www.semanticscholar.org/}{semanticscholar.org} \\ +Semantic Scholar & AI辅助文献搜索 & +\href{https://www.semanticscholar.org/}{semanticscholar.org} \\ CNKI & 中文学术文献 & \href{https://www.cnki.net/}{cnki.net} \\ \end{longtable} } -\subsubsection{文献管理工具} +\subsection{文献管理工具} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.1184}} - >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.3303}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.1528}} + >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.4028}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 工具 @@ -52,20 +54,21 @@ EndNote & 功能全面、与Word深度集成 \\ \end{longtable} } -\subsection{论文写作工具} +\section{论文写作工具} -\subsubsection{LaTeX}\label{latex} +\subsection{LaTeX}\label{latex} 学术排版的行业标准,适合公式密集的论文。 \begin{itemize} \item - \textbf{在线编辑}:\href{https://www.overleaf.com/}{Overleaf} --- 无需本地安装,支持协作 + \textbf{在线编辑}:\href{https://www.overleaf.com/}{Overleaf} --- + 无需本地安装,支持协作 \item \textbf{本地编辑}:TeX Live + VSCode LaTeX Workshop 插件 \end{itemize} -\subsubsection{Markdown + Pandoc}\label{markdown-pandoc} +\subsection{Markdown + Pandoc}\label{markdown-pandoc} 轻量级写作方案,适合课程报告和技术文档。 @@ -73,12 +76,13 @@ EndNote & 功能全面、与Word深度集成 \\ pandoc paper.md -o paper.docx\\ pandoc paper.md -o paper.pdf -\/-pdf-engine=xelatex -\subsection{AI辅助写作流程}\label{aiux8f85ux52a9ux5199ux4f5cux6d41ux7a0b} +\section{AI辅助写作流程} \begin{enumerate} \def\labelenumi{\arabic{enumi}.} \item - \textbf{文献综述}:使用 ChatGPT/Claude 快速了解研究领域的核心文献和发展脉络 + \textbf{文献综述}:使用 ChatGPT/Claude + 快速了解研究领域的核心文献和发展脉络 \item \textbf{大纲生成}:通过AI辅助梳理论文结构和逻辑框架 \item @@ -89,9 +93,9 @@ pandoc paper.md -o paper.pdf -\/-pdf-engine=xelatex 注意:AI辅助写作应遵循学术诚信原则,AI生成的内容需人工审核和改写,核心观点和论证应由作者独立完成。 -\subsection{引用与格式规范} +\section{引用与格式规范} -\subsubsection{常用引用格式} +\subsection{常用引用格式} \begin{itemize} \item @@ -102,7 +106,7 @@ pandoc paper.md -o paper.pdf -\/-pdf-engine=xelatex \textbf{GB/T 7714}:中国国家标准 \end{itemize} -\subsubsection{BibTeX示例}\label{bibtexux793aux4f8b} +\subsection{BibTeX示例} @article\{vaswani2017attention,\\ title=\{Attention is all you need\},\\ @@ -111,4 +115,3 @@ journal=\{NeurIPS\},\\ volume=\{30\},\\ year=\{2017\}\\ \} - diff --git a/appendices/ap04-web-tools.tex b/appendices/ap04-web-tools.tex index 901c074..70eb99e 100644 --- a/appendices/ap04-web-tools.tex +++ b/appendices/ap04-web-tools.tex @@ -1,10 +1,10 @@ -\chapter{附录4:网络、网站与在线可视化} +\chapter{网络、网站与在线可视化} 本附录介绍网络基础知识、网站搭建入门,以及在线数据可视化的工具与方法。 -\subsection{网络基础知识} +\section{网络基础知识} -\subsubsection{互联网与Web} +\subsection{互联网与Web} 互联网(Internet)是由全球计算机互相连接而成的网络。Web(万维网)是运行在互联网上的信息系统,通过浏览器访问网页来获取信息。 @@ -12,8 +12,8 @@ {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.1617}} - >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.6553}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.1733}} + >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.8000}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 概念 @@ -33,28 +33,31 @@ API & 应用程序接口,程序之间交换数据的标准方式 \\ \end{longtable} } -\subsubsection{前端与后端} +\subsection{前端与后端} 一个完整的Web应用由前端和后端两部分组成: 用户浏览器(前端) ←→ 服务器(后端) ←→ 数据库\\ HTML/CSS/JS Python/Node.js MySQL/PostgreSQL -\textbf{前端}:用户在浏览器中看到和操作的界面,使用 HTML、CSS、JavaScript 构建。 +\textbf{前端}:用户在浏览器中看到和操作的界面,使用 +HTML、CSS、JavaScript 构建。 -\textbf{后端}:运行在服务器上的程序,处理数据逻辑、存储和检索,可以用 Python(Flask/Django/FastAPI)、Node.js、Java 等实现。 +\textbf{后端}:运行在服务器上的程序,处理数据逻辑、存储和检索,可以用 +Python(Flask/Django/FastAPI)、Node.js、Java 等实现。 -\subsubsection{API与数据交互}\label{apiux4e0eux6570ux636eux4ea4ux4e92} +\subsection{API与数据交互} -API(Application Programming Interface)是程序之间通信的接口。在AI应用中,调用大语言模型、获取在线数据等操作都通过API完成。 +API(Application Programming +Interface)是程序之间通信的接口。在AI应用中,调用大语言模型、获取在线数据等操作都通过API完成。 \textbf{RESTful API 基本概念}: {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1134}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1185}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2835}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1250}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1528}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3472}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 方法 @@ -84,12 +87,15 @@ data = response.json() \emph{\# 将返回的JSON解析为Python字典}\\ print(data)\\ \strut \\ \emph{\# POST请求示例}\\ -payload = \{"prompt": "设计一个现代风格的客厅", "model": "stable-diffusion"\}\\ -response = requests.post("https://api.example.com/generate", json=payload) +payload = \{"prompt": "设计一个现代风格的客厅", "model": +"stable-diffusion"\}\\ +response = requests.post("https://api.example.com/generate", +json=payload) -\subsubsection{JSON数据格式}\label{jsonux6570ux636eux683cux5f0f} +\subsection{JSON数据格式} -JSON(JavaScript Object Notation)是Web上最常用的数据交换格式,几乎所有API都使用JSON传递数据。 +JSON(JavaScript Object +Notation)是Web上最常用的数据交换格式,几乎所有API都使用JSON传递数据。 \{\\ "model": "ResNet",\\ @@ -112,16 +118,16 @@ json\_str = json.dumps(data, indent=2)\\ \emph{\# JSON字符串 → Python字典}\\ parsed = json.loads(json\_str) -\subsection{网站搭建入门} +\section{网站搭建入门} -\subsubsection{静态网站与动态网站} +\subsection{静态网站与动态网站} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1187}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.3546}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.2633}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.2366}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1222}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.3444}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.2556}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.2556}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 类型 @@ -136,12 +142,14 @@ parsed = json.loads(json\_str) \endhead \bottomrule\noalign{} \endlastfoot -静态网站 & 页面内容固定,无需服务器处理 & HTML/CSS/JS & 作品集、项目文档 \\ -动态网站 & 内容根据请求动态生成 & 前端 + 后端 + 数据库 & 在线工具、数据平台 \\ +静态网站 & 页面内容固定,无需服务器处理 & HTML/CSS/JS & +作品集、项目文档 \\ +动态网站 & 内容根据请求动态生成 & 前端 + 后端 + 数据库 & +在线工具、数据平台 \\ \end{longtable} } -\subsubsection{静态网站快速搭建} +\subsection{静态网站快速搭建} 对于设计专业的学生,最实用的方式是使用静态网站生成器搭建项目展示或文档站点。 @@ -174,9 +182,9 @@ mkdocs build 即可通过 https://username.github.io/repo 访问 \end{enumerate} -\subsubsection{HTML/CSS/JavaScript 速览}\label{htmlcssjavascript-ux901fux89c8} +\section{HTML/CSS/JavaScript 速览} -\paragraph{HTML:页面结构}\label{htmlux9875ux9762ux7ed3ux6784} +\subsubsection{HTML:页面结构} \textless!DOCTYPE html\textgreater{}\\ \textless{}\textbf{html}\textgreater{}\\ @@ -187,11 +195,12 @@ mkdocs build \textless{}\textbf{h1}\textgreater 设计作品集\textless/\textbf{h1}\textgreater{}\\ \textless{}\textbf{p}\textgreater 欢迎来到我的作品展示页面\textless/\textbf{p}\textgreater{}\\ \textless{}\textbf{img} src="design.jpg" alt="设计作品"\textgreater{}\\ -\textless{}\textbf{a} href="https://example.com"\textgreater 了解更多\textless/\textbf{a}\textgreater{}\\ +\textless{}\textbf{a} +href="https://example.com"\textgreater 了解更多\textless/\textbf{a}\textgreater{}\\ \textless/\textbf{body}\textgreater{}\\ \textless/\textbf{html}\textgreater{} -\paragraph{CSS:页面样式}\label{cssux9875ux9762ux6837ux5f0f} +\subsubsection{CSS:页面样式} body \{\\ \textbf{font-family}: "Helvetica", sans-serif;\\ @@ -205,22 +214,23 @@ h1 \{\\ \textbf{text-align}: center;\\ \} -\paragraph{JavaScript:页面交互}\label{javascriptux9875ux9762ux4ea4ux4e92} +\subsubsection{JavaScript:页面交互} \emph{// 点击按钮时显示消息}\\ -document.getElementById("myButton").addEventListener("click", \textbf{function}() \{\\ +document.getElementById("myButton").addEventListener("click", +\textbf{function}() \{\\ alert("按钮被点击了!");\\ \}); -\subsubsection{前端框架简介} +\subsection{前端框架简介} 对于更复杂的Web应用,可以使用前端框架提升开发效率: {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1107}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3071}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3379}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1667}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3750}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.4028}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 框架 @@ -245,36 +255,34 @@ Streamlit & Python编写Web应用 & AI模型展示、数据分析仪表板 \\ \begin{enumerate} \def\labelenumi{\arabic{enumi}.} +\tightlist \item title("图像分类演示") \end{enumerate} st.write("上传一张图片,AI将识别其中的内容") -\begin{verbatim} -\end{verbatim} - uploaded\_file = st.file\_uploader("选择图片", type={[}"jpg", "png"{]}) \textbf{if} uploaded\_file: st.image(uploaded\_file, caption="上传的图片") -\begin{verbatim} +\begin{lstlisting} st.write("分类结果:建筑(置信度 95%)") -\end{verbatim} +\end{lstlisting} \emph{\# 安装并运行}\\ pip install streamlit\\ streamlit run app.py -\subsubsection{网站部署方式} +\subsection{网站部署方式} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3137}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2835}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1185}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3889}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3472}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1528}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 方式 @@ -294,13 +302,13 @@ Hugging Face Spaces & 适合AI模型演示 & 免费额度 \\ \end{longtable} } -\subsection{在线数据可视化} +\section{在线数据可视化} -\subsubsection{为什么需要数据可视化} +\subsection{为什么需要数据可视化} 设计领域的AI研究和实践经常涉及数据展示:训练损失曲线、模型性能对比、空间数据分析结果等。数据可视化将抽象的数字转化为直观的图形,帮助理解和决策。 -\subsubsection{Python可视化库}\label{pythonux53efux89c6ux5316ux5e93} +\subsection{Python可视化库} Matplotlib:基础绑图 @@ -308,21 +316,27 @@ Matplotlib:基础绑图 \strut \\ \emph{\# 折线图}\\ epochs = range(1, 11)\\ -train\_loss = {[}0.9, 0.6, 0.4, 0.25, 0.15, 0.1, 0.07, 0.05, 0.04, 0.03{]}\\ -val\_loss = {[}0.85, 0.65, 0.45, 0.35, 0.28, 0.25, 0.24, 0.23, 0.23, 0.24{]}\\ +train\_loss = {[}0.9, 0.6, 0.4, 0.25, 0.15, 0.1, 0.07, 0.05, 0.04, +0.03{]}\\ +val\_loss = {[}0.85, 0.65, 0.45, 0.35, 0.28, 0.25, 0.24, 0.23, 0.23, +0.24{]}\\ \strut \\ plt.figure(figsize=(8, 5))\\ -plt.plot(epochs, train\_loss, \textquotesingle b-o\textquotesingle, label=\textquotesingle Train Loss\textquotesingle)\\ -plt.plot(epochs, val\_loss, \textquotesingle r-s\textquotesingle, label=\textquotesingle Val Loss\textquotesingle)\\ +plt.plot(epochs, train\_loss, \textquotesingle b-o\textquotesingle, +label=\textquotesingle Train Loss\textquotesingle)\\ +plt.plot(epochs, val\_loss, \textquotesingle r-s\textquotesingle, +label=\textquotesingle Val Loss\textquotesingle)\\ plt.xlabel(\textquotesingle Epoch\textquotesingle)\\ plt.ylabel(\textquotesingle Loss\textquotesingle)\\ -plt.title(\textquotesingle Training vs Validation Loss\textquotesingle)\\ +plt.title(\textquotesingle Training vs Validation +Loss\textquotesingle)\\ plt.legend()\\ plt.grid(True, alpha=0.3)\\ -plt.savefig(\textquotesingle loss\_comparison.png\textquotesingle, dpi=150, bbox\_inches=\textquotesingle tight\textquotesingle)\\ +plt.savefig(\textquotesingle loss\_comparison.png\textquotesingle, +dpi=150, bbox\_inches=\textquotesingle tight\textquotesingle)\\ plt.show() -\paragraph{Seaborn:统计可视化}\label{seabornux7edfux8ba1ux53efux89c6ux5316} +\subsubsection{Seaborn:统计可视化} 基于Matplotlib,提供更美观的统计图表。 @@ -333,11 +347,13 @@ plt.show() data = np.random.randn(10, 10)\\ corr = np.corrcoef(data)\\ \strut \\ -sns.heatmap(corr, annot=True, cmap=\textquotesingle coolwarm\textquotesingle)\\ -plt.title(\textquotesingle Feature Correlation Heatmap\textquotesingle)\\ +sns.heatmap(corr, annot=True, +cmap=\textquotesingle coolwarm\textquotesingle)\\ +plt.title(\textquotesingle Feature Correlation +Heatmap\textquotesingle)\\ plt.savefig(\textquotesingle heatmap.png\textquotesingle, dpi=150) -\paragraph{Plotly:交互式可视化}\label{plotlyux4ea4ux4e92ux5f0fux53efux89c6ux5316} +\subsubsection{Plotly:交互式可视化} 支持鼠标悬停、缩放、导出等交互操作,适合Web展示。 @@ -351,15 +367,15 @@ title="Iris Dataset Scatter Plot")\\ fig.write\_html("scatter.html") \emph{\# 导出为网页}\\ fig.show() -\subsubsection{在线可视化工具} +\subsection{在线可视化工具} 无需编程,通过网页界面即可创建可视化: {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1646}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3405}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2036}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1667}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3039}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.5098}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 工具 @@ -372,23 +388,28 @@ fig.show() \endhead \bottomrule\noalign{} \endlastfoot -Observable & JavaScript驱动的交互式笔记本 & \href{https://observablehq.com/}{observablehq.com} \\ -Flourish & 拖拽式数据可视化,模板丰富 & \href{https://flourish.studio/}{flourish.studio} \\ -Datawrapper & 适合制作新闻级图表 & \href{https://www.datawrapper.de/}{datawrapper.de} \\ -Tableau Public & 强大的商业智能可视化 & \href{https://public.tableau.com/}{public.tableau.com} \\ -ECharts & 百度开源的交互式图表库 & \href{https://echarts.apache.org/}{echarts.apache.org} \\ +Observable & JavaScript驱动的交互式笔记本 & +\href{https://observablehq.com/}{observablehq.com} \\ +Flourish & 拖拽式数据可视化,模板丰富 & +\href{https://flourish.studio/}{flourish.studio} \\ +Datawrapper & 适合制作新闻级图表 & +\href{https://www.datawrapper.de/}{datawrapper.de} \\ +Tableau Public & 强大的商业智能可视化 & +\href{https://public.tableau.com/}{public.tableau.com} \\ +ECharts & 百度开源的交互式图表库 & +\href{https://echarts.apache.org/}{echarts.apache.org} \\ \end{longtable} } -\subsubsection{地理空间可视化} +\subsection{地理空间可视化} 设计领域经常涉及地理和空间数据的可视化: {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1113}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3837}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2364}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1667}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.4583}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2917}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 工具 @@ -425,12 +446,12 @@ icon=folium.Icon(color="blue", icon="info-sign")\\ \emph{\# 保存为网页}\\ m.save("map.html") -\subsubsection{可视化设计原则} +\subsection{可视化设计原则} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.2361}} - >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.6363}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.2838}} + >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.6892}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 原则 @@ -448,4 +469,3 @@ m.save("map.html") 交互增强 & 在线可视化支持筛选、缩放、悬停查看详情 \\ \end{longtable} } - diff --git a/appendices/ap05-online-resources.tex b/appendices/ap05-online-resources.tex index dc9162c..9a48421 100644 --- a/appendices/ap05-online-resources.tex +++ b/appendices/ap05-online-resources.tex @@ -1,14 +1,14 @@ -\chapter{附录5:在线学习资源} +\chapter{在线学习资源} 本附录整理AI学习过程中常用的在线课程、技术博客与文档、以及公开数据集。 -\subsection{推荐课程} +\section{推荐课程} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2921}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1101}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2141}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2182}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1000}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.6636}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 名称 @@ -21,21 +21,27 @@ \endhead \bottomrule\noalign{} \endlastfoot -CS231n:计算机视觉 & Stanford & \href{http://cs231n.stanford.edu/}{cs231n.stanford.edu} \\ -Fast.ai:实用深度学习 & fast.ai & \href{https://course.fast.ai/}{course.fast.ai} \\ -吴恩达深度学习专项课 & Coursera & \href{https://www.coursera.org/specializations/deep-learning}{coursera.org} \\ -CS224n:NLP与深度学习 & Stanford & \href{https://web.stanford.edu/class/cs224n/}{web.stanford.edu} \\ -李宏毅机器学习 & YouTube & \href{https://www.youtube.com/c/HungyiLeeNTU}{youtube.com} \\ +CS231n:计算机视觉 & Stanford & +\href{http://cs231n.stanford.edu/}{cs231n.stanford.edu} \\ +Fast.ai:实用深度学习 & fast.ai & +\href{https://course.fast.ai/}{course.fast.ai} \\ +吴恩达深度学习专项课 & Coursera & +\href{https://www.coursera.org/specializations/deep-learning}{coursera.org} \\ +CS224n:NLP与深度学习 & Stanford & +\href{https://web.stanford.edu/class/cs224n/}{web.stanford.edu} \\ +李宏毅机器学习 & YouTube & +\href{https://www.youtube.com/c/HungyiLeeNTU}{youtube.com} \\ \end{longtable} } -\subsection{博客与文档} +\section{博客与文档} \begin{itemize} \item \href{https://lilianweng.github.io/}{Lil'Log} - AI深度技术文章 \item - \href{https://jalammar.github.io/illustrated-transformer/}{The Illustrated Transformer} - 可视化原理解析 + \href{https://jalammar.github.io/illustrated-transformer/}{The + Illustrated Transformer} - 可视化原理解析 \item \href{https://distill.pub/}{Distill.pub} - 交互式可视化论文 \item @@ -46,13 +52,13 @@ CS224n:NLP与深度学习 & Stanford & \href{https://web.stanford.edu/class/cs \href{https://python.langchain.com/}{LangChain文档} \end{itemize} -\subsection{数据集} +\section{数据集} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1735}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1185}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1987}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1928}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1325}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.6506}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 数据集 @@ -65,10 +71,12 @@ CS224n:NLP与深度学习 & Stanford & \href{https://web.stanford.edu/class/cs \endhead \bottomrule\noalign{} \endlastfoot -ImageNet & 图像分类 & \href{https://www.image-net.org/}{image-net.org} \\ +ImageNet & 图像分类 & +\href{https://www.image-net.org/}{image-net.org} \\ COCO & 目标检测 & \href{https://cocodataset.org/}{cocodataset.org} \\ -MNIST & 手写数字 & \href{http://yann.lecun.com/exdb/mnist/}{yann.lecun.com} \\ -OpenStreetMap & 地图数据 & \href{https://www.openstreetmap.org/}{openstreetmap.org} \\ +MNIST & 手写数字 & +\href{http://yann.lecun.com/exdb/mnist/}{yann.lecun.com} \\ +OpenStreetMap & 地图数据 & +\href{https://www.openstreetmap.org/}{openstreetmap.org} \\ \end{longtable} } - diff --git a/appendices/ap06-more-resources.tex b/appendices/ap06-more-resources.tex index 1a0eb80..e243dde 100644 --- a/appendices/ap06-more-resources.tex +++ b/appendices/ap06-more-resources.tex @@ -1,10 +1,10 @@ -\chapter{附录6:其他资源} +\chapter{其他资源} 本附录整理AIGC工具、设计领域AI工具,以及设计AI相关的学术期刊与会议。 -\subsection{AIGC工具}\label{aigcux5de5ux5177} +\section{AIGC工具} -\subsubsection{Stable Diffusion}\label{stable-diffusion} +\subsection{Stable Diffusion}\label{stable-diffusion} \textbf{WebUI}:\href{https://github.com/AUTOMATIC1111/stable-diffusion-webui}{Automatic1111} @@ -14,20 +14,23 @@ \textbf{from} diffusers \textbf{import} StableDiffusionPipeline\\ \strut \\ -pipe = StableDiffusionPipeline.from\_pretrained("runwayml/stable-diffusion-v1-5")\\ -image = pipe("a photo of an astronaut riding a horse on mars").images{[}0{]} +pipe = +StableDiffusionPipeline.from\_pretrained("runwayml/stable-diffusion-v1-5")\\ +image = pipe("a photo of an astronaut riding a horse on +mars").images{[}0{]} -\subsubsection{Midjourney}\label{midjourney} +\subsection{Midjourney}\label{midjourney} -\textbf{平台}:Discord \textbf{文档}:\href{https://docs.midjourney.com/}{docs.midjourney.com} +\textbf{平台}:Discord +\textbf{文档}:\href{https://docs.midjourney.com/}{docs.midjourney.com} -\subsection{设计领域AI工具} +\section{设计领域AI工具} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1790}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2364}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1779}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2111}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2333}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.5333}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 工具 @@ -40,18 +43,23 @@ image = pipe("a photo of an astronaut riding a horse on mars").images{[}0{]} \endhead \bottomrule\noalign{} \endlastfoot -Midjourney & 图像生成与创意探索 & \href{https://www.midjourney.com/}{midjourney.com} \\ -Stable Diffusion & 本地可控图像生成 & \href{https://stability.ai/}{stability.ai} \\ -ControlNet & 精确结构控制 & \href{https://arxiv.org/abs/2302.05543}{arxiv.org} \\ +Midjourney & 图像生成与创意探索 & +\href{https://www.midjourney.com/}{midjourney.com} \\ +Stable Diffusion & 本地可控图像生成 & +\href{https://stability.ai/}{stability.ai} \\ +ControlNet & 精确结构控制 & +\href{https://arxiv.org/abs/2302.05543}{arxiv.org} \\ Figma AI & 界面设计辅助 & \href{https://www.figma.com/}{figma.com} \\ -Galileo AI & 界面布局生成 & \href{https://www.usegalileo.ai/}{usegalileo.ai} \\ -Planner 5D & 室内设计自动生成 & \href{https://planner5d.com/}{planner5d.com} \\ +Galileo AI & 界面布局生成 & +\href{https://www.usegalileo.ai/}{usegalileo.ai} \\ +Planner 5D & 室内设计自动生成 & +\href{https://planner5d.com/}{planner5d.com} \\ \end{longtable} } -\subsection{学术期刊与会议} +\section{学术期刊与会议} -\subsubsection{设计AI相关期刊} +\subsection{设计AI相关期刊} \begin{itemize} \item @@ -62,7 +70,7 @@ Planner 5D & 室内设计自动生成 & \href{https://planner5d.com/}{planner5d. Automation in Construction \end{itemize} -\subsubsection{设计AI相关会议} +\subsection{设计AI相关会议} \begin{itemize} \item @@ -72,4 +80,3 @@ Planner 5D & 室内设计自动生成 & \href{https://planner5d.com/}{planner5d. \item eCAADe \end{itemize} - diff --git a/appendices/ap07-references.tex b/appendices/ap07-references.tex index 4f2fb3e..c681d6b 100644 --- a/appendices/ap07-references.tex +++ b/appendices/ap07-references.tex @@ -1,4 +1,3 @@ -\chapter{附录7:参考文献} +\chapter{参考文献} 本部分整理教材中引用的论文、书籍和在线资源。 - diff --git a/appendices/ap08-glossary.tex b/appendices/ap08-glossary.tex index 89c0075..904a270 100644 --- a/appendices/ap08-glossary.tex +++ b/appendices/ap08-glossary.tex @@ -1,14 +1,14 @@ -\chapter{附录8:关键术语表} +\chapter{关键术语表} 本附录按章节整理书中涉及的关键中英文术语。 -\subsection{第二章} +\section{第二章} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1635}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2921}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.5444}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1597}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2605}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.5630}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 中文 @@ -23,7 +23,8 @@ \endlastfoot 数据模态 & Data Modality & 信息的存在形式,如文本、图像、三维等 \\ 线性回归 & Linear Regression & \(y = ax + b\) 形式的函数拟合 \\ -多元回归 & Multiple Regression & 多输入变量的线性模型 \(y = \sum a_{i}x_{i} + b\) \\ +多元回归 & Multiple Regression & 多输入变量的线性模型 +\(y = \sum a_{i}x_{i} + b\) \\ 多层感知机 & Multi-Layer Perceptron (MLP) & 最基础的前馈神经网络结构 \\ 前向传播 & Forward Propagation & 数据从输入层到输出层的计算过程 \\ 激活函数 & Activation Function & 引入非线性的函数,如ReLU、Sigmoid \\ @@ -37,12 +38,15 @@ 迁移学习 & Transfer Learning & 将一个任务学到的知识迁移到新任务 \\ 基础模型 & Foundation Model & 在大规模数据上预训练的大型通用模型 \\ 涌现能力 & Emergent Abilities & 模型规模大到一定程度后出现的新能力 \\ -缩放定律 & Scaling Law & 模型性能与规模(数据量、参数量、计算量)之间的关系规律 \\ -环境-智能体-任务 & Environment-Agent-Task & AI实践的三元框架:环境提供操作空间,智能体执行任务,任务定义目标 \\ -Vibe Coding & Vibe Coding & 感觉驱动编程,用自然语言描述需求让AI生成代码的编程范式 \\ -全连接层 & Fully Connected Layer & 每个神经元与上一层所有神经元相连的网络层 \\ +缩放定律 & Scaling Law & +模型性能与规模(数据量、参数量、计算量)之间的关系规律 \\ +环境-智能体-任务 & Environment-Agent-Task & +AI实践的三元框架:环境提供操作空间,智能体执行任务,任务定义目标 \\ +Vibe Coding & Vibe Coding & +感觉驱动编程,用自然语言描述需求让AI生成代码的编程范式 \\ +全连接层 & Fully Connected Layer & +每个神经元与上一层所有神经元相连的网络层 \\ 预训练 & Pre-training & 在大规模数据上的初始训练阶段 \\ 微调 & Fine-tuning & 在特定任务数据上对预训练模型进行适配训练 \\ \end{longtable} } - diff --git a/appendices/ap09-tips.tex b/appendices/ap09-tips.tex index 717b5da..cc2b55a 100644 --- a/appendices/ap09-tips.tex +++ b/appendices/ap09-tips.tex @@ -1,8 +1,9 @@ -\chapter{附录9:Tips} +\chapter{Tips} \begin{itemize} \item - 用AI学习AI,大大减少了学习的时间和难度:例如markdown等语法,只需要学习两部分内容:1)掌握经常性的手动输入需要的内容,例如\#,- 等,2)了解剩余的语法的大致机制,例如图片插入可以使用html语法,公式排版使用的是Latex语法,具体实现时让AI撰写。 + 用AI学习AI,大大减少了学习的时间和难度:例如markdown等语法,只需要学习两部分内容:1)掌握经常性的手动输入需要的内容,例如\#,- + 等,2)了解剩余的语法的大致机制,例如图片插入可以使用html语法,公式排版使用的是Latex语法,具体实现时让AI撰写。 \item 有任何不懂的问题,直接问AI,如Claude code等CLI Agent以及在线等的大模型 \end{itemize} diff --git a/chapters/ch01-intro.tex b/chapters/ch01-intro.tex index 27ef87e..f537efb 100644 --- a/chapters/ch01-intro.tex +++ b/chapters/ch01-intro.tex @@ -3,9 +3,10 @@ 本章建立读者对人工智能的宏观认知框架。从 AI 的发展历程出发,回顾从早期符号主义到深度学习、再到大模型时代的关键技术突破与转折节点;进而梳理 AI 的范式演进,从感知智能到生成式智能、从单一任务到通用智能的发展脉络,帮助读者理解 AI 技术的全貌和未来趋势。 -\section{篇章导读} +\section*{篇章导读} +\addcontentsline{toc}{section}{篇章导读} -人工智能正在深刻改变设计的边界。从自动绘图到智能生成,从数据分析到自主决策,AI 技术为设计领域带来了前所未有的可能性。 +人工智能正在深刻改变设计的边界。从自动绘图到智能生成,从数据分析到自主决策,AI 技术为设计领域带来了前所未有的可能性——同时也带来了前所未有的困惑。 本篇将回答两个核心问题: @@ -20,36 +21,34 @@ 通过本篇学习,你将建立对 AI 的宏观认知,理解技术发展的脉络,为后续深入学习打下基础。 -\section{学习目标} +\section*{学习目标} +\addcontentsline{toc}{section}{学习目标} \begin{itemize} \tightlist -\item - 了解 AI 技术发展的关键时间节点 -\item - 理解 AI 四大赛道及其应用场景 -\item - 掌握设计领域 AI 应用的现状与趋势 -\item - 理解 AI 范式的三次演进 -\item - 掌握万能逼近定理的直观意义 -\item - 建立神经网络技术栈的完整认知 -\item - 理解 Scaling Law 与模型规模效应 +\item 了解 AI 技术发展的关键时间节点 +\item 理解 AI 四大赛道及其应用场景 +\item 掌握设计领域 AI 应用的现状与趋势 +\item 理解 AI 范式的三次演进 +\item 掌握万能逼近定理的直观意义 +\item 建立神经网络技术栈的完整认知 +\item 理解 Scaling Law 与模型规模效应 \end{itemize} -\section{第一部分:AI 与设计的交汇} +%% ============================================================ +%% 第一部分:AI 与设计的交汇 +%% ============================================================ -\section{案例引入:Amazon Go} +\section{AI 与设计的交汇} -\subsection{案例背景} +\subsection{案例引入:Amazon Go} -Amazon Go 是亚马逊推出的无人便利店,通过计算机视觉和传感器融合技术,实现“拿了就走”的购物体验。这一案例展示了多种 AI 技术如何协同工作,共同重构一个完整的线下场景。 +\subsubsection{案例背景} -\subsection{技术要素} +Amazon Go 是亚马逊推出的无人便利店,通过计算机视觉和传感器融合技术,实现"拿了就走"的购物体验。这一案例展示了多种 AI 技术如何协同工作,重构一个完整的线下场景。 + +\subsubsection{技术要素} Amazon Go 的 AI 技术栈融合了多项前沿技术: @@ -68,49 +67,55 @@ Amazon Go 的 AI 技术栈融合了多项前沿技术: \end{longtable} } -\subsection{启示} +\subsubsection{启示} -Amazon Go 展示了 AI 技术如何重构传统场景。从“扫码支付”到“拿了就走”,AI 让交互变得更加自然。这个案例也说明,设计领域中许多看似复杂的环境感知与交互问题,都可以通过多技术的组合来加以解决。 +Amazon Go 展示了 AI 技术如何重构传统场景。从"扫码支付"到"拿了就走",AI 让交互变得更加自然。这个案例也说明,设计领域中许多看似复杂的环境感知与交互问题,都可以通过多技术的组合来加以解决。 -\section{AI 发展时间线(2016--2024)} +\subsection{AI 发展时间线} -\subsection{第一阶段:觉醒期(2016--2018)} +\subsubsection{萌芽期(1950s--2015)} + +在深度学习爆发之前,AI 经历了漫长的探索期,积累了关键的理论基础: \begin{itemize} \tightlist -\item - \textbf{2016}:AlphaGo 击败李世石,AI 进入公众视野 -\item - \textbf{2017}:Transformer 架构诞生,为大模型时代奠基 -\item - \textbf{2018}:BERT 预训练模型问世,NLP 任务取得突破 +\item \textbf{1956}:达特茅斯会议,"人工智能"概念正式诞生 +\item \textbf{1986}:反向传播算法(Backpropagation)被广泛应用,成为训练神经网络的核心方法 +\item \textbf{1997}:Deep Blue 击败国际象棋世界冠军卡斯帕罗夫 +\item \textbf{2012}:AlexNet 在 ImageNet 竞赛中大幅领先,深度学习时代开启 \end{itemize} -\subsection{第二阶段:爆发期(2019--2022)} +这段历史告诉我们:AI 并非一夜之间爆发,而是几十年理论沉淀与技术迭代的结果。 + +\subsubsection{觉醒期(2016--2018)} \begin{itemize} \tightlist -\item - \textbf{2019}:GPT-2 展示强大的文本生成能力 -\item - \textbf{2020}:GPT-3 发布,少样本学习能力震惊业界 -\item - \textbf{2022}:ChatGPT 发布,AI 对话能力达到新高度 +\item \textbf{2016}:AlphaGo 击败李世石,AI 进入公众视野 +\item \textbf{2017}:Transformer 架构诞生,为大模型时代奠基 +\item \textbf{2018}:BERT 预训练模型问世,NLP 任务取得突破 \end{itemize} -\subsection{第三阶段:应用期(2023--2024)} +\subsubsection{爆发期(2019--2022)} \begin{itemize} \tightlist -\item - \textbf{2023}:多模态大模型、AI Agent 概念兴起 -\item - \textbf{2024}:具身智能、端侧 AI 加速落地 +\item \textbf{2019}:GPT-2 展示强大的文本生成能力 +\item \textbf{2020}:GPT-3 发布,少样本学习能力震惊业界 +\item \textbf{2022}:ChatGPT 发布,AI 对话能力达到新高度 \end{itemize} -\section{AI 四大赛道} +\subsubsection{应用期(2023--2024)} -\subsection{AIGC(AI-Generated Content)}\label{aigcai-generated-content} +\begin{itemize} +\tightlist +\item \textbf{2023}:多模态大模型、AI Agent 概念兴起 +\item \textbf{2024}:具身智能、端侧 AI 加速落地 +\end{itemize} + +\subsection{AI 四大赛道} + +\subsubsection{AIGC(AI-Generated Content)}\label{aigcai-generated-content} \textbf{定义}:人工智能生成内容 @@ -118,19 +123,15 @@ Amazon Go 展示了 AI 技术如何重构传统场景。从“扫码支付”到 \begin{itemize} \tightlist -\item - 文本生成:文章、报告、代码 -\item - 图像生成:设计稿、效果图、图标 -\item - 视频生成:短视频、动画、特效 -\item - 音频生成:音乐、配音、音效 +\item 文本生成:文章、报告、代码 +\item 图像生成:设计稿、效果图、图标 +\item 视频生成:短视频、动画、特效 +\item 音频生成:音乐、配音、音效 \end{itemize} -\textbf{设计影响}:从“工具辅助”到“生成伙伴” +\textbf{设计影响}:从"工具辅助"到"生成伙伴" -\subsection{Agent(智能体)} +\subsubsection{Agent(智能体)} \textbf{定义}:能够自主感知、规划、执行的系统 @@ -138,19 +139,15 @@ Amazon Go 展示了 AI 技术如何重构传统场景。从“扫码支付”到 \begin{itemize} \tightlist -\item - \textbf{感知(Perception)}:理解环境信息 -\item - \textbf{规划(Planning)}:制定行动方案 -\item - \textbf{记忆(Memory)}:存储和检索经验 -\item - \textbf{工具(Tool Use)}:调用外部资源 +\item \textbf{感知(Perception)}:理解环境信息 +\item \textbf{规划(Planning)}:制定行动方案 +\item \textbf{记忆(Memory)}:存储和检索经验 +\item \textbf{工具(Tool Use)}:调用外部资源 \end{itemize} -\textbf{设计影响}:从“被动执行”到“主动协作” +\textbf{设计影响}:从"被动执行"到"主动协作" -\subsection{AI4S(AI for Science)}\label{ai4sai-for-science} +\subsubsection{AI4S(AI for Science)}\label{ai4sai-for-science} \textbf{定义}:AI 驱动科学发现 @@ -158,19 +155,15 @@ Amazon Go 展示了 AI 技术如何重构传统场景。从“扫码支付”到 \begin{itemize} \tightlist -\item - 蛋白质结构预测(AlphaFold) -\item - 材料科学计算 -\item - 气候变化模拟 -\item - 城市系统优化 +\item 蛋白质结构预测(AlphaFold) +\item 材料科学计算 +\item 气候变化模拟 +\item 城市系统优化 \end{itemize} \textbf{设计影响}:数据驱动的设计决策 -\subsection{AIED(AI in Education)}\label{aiedai-in-education} +\subsubsection{AIED(AI in Education)}\label{aiedai-in-education} \textbf{定义}:AI 在教育领域的应用 @@ -178,21 +171,17 @@ Amazon Go 展示了 AI 技术如何重构传统场景。从“扫码支付”到 \begin{itemize} \tightlist -\item - 个性化学习路径 -\item - 智能答疑与辅导 -\item - 学习行为分析 -\item - 知识图谱构建 +\item 个性化学习路径 +\item 智能答疑与辅导 +\item 学习行为分析 +\item 知识图谱构建 \end{itemize} \textbf{设计影响}:设计教育与人才培养模式变革 -\section{设计领域 AI 应用趋势} +\subsection{设计领域 AI 应用趋势} -\subsection{当前应用} +\subsubsection{当前应用} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{}lll@{}} @@ -210,38 +199,26 @@ Amazon Go 展示了 AI 技术如何重构传统场景。从“扫码支付”到 \end{longtable} } -\subsection{未来趋势} +\subsubsection{未来趋势} \begin{enumerate} \def\labelenumi{\arabic{enumi}.} \tightlist -\item - \textbf{从单点工具到系统化解决方案} -\item - \textbf{从生成内容到生成决策} -\item - \textbf{从人机协作到人机共生} -\end{enumerate} - -\section{思考与练习} - -\begin{enumerate} -\def\labelenumi{\arabic{enumi}.} -\tightlist -\item - 选择你熟悉的设计领域,分析 AI 在该领域的应用现状和潜力。 -\item - 思考 AI 四大赛道中,哪一个对你的专业影响最大?为什么? -\item - Amazon Go 案例中,哪些 AI 技术可以迁移到设计领域? +\item \textbf{从单点工具到系统化解决方案} +\item \textbf{从生成内容到生成决策} +\item \textbf{从人机协作到人机共生} \end{enumerate} -\section{第二部分:AI 范式演进} +%% ============================================================ +%% 第二部分:AI 范式演进 +%% ============================================================ -\section{AI 范式的三次演进} +\section{AI 范式演进} -\subsection{第一范式:规则系统(Symbolic AI)} +\subsection{三次范式演进} + +\subsubsection{第一范式:规则系统(Symbolic AI)} \textbf{时期}:1950s -- 1980s @@ -251,17 +228,14 @@ Amazon Go 展示了 AI 技术如何重构传统场景。从“扫码支付”到 \begin{itemize} \tightlist -\item - 逻辑推理清晰 -\item - 知识表达明确 -\item - 泛化能力弱 +\item 逻辑推理清晰 +\item 知识表达明确 +\item 泛化能力弱 \end{itemize} \textbf{典型应用}:专家系统、棋类游戏 -\subsection{第二范式:机器学习(Machine Learning)} +\subsubsection{第二范式:机器学习(Machine Learning)} \textbf{时期}:1990s -- 2010s @@ -271,17 +245,14 @@ Amazon Go 展示了 AI 技术如何重构传统场景。从“扫码支付”到 \begin{itemize} \tightlist -\item - 数据驱动 -\item - 特征工程依赖专家经验 -\item - 任务特定 +\item 数据驱动 +\item 特征工程依赖专家经验 +\item 任务特定 \end{itemize} \textbf{典型应用}:推荐系统、图像分类、语音识别 -\subsection{第三范式:深度学习(Deep Learning)} +\subsubsection{第三范式:深度学习(Deep Learning)} \textbf{时期}:2012 -- 至今 @@ -291,43 +262,36 @@ Amazon Go 展示了 AI 技术如何重构传统场景。从“扫码支付”到 \begin{itemize} \tightlist -\item - 大数据驱动 -\item - 自动特征学习 -\item - 迁移学习能力强 +\item 大数据驱动 +\item 自动特征学习 +\item 迁移学习能力强 \end{itemize} \textbf{典型应用}:大语言模型、生成式 AI、自动驾驶 -\section{万能逼近定理} +\subsection{万能逼近定理} -\subsection{定理表述} +\subsubsection{定理表述} \textbf{Universal Approximation Theorem(1989)}:一个具有足够多神经元的单隐藏层前馈神经网络,可以以任意精度逼近任何连续函数。 -\subsection{直观理解} +\subsubsection{直观理解} 想象一张橡皮膜: \begin{itemize} \tightlist -\item - 输入空间是平面上的点 -\item - 神经网络调整膜的形状 -\item - 神经元越多,膜的形变能力越强 -\item - 最终可以拟合任意复杂的曲面 +\item 输入空间是平面上的点 +\item 神经网络调整膜的形状 +\item 神经元越多,膜的形变能力越强 +\item 最终可以拟合任意复杂的曲面 \end{itemize} -\subsection{启示} +\subsubsection{启示} 这个定理告诉我们:\textbf{神经网络具有强大的表达能力,理论上可以学习任何复杂的映射关系}。这也是深度学习能够处理图像、语言、语音等复杂任务的数学基础。 -\section{神经网络技术栈全景} +\subsection{神经网络技术栈全景} \begin{lstlisting} ┌─────────────────────────────────────────────────────────────┐ @@ -345,7 +309,7 @@ Amazon Go 展示了 AI 技术如何重构传统场景。从“扫码支付”到 └─────────────────────────────────────────────────────────────┘ \end{lstlisting} -\subsection{技术演进路径} +\subsubsection{技术演进路径} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{}lll@{}} @@ -364,7 +328,7 @@ Amazon Go 展示了 AI 技术如何重构传统场景。从“扫码支付”到 \end{longtable} } -\subsection{模型家族关系} +\subsubsection{模型家族关系} \begin{lstlisting} MLP(多层感知机) @@ -384,73 +348,65 @@ MLP(多层感知机) (生成式) (理解式) (图像生成) \end{lstlisting} -\section{Scaling Law:规模即智能} +\subsection{Scaling Law:规模即智能} -\subsection{什么是 Scaling Law} +\subsubsection{什么是 Scaling Law} Scaling Law(缩放定律)描述了模型性能与计算量、数据量、参数量之间的关系: -\textbf{模型性能 ≈ f(计算量, 数据量, 参数量)} +\textbf{模型性能 $\approx$ f(计算量, 数据量, 参数量)} -\subsection{核心发现} +这一发现来自 Kaplan 等人 2020 年的研究(Scaling Laws for Neural Language Models),揭示了一个令人惊讶的规律:模型性能的提升并非随机的,而是可以被精确预测的。 + +\subsubsection{核心发现} \textbf{1. 性能随规模对数增长} \begin{itemize} \tightlist -\item - 模型越大,性能越好 -\item - 增长是可预测的 +\item 模型越大,性能越好 +\item 性能提升的幅度可以量化预测 \end{itemize} \textbf{2. 计算效率最关键} \begin{itemize} \tightlist -\item - 计算量增加 10 倍 → 性能提升约 1.5 倍 -\item - 数据量和参数量也有类似规律 +\item 计算量增加 10 倍,性能提升约 1.5 倍 +\item 数据量和参数量也有类似规律 \end{itemize} \textbf{3. 没有看到天花板} \begin{itemize} \tightlist -\item - 在现有规模下,性能提升仍在继续 +\item 在现有规模下,性能提升仍在继续 \end{itemize} -\subsection{启示} +\subsubsection{启示} \begin{itemize} \tightlist -\item - \textbf{大模型时代}:规模成为竞争壁垒 -\item - \textbf{数据为王}:高质量数据比模型架构更重要 -\item - \textbf{算力需求}:AI 发展依赖硬件进步 +\item \textbf{大模型时代}:规模成为竞争壁垒 +\item \textbf{数据为王}:高质量数据比模型架构更重要 +\item \textbf{算力需求}:AI 发展依赖硬件进步 +\item \textbf{对设计领域的意义}:开源大模型的涌现使得小型设计团队也能获得强大的 AI 能力,降低了技术门槛 \end{itemize} -\section{从函数式视角看 AI 演进} +\subsection{从函数式视角看 AI 演进} -\subsection{核心理念} +\subsubsection{核心理念} -\textbf{``Functions Describe the World''(函数描述世界)} +\textbf{``Functions Describe the World''(函数描述世界)}——这一理念由美国威廉姆斯学院(Williams College)数学教授 Thomas Garrity 提出。他认为数学各分支本质上都在研究不同类型的函数:代数研究多项式函数,微积分研究光滑函数,线性代数研究线性变换。而世间万物——从声波在耳膜上的振动,到光线在视网膜上的投影——都可以用函数来描述。 \begin{itemize} \tightlist -\item - 物理定律:F = ma -\item - 经济规律:Supply = Demand(Price) -\item - 神经网络:y = f(x; θ) +\item 物理定律:$F = ma$ +\item 经济规律:Supply = Demand(Price) +\item 神经网络:$y = f(x; \theta)$ \end{itemize} -\subsection{AI 即函数组合} +\subsubsection{AI 即函数组合} \begin{lstlisting} 输入数据 x @@ -474,7 +430,7 @@ Scaling Law(缩放定律)描述了模型性能与计算量、数据量、参 输出 y \end{lstlisting} -\subsection{从 Excel 到神经网络} +\subsubsection{从 Excel 到神经网络} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{}ll@{}} @@ -491,17 +447,27 @@ y = a₁x₁ + a₂x₂ + b & 多输入神经元 \\ \end{longtable} } +\section{本章小结} + +本章从两个维度建立了对人工智能的宏观认知。 + +在第一节中,我们沿着时间线梳理了 AI 从萌芽到爆发的关键节点,了解了 AIGC、Agent、AI4S、AIED 四大赛道及其对设计领域的影响。Amazon Go 的案例让我们看到,AI 技术的组合可以重构一个完整的物理场景——这暗示着设计领域同样存在系统化变革的可能。 + +在第二节中,我们审视了 AI 范式的三次演进——从人类编写规则,到机器从数据中学习,再到端到端的深度学习。万能逼近定理告诉我们神经网络理论上可以学习任何映射关系,Scaling Law 则揭示了模型性能的可预测性。而"函数描述世界"的视角,为理解后续章节中的各类神经网络架构提供了统一的认知框架。 + +理解了 AI 的过去和现在,下一章我们将进入 AI 的内部——看看神经网络究竟是如何"学习"的。 + \section{思考与练习} \begin{enumerate} \def\labelenumi{\arabic{enumi}.} \tightlist -\item - 万能逼近定理告诉我们神经网络“能”做任何事,但没有说“如何”高效学习。这个区别意味着什么? -\item - Scaling Law 是否意味着“越大越好”?在资源有限的情况下,应该如何权衡? -\item - 从函数式视角理解 AI,对你理解设计问题有何启发? +\item 选择你熟悉的设计领域,分析 AI 在该领域的应用现状和潜力。 +\item 思考 AI 四大赛道中,哪一个对你的专业影响最大?为什么? +\item Amazon Go 案例中,哪些 AI 技术可以迁移到设计领域? +\item 万能逼近定理告诉我们神经网络"能"做任何事,但没有说"如何"高效学习。这个区别意味着什么? +\item Scaling Law 是否意味着"越大越好"?在资源有限的情况下,应该如何权衡? +\item 从函数式视角理解 AI,对你理解设计问题有何启发? \end{enumerate} @@ -541,12 +507,8 @@ AI in Education & AIED & AI 教育应用 \\ \begin{itemize} \tightlist -\item - \href{https://arxiv.org/abs/2001.08361}{Scaling Laws for Neural Language Models} -\item - \href{https://en.wikipedia.org/wiki/Universal_approximation_theorem}{Universal Approximation Theorem} -\item - \href{https://www.nature.com/articles/s41586-023-06221-x}{The Evolution of AI: A Historical Perspective} -\item - \href{https://arxiv.org/pdf/2308.11432v2}{AI Agent 综述论文} +\item \href{https://arxiv.org/abs/2001.08361}{Scaling Laws for Neural Language Models} +\item \href{https://en.wikipedia.org/wiki/Universal_approximation_theorem}{Universal Approximation Theorem} +\item \href{https://www.nature.com/articles/s41586-023-06221-x}{The Evolution of AI: A Historical Perspective} +\item \href{https://arxiv.org/pdf/2308.11432v2}{AI Agent 综述论文} \end{itemize} diff --git a/chapters/ch02-framework.tex b/chapters/ch02-framework.tex index fb0be03..bce2998 100644 --- a/chapters/ch02-framework.tex +++ b/chapters/ch02-framework.tex @@ -1,22 +1,24 @@ \chapter{设计人工智能的理论框架} -本章建立全书的核心理论框架。我们从“函数描述世界”的理念出发,引入数据模态(Data Modality)作为理解AI技术的组织原则,梳理从小模型到大模型的统一演进规律,并以多层感知机(MLP)作为一切深度学习的基础模型进行系统讲解。 +本章建立全书的核心理论框架。从“函数描述世界”的理念出发,引入数据模态(Data +Modality)作为理解AI技术的组织原则,梳理从小模型到大模型的统一演进规律,并以多层感知机(MLP)作为一切深度学习的基础模型进行系统讲解。 -\section{篇章导读} +- +理解AI不需要逐一学习每种技术。核心理念是:\textbf{所有AI技术都是围绕不同类型的数据(模态)来学习函数}。不同的技术采用不同的方法“获得”这个函数。 -理解AI不需要逐一学习每种技术。核心理念是:\textbf{所有AI技术都是围绕不同类型的数据(模态)来学习函数}。 - -无论是处理文本、图像还是三维空间数据,AI的本质工作都是一样的——从数据中学习映射函数 \(y = f(x; \theta)\)。区别仅在于输入数据的形态不同,因此需要不同的网络结构来高效处理。 - -本章将: - 从函数式视角理解AI的本质 - 建立基于数据模态的全书知识地图 - 揭示所有AI技术背后的统一演进规律 - 深入讲解MLP这一最基础的神经网络 - 建立“环境-智能体-任务”实践框架,降低上手门槛 +- +无论是处理文本、图像还是三维空间数据,AI的本质工作都是一样的——从数据中学习映射函数 +\(y = f(x;\theta)\)。区别仅在于输入数据的形态不同,因此需要不同的网络结构来高效处理。 +- 本章将从函数式视角理解AI的本质 - 建立基于数据模态的全书知识地图 - +揭示所有AI技术背后的统一演进规律 - 深入讲解MLP这一最基础的神经网络 - +建立“环境-智能体-任务”实践框架,降低上手门槛。 \section{函数式AI视角} \subsection{学习目标} \begin{itemize} -\tightlist \item 理解“Functions Describe the World”的核心理念 \item @@ -27,20 +29,29 @@ \subsection{物理定律:用函数描述世界} -物理学是最早用数学函数描述世界的学科。人类科学家花费数百年时间,发现了许多简洁而优美的函数关系: +正如 Garrity 在其著作 \textit{All the Math You Missed} 中所言:``The mantra that we should all chant each night before bed is: Functions Describe the World.'' 物理学是最早践行这一理念的学科。人类科学家花费数百年时间,发现了许多简洁而优美的函数关系: {\def\LTcaptype{none} % do not increment counter -\begin{longtable}[]{@{}lll@{}} +\begin{longtable}[]{@{} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1528}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.5417}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1528}}@{}} \toprule\noalign{} -现象 & 函数 & 发现者 \\ +\begin{minipage}[b]{\linewidth}\raggedright +现象 +\end{minipage} & \begin{minipage}[b]{\linewidth}\raggedright +函数 +\end{minipage} & \begin{minipage}[b]{\linewidth}\raggedright +发现者 +\end{minipage} \\ \midrule\noalign{} \endhead \bottomrule\noalign{} \endlastfoot -自由落体 & \(h = \frac{1}{2}gt^2\) & 伽利略 \\ -万有引力 & \(F = \frac{Gm_1m_2}{r^2}\) & 牛顿 \\ -电磁感应 & \(\varepsilon = -\frac{d\Phi}{dt}\) & 法拉第 \\ -质能等价 & \(E = mc^2\) & 爱因斯坦 \\ +自由落体 & \(h = \frac{1}{2}gt^{2}\) & 伽利略 \\ +万有引力 & \(F = \frac{Gm_{1}m_{2}}{r^{2}}\) & 牛顿 \\ +电磁感应 & \(\varepsilon = - \frac{d\Phi}{dt}\) & 法拉第 \\ +质能等价 & \(E = mc^{2}\) & 爱因斯坦 \\ \end{longtable} } @@ -50,79 +61,111 @@ AI延续了这一传统,但方式截然不同——\textbf{不是由人类发现函数,而是让机器从数据中自动学习函数}。 -\begin{lstlisting} -传统科学: 观察 → 假设 → 验证 → 发现函数 f(x) -AI方法: 数据 → 训练 → 学习函数 y = f(x; θ) -\end{lstlisting} +传统科学: 观察 → 假设 → 验证 → 发现函数 f(x)\\ +AI方法: 数据 → 训练 → 学习函数 y = f(x; θ) 在AI中,函数的一般形式为: -\[y = f(x; \theta)\] +\[y = f(x;\theta)\] -其中: - \(x\) 是\textbf{输入}(如图像、文本、传感器数据) - \(y\) 是\textbf{输出}(如分类标签、预测值、生成内容) - \(\theta\) 是\textbf{可学习参数}(通过训练自动确定) - \(f\) 是\textbf{模型结构}(我们设计的函数框架) +其中: - \(x\) 是\textbf{输入}(如图像、文本、传感器数据) - \(y\) +是\textbf{输出}(如分类标签、预测值、生成内容) - \(\theta\) +是\textbf{可学习参数}(通过训练自动确定) - \(f\) +是\textbf{模型结构}(我们设计的函数框架) -关键区别在于:物理定律中的函数形式是人为确定的(如 \(F=ma\)),而AI中的函数形式由神经网络自动学习,参数 \(\theta\) 通过海量数据训练得到。 +关键区别在于:物理定律中的函数形式是人为确定的(如 +\(F = ma\)),而AI中的函数形式由神经网络自动学习,参数 \(\theta\) +通过海量数据训练得到。 \subsection{从Excel线性回归到神经网络} 这个过程可以用一个渐进的例子来理解。 -\textbf{第一步:简单线性回归(Excel就能做)} +\subsubsection{简单线性回归(Excel就能做)} 预测房价,只有一个输入变量——面积: \[房价 \approx 0.015 \times 面积 + 50万\] -这就是 \(y = ax + b\),最简单的线性函数。在Excel中,我们可以用趋势线功能轻松完成。 +这就是 +\(y = ax + b\),最简单的线性函数。在Excel中,我们可以用趋势线功能轻松完成。 -\textbf{第二步:多元回归} +\subsubsection{多元回归} 增加更多特征: \[房价 \approx 0.01 \times 面积 + 0.5 \times 卧室数 + 0.3 \times 地段评分 - 20万\] -这就是 \(y = a_1x_1 + a_2x_2 + a_3x_3 + b\)。从数学上看,这已经是\textbf{单个神经元}的完整形式。 +这就是 +\(y = a_{1}x_{1} + a_{2}x_{2} + a_{3}x_{3} + b\)。从数学上看,这已经是\textbf{单个神经元}的完整形式。 -\textbf{第三步:多层函数组合} +\subsubsection{多层函数组合} 现实世界的关系往往不是简单的线性关系。我们需要将多个函数组合起来: -\begin{lstlisting} -h₁ = σ(W₁x + b₁) # 第一层:提取基础特征 -h₂ = σ(W₂h₁ + b₂) # 第二层:组合高级特征 -y = σ(W₃h₂ + b₃) # 第三层:输出最终结果 -\end{lstlisting} +\begin{enumerate} +\def\labelenumi{\alph{enumi}.} +\setcounter{enumi}{7} +\item + ₁ = σ(W₁x + b₁) \# 第一层:提取基础特征 +\item + ₂ = σ(W₂h₁ + b₂) \# 第二层:组合高级特征 +\end{enumerate} + +y = σ(W₃h₂ + b₃) \# 第三层:输出最终结果 这就是\textbf{多层神经网络}。每一层都在做线性变换加非线性激活,层层嵌套形成复杂的能力。 \textbf{Python代码示例:简单线性回归} -\begin{lstlisting}[language=Python] -import numpy as np -import matplotlib.pyplot as plt +\textbf{import} numpy \textbf{as} np + +\textbf{import} matplotlib.pyplot \textbf{as} plt + +\emph{\# 生成模拟数据:面积(平方米)与房价(万元)} -# 生成模拟数据:面积(平方米)与房价(万元) np.random.seed(42) -areas = np.random.uniform(50, 200, 100) # 50-200平方米 -prices = 0.015 * areas + 50 + np.random.normal(0, 10, 100) # 加入噪声 -# 使用最小二乘法拟合线性函数 y = ax + b -X = np.column_stack([areas, np.ones_like(areas)]) # 构造设计矩阵 -theta = np.linalg.lstsq(X, prices, rcond=None)[0] # 求解参数 +areas = np.random.uniform(50, 200, 100) \emph{\# 50-200平方米} + +prices = 0.015 * areas + 50 + np.random.normal(0, 10, 100) \emph{\# +加入噪声} + +\emph{\# 使用最小二乘法拟合线性函数 y = ax + b} + +X = np.column\_stack({[}areas, np.ones\_like(areas){]}) \emph{\# +构造设计矩阵} + +theta = np.linalg.lstsq(X, prices, rcond=None){[}0{]} \emph{\# 求解参数} a, b = theta -print(f"学到的函数: 房价 = {a:.4f} × 面积 + {b:.2f}") -print(f"真实函数: 房价 = 0.0150 × 面积 + 50.00") -# 可视化 +print(f"学到的函数: 房价 = \{a:.4f\} × 面积 + \{b:.2f\}") + +print(f"真实函数: 房价 = 0.0150 × 面积 + 50.00") + +\emph{\# 可视化} + plt.figure(figsize=(8, 5)) -plt.scatter(areas, prices, alpha=0.5, label='数据点') -plt.plot(areas, a * areas + b, 'r-', linewidth=2, label=f'拟合: y={a:.4f}x+{b:.1f}') -plt.xlabel('面积(平方米)') -plt.ylabel('房价(万元)') -plt.title('线性回归:从数据中学习函数') + +plt.scatter(areas, prices, alpha=0.5, +label=\textquotesingle 数据点\textquotesingle) + +plt.plot(areas, a * areas + b, \textquotesingle r-\textquotesingle, +linewidth=2, label=f\textquotesingle 拟合: +y=\{a:.4f\}x+\{b:.1f\}\textquotesingle) + +plt.xlabel(\textquotesingle 面积(平方米)\textquotesingle) + +plt.ylabel(\textquotesingle 房价(万元)\textquotesingle) + +plt.title(\textquotesingle 线性回归:从数据中学习函数\textquotesingle) + plt.legend() + plt.grid(True, alpha=0.3) + +\begin{lstlisting} plt.show() \end{lstlisting} @@ -134,41 +177,37 @@ plt.show() \textbf{规则驱动(传统编程)} -\begin{lstlisting}[language=Python] -# 传统方式:人工编写判断规则 -def classify_design_style(image): - if has_minimal_lines(image) and is_monochrome(image): - return "极简主义" - elif has_curved_forms(image) and is_colorful(image): - return "波普风格" - # ... 需要穷举所有情况 - return "未知风格" -\end{lstlisting} +\emph{\# 传统方式:人工编写判断规则}\\ +\textbf{def} classify\_design\_style(image):\\ +\textbf{if} has\_minimal\_lines(image) \textbf{and} +is\_monochrome(image):\\ +\textbf{return} "极简主义"\\ +\textbf{elif} has\_curved\_forms(image) \textbf{and} +is\_colorful(image):\\ +\textbf{return} "波普风格"\\ +\emph{\# ... 需要穷举所有情况}\\ +\textbf{return} "未知风格" -问题: - 规则难以穷举所有情况 - 边界情况(edge case)无法覆盖 - 无法处理模糊和不确定的情况 - 维护成本随复杂度指数增长 +问题: - 规则难以穷举所有情况 - 边界情况(edge case)无法覆盖 - +无法处理模糊和不确定的情况 - 维护成本随复杂度指数增长 -\textbf{数据驱动(AI方法)} +\subsubsection{数据驱动(AI方法)} -\begin{lstlisting}[language=Python] -# AI方式:从标注数据中自动学习 -model = NeuralNetwork() -model.train(thousands_of_labeled_images) # 从数据中学习规律 -result = model.predict(new_image) # 自动判断 -\end{lstlisting} +\emph{\# AI方式:从标注数据中自动学习}\\ +model = NeuralNetwork()\\ +model.train(thousands\_of\_labeled\_images) \emph{\# 从数据中学习规律}\\ +result = model.predict(new\_image) \emph{\# 自动判断} -优势: - 自动发现人类难以表达的规律 - 数据越多,性能越好 - 可以处理复杂的、非线性的关系 - 适应性强,可迁移到新任务 +优势: - 自动发现人类难以表达的规律 - 数据越多,性能越好 - +可以处理复杂的、非线性的关系 - 适应性强,可迁移到新任务 -\begin{quote} \textbf{设计思维的转变}:从“设计规则”到“设计数据”。在AI时代,设计师不仅要设计规则(设计语言、规范),还要设计和管理训练数据,因为数据决定了AI学到的函数。 -\end{quote} - \section{数据模态全景} -\subsection{学习目标} +学习目标 \begin{itemize} -\tightlist \item 理解数据模态(Data Modality)的概念 \item @@ -179,13 +218,13 @@ result = model.predict(new_image) # 自动判断 \subsection{什么是数据模态} -\textbf{模态(Modality)} 是指信息的存在形式和感知方式。人类通过不同感官感知不同模态的信息:耳朵感知声音(一维时间序列),眼睛感知图像(二维像素矩阵),身体感知空间(三维坐标)。 +\textbf{模态(Modality)} +是指信息的存在形式和感知方式。人类通过不同感官感知不同模态的信息:耳朵感知声音(一维时间序列),眼睛感知图像(二维像素矩阵),身体感知空间(三维坐标)。 AI同样需要针对不同模态的数据采用不同的处理方式。一种数据模态决定了: \begin{enumerate} \def\labelenumi{\arabic{enumi}.} -\tightlist \item \textbf{数据的组织形式}:文本是符号序列,图像是像素矩阵,三维数据是点云或网格 \item @@ -204,13 +243,13 @@ AI同样需要针对不同模态的数据采用不同的处理方式。一种数 {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 12\tabcolsep) * \real{0.0857}} - >{\raggedright\arraybackslash}p{(\linewidth - 12\tabcolsep) * \real{0.1286}} - >{\raggedright\arraybackslash}p{(\linewidth - 12\tabcolsep) * \real{0.1286}} - >{\raggedright\arraybackslash}p{(\linewidth - 12\tabcolsep) * \real{0.1286}} - >{\raggedright\arraybackslash}p{(\linewidth - 12\tabcolsep) * \real{0.2714}} - >{\raggedright\arraybackslash}p{(\linewidth - 12\tabcolsep) * \real{0.1286}} - >{\raggedright\arraybackslash}p{(\linewidth - 12\tabcolsep) * \real{0.1286}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 12\tabcolsep) * \real{0.1337}} + >{\raggedright\arraybackslash}p{(\linewidth - 12\tabcolsep) * \real{0.0756}} + >{\raggedright\arraybackslash}p{(\linewidth - 12\tabcolsep) * \real{0.1337}} + >{\raggedright\arraybackslash}p{(\linewidth - 12\tabcolsep) * \real{0.0988}} + >{\raggedright\arraybackslash}p{(\linewidth - 12\tabcolsep) * \real{0.2326}} + >{\raggedright\arraybackslash}p{(\linewidth - 12\tabcolsep) * \real{0.2500}} + >{\raggedright\arraybackslash}p{(\linewidth - 12\tabcolsep) * \real{0.0640}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 模态 @@ -231,12 +270,21 @@ AI同样需要针对不同模态的数据采用不同的处理方式。一种数 \endhead \bottomrule\noalign{} \endlastfoot -\textbf{一维:文本与序列} & 1D & 文本、时间序列、音乐 & Token序列 & RNN → LSTM → BERT → GPT-4 & 设计文本生成、用户评论分析、设计趋势预测 & 第3章 \\ -\textbf{二维:图像与视觉} & 2D & 图像、视觉设计稿 & 像素矩阵 & LeNet → ResNet → ViT → SAM & 图像分类、目标检测、风格迁移、设计评估 & 第4章 \\ -\textbf{三维:空间与几何} & 3D & 点云、网格、体素 & 3D坐标集 & PointNet → DGCNN → Point Transformer & 三维重建、空间分析、建筑设计、数字孪生 & 第5章 \\ -\textbf{决策序列} & 时序决策 & 状态-动作对 & 状态→动作映射 & Q-Learning → DQN → PPO → AlphaGo & 布局优化、参数调优、自适应设计 & 第6章 \\ -\textbf{生成} & 创造性输出 & 图像、文本、音频 & 噪声/条件 & VAE → GAN → Diffusion → Sora & AIGC设计、概念生成、风格迁移、设计探索 & 第7章 \\ -\textbf{行动序列} & 多步行动 & 任务-工具-行动链 & 目标→计划→执行 & ReAct → Toolformer → AutoGPT → GPT-4V & 智能设计助手、自动化工作流、多Agent协作 & 第8章 \\ +\textbf{一维:文本与序列} & 1D & 文本、时间序列、音乐 & Token序列 & RNN +→ LSTM → BERT → GPT-4 & 设计文本生成、用户评论分析、设计趋势预测 & +第3章 \\ +\textbf{二维:图像与视觉} & 2D & 图像、视觉设计稿 & 像素矩阵 & LeNet → +ResNet → ViT → SAM & 图像分类、目标检测、风格迁移、设计评估 & 第4章 \\ +\textbf{三维:空间与几何} & 3D & 点云、网格、体素 & 3D坐标集 & PointNet +→ DGCNN → Point Transformer & 三维重建、空间分析、建筑设计、数字孪生 & +第5章 \\ +\textbf{决策序列} & 时序决策 & 状态-动作对 & 状态→动作映射 & Q-Learning +→ DQN → PPO → AlphaGo & 布局优化、参数调优、自适应设计 & 第6章 \\ +\textbf{生成} & 创造性输出 & 图像、文本、音频 & 噪声/条件 & VAE → GAN → +Diffusion → Sora & AIGC设计、概念生成、风格迁移、设计探索 & 第7章 \\ +\textbf{行动序列} & 多步行动 & 任务-工具-行动链 & 目标→计划→执行 & ReAct +→ Toolformer → AutoGPT → GPT-4V & +智能设计助手、自动化工作流、多Agent协作 & 第8章 \\ \end{longtable} } @@ -244,49 +292,53 @@ AI同样需要针对不同模态的数据采用不同的处理方式。一种数 这六种模态并非孤立存在,它们之间存在密切的内在联系: -\begin{lstlisting} - ┌──────────────┐ - │ 一维:序列 │ - │ (第3章) │ - └──────┬───────┘ - │ 序列化的基础 - ┌──────┴───────┐ - │ 二维:视觉 │ - │ (第4章) │ - └──────┬───────┘ - │ 空间维度的扩展 - ┌──────┴───────┐ - │ 三维:空间 │ - │ (第5章) │ - └──────┬───────┘ - │ - ┌────────────┼────────────┐ - │ │ │ - ┌──────┴──────┐ ┌──┴───┐ ┌──────┴──────┐ - │ 决策序列 │ │ 生成 │ │ 行动序列 │ - │ (第6章) │ │(第7章)│ │ (第8章) │ - └─────────────┘ └──────┘ └─────────────┘ -\end{lstlisting} +┌──────────────┐\\ +│ 一维:序列 │\\ +│ (第3章) │\\ +└──────┬───────┘\\ +│ 序列化的基础\\ +┌──────┴───────┐\\ +│ 二维:视觉 │\\ +│ (第4章) │\\ +└──────┬───────┘\\ +│ 空间维度的扩展\\ +┌──────┴───────┐\\ +│ 三维:空间 │\\ +│ (第5章) │\\ +└──────┬───────┘\\ +│\\ +┌────────────┼────────────┐\\ +│ │ │\\ +┌──────┴──────┐ ┌──┴───┐ ┌──────┴──────┐\\ +│ 决策序列 │ │ 生成 │ │ 行动序列 │\\ +│ (第6章) │ │(第7章)│ │ (第8章) │\\ +└─────────────┘ └──────┘ └─────────────┘ -\textbf{从感知到行动的逻辑链条}: - \textbf{一维到三维}是感知智能的递进——从理解语言、识别图像到感知空间 - \textbf{决策序列}将感知转化为行动策略——在环境中做出最优选择 - \textbf{生成}突破感知的局限——不仅理解,还能创造新内容 - \textbf{行动序列}整合所有能力——感知、规划、执行形成闭环 +\textbf{从感知到行动的逻辑链条}: - +\textbf{一维到三维}是感知智能的递进——从理解语言、识别图像到感知空间 +- \textbf{决策序列}将感知转化为行动策略——在环境中做出最优选择 - +\textbf{生成}突破感知的局限——不仅理解,还能创造新内容 - +\textbf{行动序列}整合所有能力——感知、规划、执行形成闭环 \subsection{为什么模态是有用的组织原则} -\textbf{第一,降低学习门槛。} 不需要一次性理解所有AI技术,只需要按数据类型逐一学习。理解了文本处理的方法后,很多概念可以直接迁移到图像处理。 +\textbf{第一,降低学习门槛。} +不需要一次性理解所有AI技术,只需要按数据类型逐一学习。理解了文本处理的方法后,很多概念可以直接迁移到图像处理。 -\textbf{第二,揭示统一规律。} 虽然不同模态使用的网络结构不同,但背后遵循相同的学习范式——都是从小模型到大模型的演进(见2.3节)。 +\textbf{第二,揭示统一规律。} +虽然不同模态使用的网络结构不同,但背后遵循相同的学习范式——都是从小模型到大模型的演进(见2.3节)。 -\textbf{第三,对应设计实践。} 设计师日常接触的信息天然是按模态划分的:文字(设计说明)、图像(效果图)、三维模型(空间设计)。按模态组织知识,便于直接找到所需技术。 - -\textbf{第四,预见技术趋势。} 理解了模态框架,就能更好地理解多模态(Multimodal)AI的发展方向——让AI同时处理多种模态的数据,正如人类同时用视觉、听觉和触觉感知世界。 +\textbf{第三,对应设计实践。} +设计师日常接触的信息天然是按模态划分的:文字(设计说明)、图像(效果图)、三维模型(空间设计)。按模态组织知识,便于直接找到所需技术。 +\textbf{第四,预见技术趋势。} +理解了模态框架,就能更好地理解多模态(Multimodal)AI的发展方向——让AI同时处理多种模态的数据,正如人类同时用视觉、听觉和触觉感知世界。 \section{小模型到大模型的演进规律} -\subsection{学习目标} +学习目标 \begin{itemize} -\tightlist \item 理解AI技术发展的四个阶段 \item @@ -299,39 +351,46 @@ AI同样需要针对不同模态的数据采用不同的处理方式。一种数 纵观AI各个模态的发展历程,可以提炼出一个统一的四阶段演进模式: -\textbf{第一阶段:手工特征时代(Hand-crafted Features)} +\subsubsection{第一阶段:手工特征时代(Hand-crafted Features)} -人类专家根据领域知识,手工设计特征提取方法。例如,图像处理中的边缘检测算子(Sobel、Canny)、纹理特征(HOG、SIFT),自然语言处理中的词袋模型(Bag of Words)、TF-IDF等。 +人类专家根据领域知识,手工设计特征提取方法。例如,图像处理中的边缘检测算子(Sobel、Canny)、纹理特征(HOG、SIFT),自然语言处理中的词袋模型(Bag +of Words)、TF-IDF等。 -特点: - 特征由人类专家精心设计 - 每个特征都有明确的物理含义 - 性能受限于人类的领域知识和表达能力 - 适合数据量小、计算资源有限的场景 +特点: - 特征由人类专家精心设计 - 每个特征都有明确的物理含义 - +性能受限于人类的领域知识和表达能力 - 适合数据量小、计算资源有限的场景 -\textbf{第二阶段:自动学习时代(Deep Learning)} +\subsubsection{第二阶段:自动学习时代(Deep Learning)} 深度学习让模型自动从原始数据中学习特征。卷积神经网络(CNN)自动学习图像特征,循环神经网络(RNN)自动学习序列特征。 -特点: - 特征由网络自动学习,无需人工设计 - 端到端(End-to-End)的训练方式 - 需要大量标注数据 - 性能大幅超越手工特征方法 +特点: - 特征由网络自动学习,无需人工设计 - +端到端(End-to-End)的训练方式 - 需要大量标注数据 - +性能大幅超越手工特征方法 -\textbf{第三阶段:预训练时代(Pre-training)} +\subsubsection{第三阶段:预训练时代(Pre-training)} 通过在大规模无标注数据上的预训练,模型学习通用知识,再通过微调(Fine-tuning)适配具体任务。迁移学习使得少量标注数据也能获得优秀性能。 -特点: - 先预训练学通用知识,再微调适配任务 - 大幅减少对标注数据的依赖 - 模型开始具备迁移和泛化能力 - “预训练+微调”成为标准范式 +特点: - 先预训练学通用知识,再微调适配任务 - 大幅减少对标注数据的依赖 - +模型开始具备迁移和泛化能力 - ``预训练+微调“成为标准范式 -\textbf{第四阶段:大模型时代(Foundation Models)} +\subsubsection{第四阶段:大模型时代(Foundation Models)} -参数规模达到十亿甚至万亿级别的模型,展现出“涌现能力”(Emergent Abilities)——模型规模大到一定程度后,突然具备了小模型没有的新能力。 +参数规模达到十亿甚至万亿级别的模型,展现出”涌现能力''(Emergent +Abilities)——模型规模大到一定程度后,突然具备了小模型没有的新能力。 -特点: - 单一模型处理多种任务(通用性) - 涌现能力:规模带来质变 - 少样本甚至零样本学习 - Scaling Law:性能随规模持续提升 +特点: - 单一模型处理多种任务(通用性) - 涌现能力:规模带来质变 - +少样本甚至零样本学习 - Scaling Law:性能随规模持续提升 \subsection{四阶段对比} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.1154}} - >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.2308}} - >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.2308}} - >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.2115}} - >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.2115}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.1919}} + >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.2020}} + >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.1717}} + >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.2222}} + >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.1919}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 维度 @@ -349,11 +408,14 @@ AI同样需要针对不同模态的数据采用不同的处理方式。一种数 \bottomrule\noalign{} \endlastfoot \textbf{特征提取方式} & 人工设计 & 自动学习 & 预训练+微调 & 涌现学习 \\ -\textbf{数据需求} & 少量标注数据 & 大量标注数据 & 大量无标注+少量标注 & 海量多模态数据 \\ +\textbf{数据需求} & 少量标注数据 & 大量标注数据 & 大量无标注+少量标注 & +海量多模态数据 \\ \textbf{计算资源} & CPU即可 & 需要GPU & 需要多GPU & 需要大规模集群 \\ \textbf{模型特点} & 任务专用 & 任务专用但自动 & 可迁移 & 通用基础模型 \\ -\textbf{典型模型} & SIFT、HOG、TF-IDF & AlexNet、LSTM & BERT、ResNet & GPT-4、SAM、Sora \\ -\textbf{设计影响} & 基础图像处理 & 自动化设计分析 & 设计知识迁移 & 通用设计智能 \\ +\textbf{典型模型} & SIFT、HOG、TF-IDF & AlexNet、LSTM & BERT、ResNet & +GPT-4、SAM、Sora \\ +\textbf{设计影响} & 基础图像处理 & 自动化设计分析 & 设计知识迁移 & +通用设计智能 \\ \end{longtable} } @@ -361,118 +423,99 @@ AI同样需要针对不同模态的数据采用不同的处理方式。一种数 每种模态都经历了相同的四个阶段,只是时间线略有不同: -\textbf{文本与序列(一维)} +\subsubsection{文本与序列(一维)} + +手工特征 自动学习 预训练 大模型\\ +TF-IDF → Word2Vec → BERT (2018) → GPT-4 (2023)\\ +词袋模型 LSTM/GRU ELMo Claude\\ +N-gram Seq2Seq T5 Llama + +\subsubsection{图像与视觉(二维)} + +手工特征 自动学习 预训练 大模型\\ +SIFT → AlexNet → ResNet → SAM (2023)\\ +HOG VGGNet EfficientNet DINOv2\\ +Canny边缘 YOLO CLIP GPT-4V + +\subsubsection{三维空间(三维)} \begin{lstlisting} 手工特征 自动学习 预训练 大模型 -TF-IDF → Word2Vec → BERT (2018) → GPT-4 (2023) -词袋模型 LSTM/GRU ELMo Claude -N-gram Seq2Seq T5 Llama \end{lstlisting} -\textbf{图像与视觉(二维)} - -\begin{lstlisting} -手工特征 自动学习 预训练 大模型 -SIFT → AlexNet → ResNet → SAM (2023) -HOG VGGNet EfficientNet DINOv2 -Canny边缘 YOLO CLIP GPT-4V -\end{lstlisting} - -\textbf{三维空间(三维)} - -\begin{lstlisting} -手工特征 自动学习 预训练 大模型 -FPFH → PointNet → Point-BERT → Point-E -3D形状上下文 DGCNN Point-MAE Shape-E -体素特征 PointNet++ ULIP LRM -\end{lstlisting} - -\textbf{生成模型} - -\begin{lstlisting} -手工特征 自动学习 预训练 大模型 -规则模板 → VAE/GAN → StyleGAN → Stable Diffusion -马尔可夫链 PixelCNN BigGAN DALL-E 3 -分形算法 CycleGAN Craiyon Sora -\end{lstlisting} - -\begin{quote} -\textbf{关键洞察}:无论哪种模态,发展路径都遵循相同的规律——从人工设计到自动学习,从专用到通用,从小规模到大规模。理解了这个规律,即使面对全新的AI技术,也能快速定位它所处的阶段和意义。 -\end{quote} - -\subsection{对设计师的启示} +FPFH → PointNet → Point-BERT → Point-E \begin{enumerate} \def\labelenumi{\arabic{enumi}.} +\setcounter{enumi}{4} +\tightlist \item - \textbf{不要被具体模型名称迷惑}。模型千变万化,但底层逻辑相同。重要的是理解它属于哪个阶段、处理什么模态的数据。 -\item - \textbf{关注趋势而非细节}。AI技术迭代极快,具体的模型可能很快过时,但从手工到自动、从小到大的趋势不会改变。 -\item - \textbf{预训练时代是设计师的最佳入口}。利用预训练模型,设计师不需要海量数据和强大算力,就能将AI应用到设计实践中。 -\item - \textbf{大模型时代带来“民主化”}。大模型通过自然语言交互降低了AI的使用门槛,设计师可以用自然语言指挥AI完成设计任务。 + D形状上下文 DGCNN Point-MAE Shape-E \end{enumerate} +\begin{lstlisting} +体素特征 PointNet++ ULIP LRM +\end{lstlisting} + +\subsubsection{生成模型} + +手工特征 自动学习 预训练 大模型\\ +规则模板 → VAE/GAN → StyleGAN → Stable Diffusion\\ +马尔可夫链 PixelCNN BigGAN DALL-E 3\\ +分形算法 CycleGAN Craiyon Sora + +\textbf{关键洞察}:无论哪种模态,发展路径都遵循相同的规律——从人工设计到自动学习,从专用到通用,从小规模到大规模。理解了这个规律,即使面对全新的AI技术,也能快速定位它所处的阶段和意义。 + +\subsection{对设计师的启示} + +1.\textbf{不要被具体模型名称迷惑}。模型千变万化,但底层逻辑相同。重要的是理解它属于哪个阶段、处理什么模态的数据。 + +2.\textbf{关注趋势而非细节}。AI技术迭代极快,具体的模型可能很快过时,但从手工到自动、从小到大的趋势不会改变。 + +3.\textbf{预训练时代是设计师的最佳入口}。利用预训练模型,设计师不需要海量数据和强大算力,就能将AI应用到设计实践中。 + +4.\textbf{大模型时代带来“民主化”}。大模型通过自然语言交互降低了AI的使用门槛,设计师可以用自然语言指挥AI完成设计任务。 \section{MLP:一切的基础} -\subsection{学习目标} - -\begin{itemize} -\tightlist -\item - 理解多层感知机(MLP)的网络架构 -\item - 掌握前向传播的计算过程 -\item - 了解激活函数、损失函数和反向传播的基本原理 -\item - 建立对神经网络训练过程的完整认知 -\end{itemize} - \subsection{为什么MLP如此重要} -多层感知机(Multi-Layer Perceptron, MLP)是最基础的神经网络结构。虽然现代AI使用CNN、Transformer等更复杂的架构,但它们的底层构件仍然是MLP中的基本操作:线性变换、非线性激活、损失计算和梯度更新。 +多层感知机(Multi-Layer Perceptron, +MLP)是最基础的神经网络结构。虽然现代AI使用CNN、Transformer等更复杂的架构,但它们的底层构件仍然是MLP中的基本操作:线性变换、非线性激活、损失计算和梯度更新。 \textbf{理解MLP是理解所有深度学习的起点。} -\begin{lstlisting} -MLP(多层感知机) - │ - ├── CNN(卷积神经网络)= 局部连接的MLP + 权重共享 - │ - ├── RNN(循环神经网络)= 共享参数的MLP + 时间展开 - │ - └── Transformer = 注意力机制 + MLP -\end{lstlisting} +MLP(多层感知机)\\ +│\\ +├── CNN(卷积神经网络)= 局部连接的MLP + 权重共享\\ +│\\ +├── RNN(循环神经网络)= 共享参数的MLP + 时间展开\\ +│\\ +└── Transformer = 注意力机制 + MLP \subsection{网络架构} MLP由三种类型的层组成: -\begin{lstlisting} -输入层 隐藏层1 隐藏层2 输出层 -┌─────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────┐ -│ x₁ │ │ h₁ │ │ g₁ │ │ y₁ │ -│ x₂ │───→│ h₂ │──→│ g₂ │──→│ y₂ │ -│ x₃ │ │ h₃ │ │ g₃ │ │ y₃ │ -│ ... │ │ ... │ │ ... │ │ ... │ -│ xₙ │ │ hₘ │ │ gₖ │ │ yₚ │ -└─────────┘ └─────────────┘ └─────────────┘ └─────────┘ - │ │ │ │ - └───────────────┴─────────────────┴────────────────┘ - 全连接(Fully Connected):每个神经元与上一层所有神经元相连 -\end{lstlisting} +输入层 隐藏层1 隐藏层2 输出层\\ +┌─────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────┐\\ +│ x₁ │ │ h₁ │ │ g₁ │ │ y₁ │\\ +│ x₂ │───→│ h₂ │──→│ g₂ │──→│ y₂ │\\ +│ x₃ │ │ h₃ │ │ g₃ │ │ y₃ │\\ +│ ... │ │ ... │ │ ... │ │ ... │\\ +│ xₙ │ │ hₘ │ │ gₖ │ │ yₚ │\\ +└─────────┘ └─────────────┘ └─────────────┘ └─────────┘\\ +│ │ │ │\\ +└───────────────┴─────────────────┴────────────────┘\\ +全连接(Fully Connected):每个神经元与上一层所有神经元相连 各层的作用: {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3200}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.2400}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.4400}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1059}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.4588}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.4118}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 层类型 @@ -485,7 +528,8 @@ MLP由三种类型的层组成: \endhead \bottomrule\noalign{} \endlastfoot -输入层 & 接收原始数据,每个神经元对应一个特征 & 取决于数据特征数(如图像像素数) \\ +输入层 & 接收原始数据,每个神经元对应一个特征 & +取决于数据特征数(如图像像素数) \\ 隐藏层 & 特征变换与组合,逐步提取高级特征 & 可自由设计(超参数) \\ 输出层 & 产生最终预测结果 & 取决于任务(分类数或回归值数) \\ \end{longtable} @@ -495,103 +539,145 @@ MLP由三种类型的层组成: \subsection{前向传播} -前向传播(Forward Propagation)是数据从输入层经过各隐藏层到达输出层的计算过程。 +前向传播(Forward +Propagation)是数据从输入层经过各隐藏层到达输出层的计算过程。 \textbf{单个神经元的计算} 每个神经元执行两个操作: -\begin{lstlisting} -步骤1:线性变换 z = W₁x₁ + W₂x₂ + ... + Wₙxₙ + b = Wx + b -步骤2:非线性激活 h = σ(z) -\end{lstlisting} +步骤1:线性变换 z = W₁x₁ + W₂x₂ + ... + Wₙxₙ + b = Wx + b\\ +步骤2:非线性激活 h = σ(z) -其中 \(W\) 是权重(Weight),\(b\) 是偏置(Bias),\(\sigma\) 是激活函数(Activation Function)。 +其中 \(W\) 是权重(Weight),\(b\) 是偏置(Bias),\(\sigma\) +是激活函数(Activation Function)。 -\textbf{完整网络的前向传播} +\subsubsection{完整网络的前向传播} 对于L层网络,前向传播逐层计算: -\begin{lstlisting} -# 第1层 -h₁ = σ₁(W₁ · x + b₁) +\# 第1层 + +\begin{enumerate} +\def\labelenumi{\alph{enumi}.} +\setcounter{enumi}{7} +\item + ₁ = σ₁(W₁ · x + b₁) +\item + \# 第2层 +\end{enumerate} -# 第2层 h₂ = σ₂(W₂ · h₁ + b₂) -# ... 第l层 +\# ... 第l层 + hₗ = σₗ(Wₗ · hₗ₋₁ + bₗ) -# 输出层 +\# 输出层 + +\begin{lstlisting} y = hₗ \end{lstlisting} 用更简洁的函数组合表示: -\[y = f_L(f_{L-1}(\cdots f_2(f_1(x))\cdots))\] +\[y = f_{L}(f_{L - 1}(\cdots f_{2}(f_{1}(x))\cdots))\] \textbf{数据流动示意} -\begin{lstlisting} -输入向量 x - │ - ├─→ 线性变换: z₁ = W₁x + b₁ - │ │ - │ └─→ 激活函数: h₁ = σ(z₁) - │ │ - │ └─→ 线性变换: z₂ = W₂h₁ + b₂ - │ │ - │ └─→ 激活函数: h₂ = σ(z₂) - │ │ - │ └─→ ... → y(输出) -\end{lstlisting} +输入向量 x\\ +│\\ +├─→ 线性变换: z₁ = W₁x + b₁\\ +│ │\\ +│ └─→ 激活函数: h₁ = σ(z₁)\\ +│ │\\ +│ └─→ 线性变换: z₂ = W₂h₁ + b₂\\ +│ │\\ +│ └─→ 激活函数: h₂ = σ(z₂)\\ +│ │\\ +│ └─→ ... → y(输出) \textbf{Python代码示例:手动实现前向传播} -\begin{lstlisting}[language=Python] -import numpy as np +\textbf{import} numpy \textbf{as} np -def sigmoid(x): - """Sigmoid激活函数""" - return 1 / (1 + np.exp(-x)) +\textbf{def} sigmoid(x): -def relu(x): - """ReLU激活函数""" - return np.maximum(0, x) +\emph{"""Sigmoid激活函数"""} -# 定义一个简单的3层MLP -# 输入: 4维 → 隐藏层1: 8个神经元 → 隐藏层2: 4个神经元 → 输出: 2维 +\textbf{return} 1 / (1 + np.exp(-x)) -# 初始化权重和偏置(实际中由训练得到) -W1 = np.random.randn(8, 4) * 0.01 # (8, 4) +\textbf{def} relu(x): + +\emph{"""ReLU激活函数"""} + +\textbf{return} np.maximum(0, x) + +\emph{\# 定义一个简单的3层MLP} + +\begin{quote} +\emph{\# 输入: 4维 → 隐藏层1: 8个神经元 → 隐藏层2: 4个神经元 → 输出: +2维} +\end{quote} + +\emph{\# 初始化权重和偏置(实际中由训练得到)} + +W1 = p.random.randn(8, 4) * 0.01 \emph{\# (8, 4)} + +\begin{lstlisting} b1 = np.zeros((8, 1)) # (8, 1) -W2 = np.random.randn(4, 8) * 0.01 # (4, 8) +\end{lstlisting} + +W2 = np.random.randn(4, 8) * 0.01 \emph{\# (4, 8)} + +\begin{lstlisting} b2 = np.zeros((4, 1)) # (4, 1) -W3 = np.random.randn(2, 4) * 0.01 # (2, 4) +\end{lstlisting} + +W3 = np.random.randn(2, 4) * 0.01 \emph{\# (2, 4)} + +\begin{lstlisting} b3 = np.zeros((2, 1)) # (2, 1) +\end{lstlisting} -# 输入数据(4个特征) -x = np.array([[0.5], [0.3], [0.8], [0.1]]) # (4, 1) +\emph{\# 输入数据(4个特征)} -# 前向传播 +x = np.array({[}{[}0.5{]}, {[}0.3{]}, {[}0.8{]}, {[}0.1{]}{]}) \emph{\# +(4, 1)} + +\emph{\# 前向传播} + +\begin{lstlisting} z1 = np.dot(W1, x) + b1 # 线性变换 h1 = relu(z1) # ReLU激活 -z2 = np.dot(W2, h1) + b2 # 线性变换 -h2 = relu(z2) # ReLU激活 -z3 = np.dot(W3, h2) + b3 # 线性变换 -y = sigmoid(z3) # Sigmoid激活(输出层) +\end{lstlisting} -print(f"输入: {x.flatten()}") -print(f"隐藏层1输出: {h1.flatten()}") -print(f"隐藏层2输出: {h2.flatten()}") +z2 = np.dot(W2, h1) + b2 \emph{\# 线性变换} + +\begin{lstlisting} +h2 = relu(z2) # ReLU激活 +\end{lstlisting} + +z3 = np.dot(W3, h2) + b3 \emph{\# 线性变换} + +y = sigmoid(z3) \emph{\# Sigmoid激活(输出层)} + +print(f"输入: \{x.flatten()\}") + +print(f"隐藏层1输出: \{h1.flatten()\}") + +print(f"隐藏层2输出: \{h2.flatten()\}") + +\begin{lstlisting} print(f"最终输出: {y.flatten()}") \end{lstlisting} \subsection{激活函数} -激活函数(Activation Function)是神经网络的“灵魂”。没有激活函数,无论网络有多少层,都等价于一个单层线性变换: +激活函数(Activation +Function)是神经网络的“灵魂”。没有激活函数,无论网络有多少层,都等价于一个单层线性变换: -\[y = W_2(W_1x) = (W_2W_1)x = W'x\] +\[y = W_{2}(W_{1}x) = (W_{2}W_{1})x = W'x\] 激活函数引入\textbf{非线性},使网络能够拟合任意复杂的函数关系。 @@ -599,11 +685,11 @@ print(f"最终输出: {y.flatten()}") {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.2308}} - >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.1538}} - >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.2308}} - >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.1538}} - >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.2308}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.0805}} + >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.4631}} + >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.1074}} + >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.2215}} + >{\raggedright\arraybackslash}p{(\linewidth - 8\tabcolsep) * \real{0.1141}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 激活函数 @@ -620,47 +706,50 @@ print(f"最终输出: {y.flatten()}") \endhead \bottomrule\noalign{} \endlastfoot -Sigmoid & \(\sigma(z) = \frac{1}{1+e^{-z}}\) & (0, 1) & 输出可解释为概率;两端梯度消失 & 二分类输出层 \\ -ReLU & \(\text{ReLU}(z) = \max(0, z)\) & {[}0, +∞) & 计算简单高效;缓解梯度消失 & \textbf{隐藏层首选} \\ -Tanh & \(\tanh(z) = \frac{e^z - e^{-z}}{e^z + e^{-z}}\) & (-1, 1) & 零中心化;两端梯度消失 & 循环网络隐藏层 \\ -Softmax & \(\text{softmax}(z_i) = \frac{e^{z_i}}{\sum_j e^{z_j}}\) & (0, 1),和为1 & 输出为概率分布 & 多分类输出层 \\ -LeakyReLU & \(\text{LeakyReLU}(z) = \max(\alpha z, z)\) & (-∞, +∞) & 解决ReLU“死神经元”问题 & 深层网络隐藏层 \\ +Sigmoid & \(\sigma(z) = \frac{1}{1 + e^{- z}}\) & (0, 1) & +输出可解释为概率;两端梯度消失 & 二分类输出层 \\ +ReLU & \(\text{ReLU}(z) = max(0,z)\) & {[}0, +∞) & +计算简单高效;缓解梯度消失 & \textbf{隐藏层首选} \\ +Tanh & \(tanh(z) = \frac{e^{z} - e^{- z}}{e^{z} + e^{- z}}\) & (-1, 1) & +零中心化;两端梯度消失 & 循环网络隐藏层 \\ +Softmax & +\(\text{softmax}(z_{i}) = \frac{e^{z_{i}}}{\sum_{j}^{}e^{z_{j}}}\) & (0, +1),和为1 & 输出为概率分布 & 多分类输出层 \\ +LeakyReLU & \(\text{LeakyReLU}(z) = max(\alpha z,z)\) & (-∞, +∞) & +解决ReLU“死神经元”问题 & 深层网络隐藏层 \\ \end{longtable} } \textbf{视觉对比} -\begin{lstlisting} -ReLU: Sigmoid: Tanh: - ↑ ___ ___ - │ / \ / \ - │ / \ / \ - │ ____ / \ ____ / \ ____ - │___________| │ │ │ │ - └───────────┼──→ └──────────┘ └────────────────────┘ - -∞ 0 +∞ -∞ 0 +∞ -∞ 0 +∞ +ReLU: Sigmoid: Tanh:\\ +↑ \_\_\_ \_\_\_\\ +│ / \textbackslash{} / \textbackslash{}\\ +│ / \textbackslash{} / \textbackslash{}\\ +│ \_\_\_\_ / \textbackslash{} \_\_\_\_ / \textbackslash{} \_\_\_\_\\ +│\_\_\_\_\_\_\_\_\_\_\_\textbar{} │ │ │ │\\ +└───────────┼──→ └──────────┘ └────────────────────┘\\ +-∞ 0 +∞ -∞ 0 +∞ -∞ 0 +∞\\ +\strut \\ +特点:简单,计算快 特点:平滑,输出(0,1) 特点:零中心,输出(-1,1)\\ +正区间梯度恒为1 两端梯度趋近于0 两端梯度趋近于0\\ +负区间输出为0 可能导致梯度消失 可能导致梯度消失 -特点:简单,计算快 特点:平滑,输出(0,1) 特点:零中心,输出(-1,1) -正区间梯度恒为1 两端梯度趋近于0 两端梯度趋近于0 -负区间输出为0 可能导致梯度消失 可能导致梯度消失 -\end{lstlisting} - -\begin{quote} \textbf{设计类比}:激活函数就像是设计中的“非线性思维”。如果只有线性思维(没有激活函数),无论思考多少层,结论都是线性的——就像在一条直线上来回走。激活函数引入了“跳跃”和“拐弯”的能力,让网络能够表达复杂的设计关系。 -\end{quote} \subsection{损失函数} -损失函数(Loss Function)衡量模型预测值与真实值之间的差距,是训练过程的“指南针”。 +损失函数(Loss +Function)衡量模型预测值与真实值之间的差距,是训练过程的“指南针”。 \textbf{常用损失函数} {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.2727}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.2727}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1818}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.2727}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.0815}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.1407}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.5481}} + >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.2148}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 任务类型 @@ -675,133 +764,187 @@ ReLU: Sigmoid: Tanh: \endhead \bottomrule\noalign{} \endlastfoot -回归 & 均方误差 (MSE) & \(L = \frac{1}{n}\sum_{i=1}^{n}(\hat{y}_i - y_i)^2\) & 预测值与真实值差的平方平均 \\ -二分类 & 二元交叉熵 (BCE) & \(L = -[y\log\hat{y} + (1-y)\log(1-\hat{y})]\) & 预测概率与真实标签的偏差 \\ -多分类 & 交叉熵 (CE) & \(L = -\sum_{i=1}^{C}y_i\log\hat{y}_i\) & 预测分布与真实分布的差距 \\ +回归 & 均方误差 (MSE) & +\(L = \frac{1}{n}\sum_{i = 1}^{n}({\widehat{y}}_{i} - y_{i})^{2}\) & +预测值与真实值差的平方平均 \\ +二分类 & 二元交叉熵 (BCE) & +\(L = - \lbrack y\log\widehat{y} + (1 - y)log(1 - \widehat{y})\rbrack\) +& 预测概率与真实标签的偏差 \\ +多分类 & 交叉熵 (CE) & +\(L = - \sum_{i = 1}^{C}y_{i}\log{\widehat{y}}_{i}\) & +预测分布与真实分布的差距 \\ \end{longtable} } -其中 \(\hat{y}\) 是模型预测值,\(y\) 是真实值。 +其中 \(\widehat{y}\) 是模型预测值,\(y\) 是真实值。 \textbf{损失函数的直观理解} -\begin{lstlisting} -好的预测: 差的预测: -预测值: ■ 预测值: ■ -真实值: ■ 真实值: ■ -损失小: | 损失大: |——---| -→ 参数调整小 → 参数需要大幅调整 -\end{lstlisting} +好的预测: 差的预测:\\ +预测值: ■ 预测值: ■\\ +真实值: ■ 真实值: ■\\ +损失小: \textbar{} 损失大: \textbar-\/-\/-\/-\/-\/-\/-\/-\/-\textbar{}\\ +→ 参数调整小 → 参数需要大幅调整 \subsection{反向传播与梯度下降} 反向传播(Backpropagation)是训练神经网络的核心算法,它解决了“如何高效计算每个参数对损失的影响程度”这一问题。 -\textbf{核心思想:梯度下降} +\subsubsection{核心思想:梯度下降} 训练目标是最小化损失函数。梯度下降的思想是:沿着损失函数梯度(下降最快的方向)的相反方向更新参数。 -\[\theta = \theta - \alpha \nabla L(\theta)\] +\[\theta = \theta - \alpha\nabla L(\theta)\] -其中: - \(\theta\):模型的所有可学习参数(权重 \(W\) 和偏置 \(b\)) - \(\alpha\):学习率(Learning Rate),控制每次更新的步长 - \(\nabla L(\theta)\):损失函数对参数的梯度 +其中: - \(\theta\):模型的所有可学习参数(权重 \(W\) 和偏置 \(b\)) - +\(\alpha\):学习率(Learning Rate),控制每次更新的步长 - +\(\nabla L(\theta)\):损失函数对参数的梯度 -\textbf{直观理解} +\subsubsection{直观理解} -想象你站在山上某处(当前参数值),目标是到达谷底(最小损失)。梯度下降就是: - 观察脚下地面的坡度(计算梯度) - 沿着最陡的下坡方向走一步(参数更新) - 重复以上步骤直到到达谷底(收敛) +想象你站在山上某处(当前参数值),目标是到达谷底(最小损失)。梯度下降就是: +- 观察脚下地面的坡度(计算梯度) - 沿着最陡的下坡方向走一步(参数更新) +- 重复以上步骤直到到达谷底(收敛) -\begin{lstlisting} -损失 L - │ ╲ - │ ╲ ╱╲ - │ ╲╱ ╲ ← 梯度下降的路径 - │ ╲ ╲ ╱ - │ ╲ ╲╱ - │ ╲ - └───────────────→ 参数 θ -\end{lstlisting} +损失 L\\ +│ ╲\\ +│ ╲ ╱╲\\ +│ ╲╱ ╲ ← 梯度下降的路径\\ +│ ╲ ╲ ╱\\ +│ ╲ ╲╱\\ +│ ╲\\ +└───────────────→ 参数 θ -\textbf{反向传播:高效计算梯度} +\subsubsection{反向传播:高效计算梯度} -反向传播利用\textbf{链式法则(Chain Rule)},从输出层向输入层反向逐层计算梯度: +反向传播利用\textbf{链式法则(Chain +Rule)},从输出层向输入层反向逐层计算梯度: -\begin{lstlisting} 前向传播(计算输出): - x → h₁ → h₂ → ... → y → L(损失) + +\begin{enumerate} +\def\labelenumi{\alph{enumi}.} +\setcounter{enumi}{23} +\tightlist +\item + → h₁ → h₂ → ... → y → L(损失) +\end{enumerate} 反向传播(计算梯度): + +\begin{lstlisting} ∂L/∂y → ∂L/∂h₂ → ∂L/∂h₁ → ∂L/∂x(每步用链式法则) \end{lstlisting} 链式法则的具体形式: -\[\frac{\partial L}{\partial W_1} = \frac{\partial L}{\partial y} \cdot \frac{\partial y}{\partial h_2} \cdot \frac{\partial h_2}{\partial h_1} \cdot \frac{\partial h_1}{\partial W_1}\] +\[\frac{\partial L}{\partial W_{1}} = \frac{\partial L}{\partial y} \cdot \frac{\partial y}{\partial h_{2}} \cdot \frac{\partial h_{2}}{\partial h_{1}} \cdot \frac{\partial h_{1}}{\partial W_{1}}\] -\textbf{训练循环的四个步骤} +\subsubsection{训练循环的四个步骤} + +\begin{enumerate} +\def\labelenumi{\arabic{enumi}.} +\item + 前向传播:用当前参数计算预测值 y = f(x; θ) +\item + 计算损失:比较预测值与真实值 L = loss(y, ŷ) +\item + 反向传播:计算损失对所有参数的梯度 ∂L/∂θ +\item + 参数更新:沿梯度反方向更新参数 θ = θ - α·∂L/∂θ +\end{enumerate} \begin{lstlisting} -1. 前向传播:用当前参数计算预测值 y = f(x; θ) -2. 计算损失:比较预测值与真实值 L = loss(y, ŷ) -3. 反向传播:计算损失对所有参数的梯度 ∂L/∂θ -4. 参数更新:沿梯度反方向更新参数 θ = θ - α·∂L/∂θ - 重复以上步骤,直到损失不再显著下降(收敛) \end{lstlisting} -\textbf{Python代码示例:完整的训练循环} +\subsubsection{Python代码示例:完整的训练循环} -\begin{lstlisting}[language=Python] -import numpy as np +\textbf{import} numpy \textbf{as} np + +\emph{\# ===== 1. 准备数据 =====} + +\emph{\# 模拟数据:用y = 2x₁ + 3x₂ + 1生成} -# ===== 1. 准备数据 ===== -# 模拟数据:用y = 2x₁ + 3x₂ + 1生成 np.random.seed(42) -X = np.random.randn(100, 2) # 100个样本,2个特征 -y_true = 2 * X[:, 0:1] + 3 * X[:, 1:2] + 1 # 真实值 -y_true += np.random.normal(0, 0.1, y_true.shape) # 加入噪声 -# ===== 2. 初始化参数 ===== -W = np.random.randn(2, 1) * 0.01 # 权重 (2, 1) +\begin{enumerate} +\def\labelenumi{\roman{enumi}.} +\setcounter{enumi}{10} +\item + X = np.random.randn(100, 2) \emph{\# 100个样本,2个特征} +\item + \_true = 2 * X{[}:, 0:1{]} + 3 * X{[}:, 1:2{]} + 1 \emph{\# 真实值} +\end{enumerate} + +y\_true += np.random.normal(0, 0.1, y\_true.shape) \emph{\# 加入噪声} + +\emph{\# ===== 2. 初始化参数 =====} + +W = np.random.randn(2, 1) * 0.01 \emph{\# 权重 (2, 1)} + +\begin{lstlisting} b = np.zeros((1, 1)) # 偏置 (1, 1) learning_rate = 0.01 # 学习率 +\end{lstlisting} -# ===== 3. 训练循环 ===== -for epoch in range(500): - # 前向传播 - y_pred = np.dot(X, W) + b # 线性变换: z = Wx + b +\emph{\# ===== 3. 训练循环 =====} - # 计算损失(均方误差) - loss = np.mean((y_pred - y_true) ** 2) +\textbf{for} epoch \textbf{in} range(500): - # 反向传播(计算梯度) - dL_dy = 2 * (y_pred - y_true) / len(X) # 损失对输出的梯度 - dL_dW = np.dot(X.T, dL_dy) # 损失对W的梯度 - dL_db = np.sum(dL_dy, axis=0, keepdims=True) # 损失对b的梯度 +\emph{\# 前向传播} - # 参数更新(梯度下降) - W = W - learning_rate * dL_dW - b = b - learning_rate * dL_db +y\_pred = np.dot(X, W) + b \emph{\# 线性变换: z = Wx + b} - # 每100轮打印一次 - if (epoch + 1) % 100 == 0: - print(f"第 {epoch+1:3d} 轮 | 损失: {loss:.6f} " - f"| W: [{W[0,0]:.4f}, {W[1,0]:.4f}] | b: {b[0,0]:.4f}") +\emph{\# 计算损失(均方误差)} -print(f"\n学到的参数: W = {W.flatten()}, b = {b.flatten()}") +loss = np.mean((y\_pred - y\_true) ** 2) + +\emph{\# 反向传播(计算梯度)} + +dL\_dy = 2 * (y\_pred - y\_true) / len(X) \emph{\# 损失对输出的梯度} + +dL\_dW = np.dot(X.T, dL\_dy) \emph{\# 损失对W的梯度} + +dL\_db = np.sum(dL\_dy, axis=0, keepdims=True) \emph{\# 损失对b的梯度} + +\emph{\# 参数更新(梯度下降)} + +W = W - learning\_rate * dL\_dW + +b = b - learning\_rate * dL\_db + +\emph{\# 每100轮打印一次} + +\textbf{if} (epoch + 1) \% 100 == 0: + +print(f"第 \{epoch+1:3d\} 轮 \textbar{} 损失: \{loss:.6f\} " + +f"\textbar{} W: {[}\{W{[}0,0{]}:.4f\}, \{W{[}1,0{]}:.4f\}{]} \textbar{} +b: \{b{[}0,0{]}:.4f\}") + +print(f"\textbackslash n学到的参数: W = \{W.flatten()\}, b = +\{b.flatten()\}") + +\begin{lstlisting} print(f"真实参数: W = [2.0, 3.0], b = [1.0]") \end{lstlisting} 输出示例: -\begin{lstlisting} -第 100 轮 | 损失: 0.352148 | W: [1.5234, 2.3456] | b: 0.8765 -第 200 轮 | 损失: 0.053421 | W: [1.8765, 2.8234] | b: 0.9654 -第 300 轮 | 损失: 0.008756 | W: [1.9654, 2.9567] | b: 0.9932 -第 400 轮 | 损失: 0.001543 | W: [1.9923, 2.9891] | b: 0.9987 -第 500 轮 | 损失: 0.000287 | W: [1.9985, 2.9978] | b: 0.9997 - -学到的参数: W = [1.9985, 2.9978], b = [0.9997] -真实参数: W = [2.0, 3.0], b = [1.0] -\end{lstlisting} +第 100 轮 \textbar{} 损失: 0.352148 \textbar{} W: {[}1.5234, 2.3456{]} +\textbar{} b: 0.8765\\ +第 200 轮 \textbar{} 损失: 0.053421 \textbar{} W: {[}1.8765, 2.8234{]} +\textbar{} b: 0.9654\\ +第 300 轮 \textbar{} 损失: 0.008756 \textbar{} W: {[}1.9654, 2.9567{]} +\textbar{} b: 0.9932\\ +第 400 轮 \textbar{} 损失: 0.001543 \textbar{} W: {[}1.9923, 2.9891{]} +\textbar{} b: 0.9987\\ +第 500 轮 \textbar{} 损失: 0.000287 \textbar{} W: {[}1.9985, 2.9978{]} +\textbar{} b: 0.9997\\ +\strut \\ +学到的参数: W = {[}1.9985, 2.9978{]}, b = {[}0.9997{]}\\ +真实参数: W = {[}2.0, 3.0{]}, b = {[}1.0{]} 可以看到,经过500轮训练,模型学到的参数已经非常接近真实值。 @@ -811,7 +954,6 @@ print(f"真实参数: W = [2.0, 3.0], b = [1.0]") \begin{enumerate} \def\labelenumi{\arabic{enumi}.} -\tightlist \item \textbf{参数量爆炸}:处理高维输入(如高清图像)时,全连接导致参数量过大 \item @@ -824,190 +966,162 @@ print(f"真实参数: W = [2.0, 3.0], b = [1.0]") 正是这些局限性,催生了后续的CNN(处理图像)、RNN(处理序列)、Transformer(处理通用序列)等更专业的架构。但它们的底层原理都与MLP一脉相承。 +\section{环境-智能体框架} -\section{环境-智能体-任务:AI实践的三元框架} +\subsection{智能体与环境概念} -\subsection{学习目标} +在《人工智能——计算Agent基础》一书(普尔等,2015)中,人工智能被定义为“一个研究能够产生智能行为的计算Agent的分析与综合的领域”,可见Agent这一概念在AI领域中的核心地位。书中进一步将Agent定义为“在某个环境中进行某种行为的个体——它完成了某件事”。由此,``人工智能的核心科学目标是理解自然系统或人工系统中一些智能行为的原理“,而”人工智能的核心工程目标是设计和合成有用且智能的产品''。 -\begin{itemize} -\tightlist -\item - 理解“环境-智能体-任务”三元框架 -\item - 认识环境配置是AI实践中的关键瓶颈 -\item - 掌握降低环境门槛的实用策略 -\item - 了解推荐的学习资源与平台 -\end{itemize} +因此,AI领域的基本要素便是在不同类型环境(Environment)中行动的各类智能体(Agent),执行从科学发现到实践应用等不同场景中的多种任务(Task)。总体上,环境可分为物理环境与虚拟或数字环境两大类,智能体可分为人类(含具有不同程度智能的动物)、AI与具身智能三大类(表2.1)。 -\subsection{三元框架的提出} - -学习AI技术可以抽象为一个三元交互模型:\textbf{环境(Environment)--- 智能体(Agent)--- 任务(Task)}。 - -\begin{lstlisting} -┌──────────────────────────────────────────────────┐ -│ │ -│ ┌──────────┐ 执行任务 ┌──────────┐ │ -│ │ 智能体 │ ──────────────→ │ 任务 │ │ -│ │ (Agent) │ ←────────────── │ (Task) │ │ -│ │ │ 返回结果 │ │ │ -│ └────┬─────┘ └──────────┘ │ -│ │ 感知 │ │ -│ ▼ │ │ -│ ┌──────────┐ │ │ -│ │ 环境 │ ◄───────────────────┘ │ -│ │(Environ.)│ 环境反馈 │ -│ └──────────┘ │ -│ │ -└──────────────────────────────────────────────────┘ -\end{lstlisting} - -三个要素的含义: - -{\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1935}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1935}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.6129}}@{}} + >{\centering\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1442}} + >{\centering\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.4327}} + >{\centering\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.4135}}@{}} +\caption{表 2.1 环境-智能体的类型组合}\tabularnewline \toprule\noalign{} -\begin{minipage}[b]{\linewidth}\raggedright -要素 -\end{minipage} & \begin{minipage}[b]{\linewidth}\raggedright -含义 -\end{minipage} & \begin{minipage}[b]{\linewidth}\raggedright -AI学习中的具体体现 -\end{minipage} \\ -\midrule\noalign{} +\endfirsthead \endhead \bottomrule\noalign{} \endlastfoot -\textbf{环境} & 智能体所处的操作空间 & Python环境、GPU资源、数据集、网络连接 \\ -\textbf{智能体} & 执行任务的学习者 & 设计专业学生、设计师、研究人员 \\ -\textbf{任务} & 需要完成的目标 & 运行一个CNN分类器、训练一个生成模型、部署一个Agent \\ +\textbf{环境} + +\textbf{智能体} & \textbf{物理环境} & \textbf{数字环境} \\ +\textbf{人类} & ~ 具有物理身体,能直接感知和互动 & ~ +通过设备(如电脑、手机)访问,依赖界面 \\ +\textbf{AI} & ~ 通过机器人或嵌入式系统体现,但本质是软件 & ~ +主要存在和运行,如算法、聊天机器人 \\ +\textbf{具身智能} & ~ 设计用于物理世界,有传感器和执行器 & ~ +可能具有数字组件,但焦点是物理体现 \\ \end{longtable} -} -这个框架不仅适用于强化学习中的智能体(见第6章),也适用于\textbf{人类学习AI的过程}:学习者(智能体)需要在一个合适的环境(计算环境)中完成学习任务。 +其中,人类与物理环境的互动长久以来是地理学科的研究主题,即“人地关系”或“人地耦合系统”研究,涉及环境感知、景观设计、可持续性等多个议题。当前的“智能体---环境”关系研究可视为“人地关系”研究的自然延伸,可从中汲取丰富启发,有待后续深入探讨。人类与数字环境的互动则关联网络社会、人机交互等主题,在AI蓬勃发展的时代背景下催生了更多、更深刻的研究命题。AI与具身智能分别对应数字环境和物理环境,构成了人工智能的两种主要存在方式。 -\subsection{环境配置:被忽视的瓶颈} +需要指出的是,某些非生物的自然过程(如景观中的风雨侵蚀)以及人类社会经济变迁等现象,同样可以采用Agent方法加以研究,即所谓的ABM建模。不过,此处的Agent并非智能体概念,而是指基于个体的建模方法。然而,大模型技术在ABM领域的引入正在模糊这一边界。 -对于计算机专业的学生,搭建Python环境、安装PyTorch、下载预训练模型可能只是日常操作。但对于\textbf{设计专业学生}而言,环境配置往往成为学习AI的最大障碍: +\subsection{行为主义视角下的“环境-智能体”} + +在人工智能的行为主义流派视角下,人工智能问题可抽象为一个三元交互模型:\textbf{环境(Environment)--- +智能体(Agent)--- +任务(Task)}。特定架构的智能体对所处环境执行某个动作(Action),基于对环境的感知与结果的观察(Observation),获得该动作所产生的奖励(Reward),继而不断重复这一过程以优化决策策略,直到较好地完成某个或多个任务(Task)(图2.1)。该框架不仅适用于强化学习中的智能体(见第8章),也适用于\textbf{人类学习的普遍过程}。 + +\begin{figure} +\centering +\includegraphics[width=4.15529in,height=3.58481in,alt={图 2.1 智能体-环境互动框架}]{figures/ch02/image1.png} +\caption{图 2.1 智能体-环境互动框架} +\end{figure} + +\subsection{"环境-智能体"框架与设计任务} + +学习AI技术可以抽象为一个三元交互模型:\textbf{环境(Environment)--- +智能体(Agent)--- 任务(Task)}。 + +\subsection{智能系统的设计空间:复杂性维度} + +Agent在环境中的行为充满复杂性,这些复杂性可以分解为不同的维度从而便于理解和分析;这些维度也构成了人工智能系统的设计空间,通过改变不同维度的值可以得到空间里的不同的点,从而有效构建满足特定任务求解的智能系统(普尔等,2015)。 + +从复杂性维度出发,讨论如下9个维度的复杂性及其在设计领域的体现,即模块性、表示方案、规划期、感知不确定性、效用不确定性、偏好、Agent数量、学习以及计算限制(表 +2.2)。 + +\begin{longtable}[]{@{} + >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.2083}} + >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.5694}}@{}} +\caption{表 2.2 智能系统设计空间的复杂性维度}\tabularnewline +\toprule\noalign{} +\endfirsthead +\endhead +\bottomrule\noalign{} +\endlastfoot +\textbf{维度} & \textbf{值} \\ +模块性 & 扁平的、模块化的、分层的 \\ +表示方案 & 状态、特征、关系 \\ +规划期 & 无规划、有限阶段、不确定阶段、无限阶段 \\ +感知不确定性 & 完全可观察、部分可观察 \\ +效用不确定性 & 确定性的、随机的 \\ +偏好 & 目标、复杂偏好 \\ +学习 & 已知的知识、学到的知识 \\ +Agent 数量 & 单个 Agent、多 Agent \\ +计算限制 & 完全理性、有限理性 \\ +\end{longtable} + +来源:引自参考文献(普尔等,2015) + +\section{思考与练习} + +\begin{enumerate} +\def\labelenumi{\arabic{enumi}.} +\item + \textbf{函数思维练习}:请列举3个设计领域中的例子,说明它们可以用函数 + \(y = f(x;\theta)\) 来描述。思考输入 \(x\)、输出 \(y\) + 和需要学习的参数 \(\theta\) 分别是什么。 +\item + \textbf{模态映射练习}:选择一个你熟悉的设计项目(如建筑设计、产品设计或平面设计),分析该项目涉及哪些数据模态(一维/二维/三维/决策/生成/行动),以及每种模态在该项目中的作用。 +\item + \textbf{演进规律思考}:回顾2.3节中介绍的四个发展阶段。在你关注的设计领域,AI技术目前处于哪个阶段?未来会如何演进?请给出你的分析和理由。 +\item + \textbf{环境-智能体-任务练习}:规划你的AI学习路径。评估你当前的计算环境(笔记本配置、网络条件),选择最适合你的入门策略(云端/本地/Vibe + Coding),并设定一个本周可完成的小任务(如在Colab上运行一个图像分类示例)。 +\end{enumerate} + +\textbf{(1)环境配置:被忽视的瓶颈} + +对于计算机专业的学生,搭建Python环境、安装PyTorch、下载预训练模型可能只是日常操作。但对于\textbf{设计专业学生}而言,环境配置往往成为学习AI的最大障碍,可能在多个步骤均遭遇问题。 -\begin{lstlisting} 设计学生尝试运行一个图像分类示例: - 1. 安装Python → 版本冲突(3.8? 3.9? 3.11?) - 2. 安装pip包 → 权限报错 / 网络超时 - 3. pip install torch → 下载2GB,断线重连3次 - 4. 下载预训练权重 → 需要HuggingFace账号 / 网络限制 - 5. CUDA版本不匹配 → "torch.cuda.is_available() = False" - 6. import cv2报错 → 缺少系统依赖 - 7. 终于跑通 → 已经精疲力竭,失去了学习兴趣 -\end{lstlisting} +\begin{enumerate} +\def\labelenumi{\arabic{enumi}.} +\item + 安装Python → 版本冲突(3.8? 3.9? 3.11?) +\item + 安装pip包 → 权限报错 / 网络超时 +\item + pip install torch → 下载2GB,断线重连3次 +\item + 下载预训练权重 → 需要HuggingFace账号 / 网络限制 +\item + CUDA版本不匹配 → "torch.cuda.is\_available() = False" +\item + import cv2报错 → 缺少系统依赖 +\item + 终于跑通 → 耗费大量时间,已经精疲力竭 +\end{enumerate} -\textbf{典型痛点清单}: +环境问题不是“技术能力不足”,而是\textbf{基础设施鸿沟}。正如设计师不需要理解CAD软件的底层渲染引擎才能画图,学习AI也不应该被环境配置阻挡在门外。 -{\def\LTcaptype{none} % do not increment counter -\begin{longtable}[]{@{}lll@{}} -\toprule\noalign{} -痛点 & 具体表现 & 严重程度 \\ -\midrule\noalign{} -\endhead -\bottomrule\noalign{} -\endlastfoot -Python版本管理 & 多版本共存导致路径混乱 & ★★★★ \\ -包依赖冲突 & numpy版本不兼容PyTorch & ★★★★ \\ -GPU/CUDA配置 & 驱动版本与CUDA版本不匹配 & ★★★★★ \\ -数据下载 & 大型数据集下载慢、需要代理 & ★★★★ \\ -网络环境 & HuggingFace/Google Colab访问受限 & ★★★★ \\ -系统差异 & Windows/Mac/Linux命令不同 & ★★★ \\ -内存不足 & 本地机器无法运行大模型 & ★★★★ \\ -\end{longtable} -} +\textbf{(2)解决策略} -\begin{quote} -\textbf{核心观点}:环境问题不是“技术能力不足”的问题,而是\textbf{基础设施鸿沟}。正如设计师不需要理解CAD软件的底层渲染引擎才能画图,学习AI也不应该被环境配置阻挡在门外。 -\end{quote} - -\subsection{降低门槛的实践策略} - -针对以上痛点,推荐以下策略: - -\textbf{策略一:使用云端开发环境} - -{\def\LTcaptype{none} % do not increment counter -\begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.2222}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.2222}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.3333}} - >{\raggedright\arraybackslash}p{(\linewidth - 6\tabcolsep) * \real{0.2222}}@{}} -\toprule\noalign{} -\begin{minipage}[b]{\linewidth}\raggedright -平台 -\end{minipage} & \begin{minipage}[b]{\linewidth}\raggedright -特点 -\end{minipage} & \begin{minipage}[b]{\linewidth}\raggedright -适用场景 -\end{minipage} & \begin{minipage}[b]{\linewidth}\raggedright -费用 -\end{minipage} \\ -\midrule\noalign{} -\endhead -\bottomrule\noalign{} -\endlastfoot -Google Colab & 免费GPU、即开即用 & 快速实验、课程练习 & 免费/Pro版\$10/月 \\ -Kaggle Notebooks & 免费GPU、数据集内置 & 竞赛学习、数据分析 & 免费 \\ -阿里云天池 & 国内访问快、中文社区 & 国内课程、中文教程 & 免费额度 \\ -AutoDL / 矩池云 & 国内GPU租用 & 训练大模型、长时间训练 & 按量计费 \\ -\end{longtable} -} - -\textbf{策略二:使用Vibe Coding工具链} - -本书附录2详细介绍了Vibe Coding(感觉驱动编程)的理念和工具链。核心思想是:\textbf{让AI辅助编程,降低代码编写的门槛}。 +本书附录2详细介绍了Vibe +Coding(感觉驱动编程)的理念和工具链。核心思想是:\textbf{让AI辅助编程,降低代码编写的门槛}。 \begin{itemize} -\tightlist \item \textbf{Claude Code}:用自然语言描述需求,AI自动生成代码 \item \textbf{Cursor / GitHub Copilot}:IDE内AI辅助编程 -\item - \textbf{Jupyter Notebook}:交互式编程,所见即所得 \end{itemize} -\textbf{策略三:使用容器化环境} +此外,云端与容器化环境可以免配置直接上手。云端方面:Google +Colab提供免费GPU/TPU算力,适合快速实验与教学演示;Kaggle +Notebooks集成竞赛数据集与社区代码,便于参考与复现;阿里云天池面向国内用户,提供稳定算力与本地化资源。容器化方面:Docker将运行环境打包为镜像,一次构建、到处运行,彻底告别“It +works on my machine”的环境差异问题。 -\begin{lstlisting}[language=bash] -# 一行命令启动预配置的AI开发环境(需安装Docker) -docker run -it -p 8888:8888 pytorch/pytorch:latest +\section{延伸阅读} -# 或使用 conda 快速创建隔离环境 -conda create -n ai-design python=3.10 -conda activate ai-design -conda install pytorch torchvision -c pytorch -\end{lstlisting} - -容器化确保环境一致性——一次配置,到处运行。 - -\textbf{策略四:渐进式学习路径} - -\begin{lstlisting} -零门槛入门 进阶实践 深度开发 -───────────────────────────────────────────────────── -Google Colab → 本地Python环境 → GPU服务器 -自然语言编程 → Vibe Coding → 原生代码编写 -在线Notebook → Jupyter本地 → IDE (VSCode) -调用API → 加载预训练模型 → 微调训练 -小数据集实验 → 设计数据集构建 → 大规模训练 -\end{lstlisting} - -\begin{quote} -\textbf{建议}:初学阶段不必强求本地环境配置完整。先在云端环境跑通案例、建立直觉,再逐步搭建本地环境。 -\end{quote} - -\subsection{推荐学习资源} +\begin{itemize} +\item + \href{http://neuralnetworksanddeeplearning.com/}{Neural Networks and + Deep Learning} --- Michael Nielsen 的在线教材,直观讲解神经网络原理 +\item + \href{https://arxiv.org/abs/2001.08361}{Scaling Laws for Neural + Language Models} --- Kaplan et al., 2020,Scaling Law 的经典论文 +\item + \href{https://arxiv.org/abs/2108.07258}{On the Opportunities and Risks + of Foundation Models} --- Stanford HAI 报告,全面介绍基础模型 +\item + \href{https://www.youtube.com/watch?v=aircAruvnKk}{3Blue1Brown: But + what is a Neural Network?} --- 优秀的神经网络可视化讲解视频 +\end{itemize} 以下资源可以作为本章和后续章节的补充学习材料: @@ -1015,9 +1129,9 @@ Google Colab → 本地Python环境 → GPU服务器 {\def\LTcaptype{none} % do not increment counter \begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3333}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3333}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3333}}@{}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.1371}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.4162}} + >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.4365}}@{}} \toprule\noalign{} \begin{minipage}[b]{\linewidth}\raggedright 资源 @@ -1030,21 +1144,35 @@ Google Colab → 本地Python环境 → GPU服务器 \endhead \bottomrule\noalign{} \endlastfoot -Datawhale Bishop DL & 基于Bishop《深度学习》的中文笔记,覆盖概率论、回归、分类、DNN、CNN、Transformer & \href{https://datawhalechina.github.io/dive-into-bishop-dl/}{dive-into-bishop-dl} \\ -Ai-learn & 完整的AI学习路线图,从数学基础到深度学习实战 & \href{https://github.com/tangyudi/Ai-learn}{Ai-learn} \\ -3Blue1Brown 神经网络 & 顶级可视化讲解,建立直觉理解 & \href{https://www.youtube.com/playlist?list=PLZHQObOWTQDNU6R1_67000Dx_ZCJB-3pi}{YouTube} \\ -李宏毅机器学习 & 中文讲解,理论与应用并重 & \href{https://www.youtube.com/c/HungyiLeeNTU}{YouTube} \\ -fast.ai & 顶向下教学,先实践后理论 & \href{https://course.fast.ai/}{course.fast.ai} \\ -d2l.ai(动手学深度学习) & 代码驱动,PyTorch/MXNet/TensorFlow多框架 & \href{https://d2l.ai/}{d2l.ai} \\ +Datawhale Bishop DL & +基于Bishop《深度学习》的中文笔记,覆盖概率论、回归、分类、DNN、CNN、Transformer +& +\href{https://datawhalechina.github.io/dive-into-bishop-dl/}{dive-into-bishop-dl} \\ +Ai-learn & 完整的AI学习路线图,从数学基础到深度学习实战 & +\href{https://github.com/tangyudi/Ai-learn}{Ai-learn} \\ +3Blue1Brown 神经网络 & 顶级可视化讲解,建立直觉理解 & +\href{https://www.youtube.com/playlist?list=PLZHQObOWTQDNU6R1_67000Dx_ZCJB-3pi}{YouTube} \\ +李宏毅机器学习 & 中文讲解,理论与应用并重 & +\href{https://www.youtube.com/c/HungyiLeeNTU}{YouTube} \\ +fast.ai & 顶向下教学,先实践后理论 & +\href{https://course.fast.ai/}{course.fast.ai} \\ +d2l.ai(动手学深度学习) & 代码驱动,PyTorch/MXNet/TensorFlow多框架 & +\href{https://d2l.ai/}{d2l.ai} \\ \end{longtable} } \textbf{设计领域AI资源} {\def\LTcaptype{none} % do not increment counter -\begin{longtable}[]{@{}ll@{}} +\begin{longtable}[]{@{} + >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.2639}} + >{\raggedright\arraybackslash}p{(\linewidth - 2\tabcolsep) * \real{0.5139}}@{}} \toprule\noalign{} -资源 & 说明 \\ +\begin{minipage}[b]{\linewidth}\raggedright +资源 +\end{minipage} & \begin{minipage}[b]{\linewidth}\raggedright +说明 +\end{minipage} \\ \midrule\noalign{} \endhead \bottomrule\noalign{} @@ -1055,81 +1183,5 @@ Papers With Code & 论文+代码+排行榜,追踪最新技术 \\ \end{longtable} } -\begin{quote} -\textbf{学习方法建议}:不要试图一次性学完所有资源。根据当前章节的学习进度,选择1-2个配套资源即可。例如,学习第3章(Transformer)时,可以对照 Datawhale Bishop DL 中对应的章节加深理解。 -\end{quote} - - -\section{思考与练习} - -\begin{enumerate} -\def\labelenumi{\arabic{enumi}.} -\item - \textbf{函数思维练习}:请列举3个设计领域中的例子,说明它们可以用函数 \(y = f(x; \theta)\) 来描述。思考输入 \(x\)、输出 \(y\) 和需要学习的参数 \(\theta\) 分别是什么。 -\item - \textbf{模态映射练习}:选择一个你熟悉的设计项目(如建筑设计、产品设计或平面设计),分析该项目涉及哪些数据模态(一维/二维/三维/决策/生成/行动),以及每种模态在该项目中的作用。 -\item - \textbf{演进规律思考}:回顾2.3节中介绍的四个发展阶段。在你关注的设计领域,AI技术目前处于哪个阶段?未来会如何演进?请给出你的分析和理由。 -\item - \textbf{环境-智能体-任务练习}:规划你的AI学习路径。评估你当前的计算环境(笔记本配置、网络条件),选择最适合你的入门策略(云端/本地/Vibe Coding),并设定一个本周可完成的小任务(如在Colab上运行一个图像分类示例)。 -\end{enumerate} - - -\section{关键术语} - -{\def\LTcaptype{none} % do not increment counter -\begin{longtable}[]{@{} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3333}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3333}} - >{\raggedright\arraybackslash}p{(\linewidth - 4\tabcolsep) * \real{0.3333}}@{}} -\toprule\noalign{} -\begin{minipage}[b]{\linewidth}\raggedright -中文 -\end{minipage} & \begin{minipage}[b]{\linewidth}\raggedright -英文 -\end{minipage} & \begin{minipage}[b]{\linewidth}\raggedright -说明 -\end{minipage} \\ -\midrule\noalign{} -\endhead -\bottomrule\noalign{} -\endlastfoot -数据模态 & Data Modality & 信息的存在形式,如文本、图像、三维等 \\ -线性回归 & Linear Regression & \(y = ax + b\) 形式的函数拟合 \\ -多元回归 & Multiple Regression & 多输入变量的线性模型 \(y = \sum a_ix_i + b\) \\ -多层感知机 & Multi-Layer Perceptron (MLP) & 最基础的前馈神经网络结构 \\ -前向传播 & Forward Propagation & 数据从输入层到输出层的计算过程 \\ -激活函数 & Activation Function & 引入非线性的函数,如ReLU、Sigmoid \\ -损失函数 & Loss Function & 衡量预测值与真实值差距的函数 \\ -反向传播 & Backpropagation & 利用链式法则计算梯度的算法 \\ -梯度下降 & Gradient Descent & 沿梯度反方向更新参数的优化方法 \\ -学习率 & Learning Rate & 梯度下降中控制参数更新步长的超参数 \\ -权重 & Weight & 神经元之间连接的可学习参数 \\ -偏置 & Bias & 调整输出基准的可学习参数 \\ -特征工程 & Feature Engineering & 人工设计和提取数据特征的过程 \\ -迁移学习 & Transfer Learning & 将一个任务学到的知识迁移到新任务 \\ -基础模型 & Foundation Model & 在大规模数据上预训练的大型通用模型 \\ -涌现能力 & Emergent Abilities & 模型规模大到一定程度后出现的新能力 \\ -缩放定律 & Scaling Law & 模型性能与规模(数据量、参数量、计算量)之间的关系规律 \\ -环境-智能体-任务 & Environment-Agent-Task & AI实践的三元框架:环境提供操作空间,智能体执行任务,任务定义目标 \\ -Vibe Coding & Vibe Coding & 感觉驱动编程,用自然语言描述需求让AI生成代码的编程范式 \\ -全连接层 & Fully Connected Layer & 每个神经元与上一层所有神经元相连的网络层 \\ -预训练 & Pre-training & 在大规模数据上的初始训练阶段 \\ -微调 & Fine-tuning & 在特定任务数据上对预训练模型进行适配训练 \\ -\end{longtable} -} - - -\section{延伸阅读} - -\begin{itemize} -\tightlist -\item - \href{http://neuralnetworksanddeeplearning.com/}{Neural Networks and Deep Learning} --- Michael Nielsen 的在线教材,直观讲解神经网络原理 -\item - \href{https://arxiv.org/abs/2001.08361}{Scaling Laws for Neural Language Models} --- Kaplan et al., 2020,Scaling Law 的经典论文 -\item - \href{https://arxiv.org/abs/2108.07258}{On the Opportunities and Risks of Foundation Models} --- Stanford HAI 报告,全面介绍基础模型 -\item - \href{https://www.youtube.com/watch?v=aircAruvnKk}{3Blue1Brown: But what is a Neural Network?} --- 优秀的神经网络可视化讲解视频 -\end{itemize} +\textbf{学习方法建议}:不要试图一次性学完所有资源。根据当前章节的学习进度,选择1-2个配套资源即可。例如,学习第3章(Transformer)时,可以对照 +Datawhale Bishop DL 中对应的章节加深理解。 diff --git a/chapters/ch13-conclusion.tex b/chapters/ch13-conclusion.tex new file mode 100644 index 0000000..d2f8be3 --- /dev/null +++ b/chapters/ch13-conclusion.tex @@ -0,0 +1,49 @@ +\chapter{结语与展望} + +\section{回顾:从原理到实践} + +回顾全书,我们从两个维度展开了设计人工智能的探索。 + +\textbf{上篇}聚焦技术原理。我们从AI的发展历程出发,理解了神经网络的函数式本质——通过函数组合逼近任意复杂的映射关系。在此基础上,沿着数据模态的主线,依次探讨了:一维序列数据与自然语言处理(RNN、Transformer、大语言模型),二维图像与计算机视觉(CNN、ViT),三维空间与空间智能(PointNet、3D重建)。进而,我们学习了生成式AI(VAE、GAN、扩散模型)如何从数据中学习分布并创造新内容,AI Agent如何将感知、推理与行动闭环整合,以及强化学习如何通过试错与反馈优化策略。 + +这些技术并非孤立的模块,而是构成了一个完整的智能系统架构:感知引擎理解世界,生成引擎创造可能,推理引擎做出决策,而强化学习提供了持续改进的机制。 + +\textbf{下篇}转向设计实践。我们看到AI已经在数字媒体、工业设计、环境景观、城市规划与生态设计等领域展现出强大的应用潜力。每个领域都有其独特的数据特征、评估标准和决策逻辑,AI的价值不在于替代设计师,而在于扩展设计师的能力边界——处理更大规模的数据、探索更广阔的方案空间、做出更精准的评估判断。 + +\section{核心洞见} + +贯穿全书,有几个核心观点值得再次强调: + +\textbf{理解原理比掌握工具更重要。}工具和平台层出不穷、快速迭代,但背后的原理——函数逼近、注意力机制、扩散过程、策略优化——具有持久的价值。掌握了原理,面对任何新工具都能快速上手;反之,仅停留在工具操作层面,则永远只能被动跟随。 + +\textbf{数据和问题定义是关键。}AI的效果高度依赖于数据质量和问题定义的清晰程度。在设计领域,这意味着需要认真思考:我们要解决什么问题?用什么数据来训练和评估?如何定义"好设计"?这些问题往往比模型选择更为重要。 + +\textbf{人机协作是正确的方向。}AI擅长处理大规模数据、快速生成方案、进行穷举搜索;人类擅长理解语境、做出价值判断、处理模糊和矛盾的需求。两者的结合,而非相互替代,才能产生最大的价值。 + +\section{展望:设计智能的未来} + +站在2026年的时间节点上,设计人工智能正在经历从"工具辅助"到"智能协同"的转变。以下几个方面值得关注: + +\textbf{多模态融合}。未来的设计AI将不再局限于单一模态,而是能够同时理解文本、图像、三维模型、空间数据等多种信息,形成对设计任务的全面理解。这将使得设计师能够以更自然的方式与AI交互——用草图、语言、手势等多种方式表达设计意图。 + +\textbf{自主设计探索}。随着AI Agent技术的成熟,AI将从被动执行指令的工具,进化为能够主动提出设计方案、自主评估优化、甚至发现人类未曾想到的解决方案的设计伙伴。设计师的角色将更多地转向目标定义、约束设定和质量把关。 + +\textbf{设计知识的系统化}。长期以来,设计知识高度依赖个人经验和隐性知识,难以系统化传承。AI有望通过学习海量的设计案例,将设计知识显性化、结构化,使设计经验能够被更广泛地共享和复用。 + +\textbf{伦理与可持续性}。AI在设计中的应用必须考虑伦理和社会影响——算法偏见、知识产权、就业影响、能源消耗等问题都需要认真对待。可持续设计不应仅停留在概念层面,而应融入AI辅助设计的每一个环节。 + +\textbf{设计教育的变革}。设计教育需要重新思考课程体系,在保持设计思维和美学素养培养的同时,融入计算思维和数据素养的训练。未来的设计师需要既懂设计,又理解AI,还能在两者之间架起桥梁。 + +\section{致读者} + +设计的人工智能时代才刚刚拉开序幕。这本书所涵盖的内容,与其说是对这一领域的完整总结,不如说是一份邀请——邀请你走进这个充满可能性的领域,用自己的专业视角去发现问题、定义问题、解决问题。 + +无论你是设计专业的学生、教师,还是从业设计师,希望你从这本书中获得的不只是一些技术知识,更是一种思维方式:用计算的视角理解设计,用设计的智慧引导技术。 + +技术在变,工具在变,但设计服务于人的本质不会变。愿你在AI时代,成为更好的设计师。 + +\begin{flushright} +彭晓 + +2026年4月25日 +\end{flushright} diff --git a/chapters/divider-lower.tex b/chapters/divider-lower.tex new file mode 100644 index 0000000..0f4911d --- /dev/null +++ b/chapters/divider-lower.tex @@ -0,0 +1,2 @@ +\chapter*{下篇:设计领域应用} +\addcontentsline{toc}{chapter}{下篇:设计领域应用} diff --git a/chapters/divider-upper.tex b/chapters/divider-upper.tex new file mode 100644 index 0000000..a787c71 --- /dev/null +++ b/chapters/divider-upper.tex @@ -0,0 +1,2 @@ +\chapter*{上篇:原理与技术} +\addcontentsline{toc}{chapter}{上篇:原理与技术} diff --git a/main.tex b/main.tex index 3263f76..1f4ca58 100644 --- a/main.tex +++ b/main.tex @@ -28,6 +28,7 @@ \mainmatter % 上篇:原理与技术 +\input{chapters/divider-upper} \input{chapters/ch01-intro} \input{chapters/ch02-framework} \input{chapters/ch03-1d-sequence} @@ -38,11 +39,15 @@ \input{chapters/ch08-rl} % 下篇:设计领域应用 +\input{chapters/divider-lower} \input{chapters/ch09-digital-media} \input{chapters/ch10-industrial} \input{chapters/ch11-environment} \input{chapters/ch12-urban} +% 结语 +\input{chapters/ch13-conclusion} + % ---------- 附录部分 ---------- \appendix \input{appendices/ap00-divider}