Skip to Content
用于 DevOps 的 Python
book

用于 DevOps 的 Python

by Noah Gift, Kennedy Behrman, Alfredo Deza, Grig Gheorghiu
May 2025
Intermediate to advanced
506 pages
6h 56m
Chinese
O'Reilly Media, Inc.
Content preview from 用于 DevOps 的 Python

第 14 章 MLOps 和机器学习工程

本作品已使用人工智能进行翻译。欢迎您提供反馈和意见:translation-feedback@oreilly.com

机器学习工程师是 2020 年最热门的职称之一。其他热门职称包括数据工程师、数据科学家和机器学习科学家。 虽然你可以成为 DevOps 专家,但 DevOps 是一种行为,DevOps 的原则可以应用于任何软件项目,包括机器学习。让我们来看看 DevOps 的一些核心最佳实践:持续集成(Continuous Integration)、持续交付(Continuous Delivery)、微服务(Microservices)、基础设施即代码(Infrastructure as Code)、监控与日志记录(Monitoring and Logging)以及沟通与协作(Communication and Collaboration)。其中哪些不适用于机器学习?

软件工程项目越复杂,机器学习就越复杂,就越需要 DevOps 原则。 还有比进行机器学习预测的 API 更合适的微服务实例吗? 在本章中,让我们深入探讨如何利用 DevOps 思维以专业、可重复的方式进行机器学习。

什么是机器学习?

机器学习是一种使用算法自动学习数据的方法。 主要有四种类型:监督式、半监督式、无监督式和强化式。

监督机器学习

在有监督的机器学习中,正确答案是已知的,并且已经标记。 例如,如果您想根据体重预测身高,您可以收集人们身高和体重的示例。 身高是目标,体重是特征。

让我们来看看有监督机器学习的例子:

摄取

In[0]:

import pandas as pd

In[7]:

df = pd.read_csv(
  "https://raw.githubusercontent.com/noahgift/\
  regression-concepts/master/\
  height-weight-25k.csv")
df.head()

Out[7]:

索引 高度-英寸 重量-磅

0

1

65.78331

112.9925

1

2

71.51521

136.4873

2

3

69.39874

153.0269

3

4

68.21660

142.3354

4

5

67.78781

144.2971

EDA

让我们看看这些数据,看看可以探索出什么。

散点图

在本例中,使用了 Python 中流行的绘图库 seaborn 来实现数据集的可视化。 如果需要安装,可以通过!pip install seaborn 在笔记本中安装。 您也可以通过!pip install <name of package> 安装该部分中的任何其他库。如果您使用的是 Colab 笔记本,我们会为您安装这些库。请参见高度/重量 lm 图(图 14-1)。

In[0]:

import seaborn as sns
import numpy as np

In[9]:

sns.lmplot("Height-Inches", "Weight-Pounds", data=df)
pydo 1401
图 14-1. 高度/重量 lm 图

描述性统计

接下来,可以生成一些描述性统计数据。 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

《Python 数据分析》第三版

《Python 数据分析》第三版

Wes McKinney
ppk on JavaScript

ppk on JavaScript

Peter-Paul Koch

Publisher Resources

ISBN: 9798341657380