<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>分类 on 老张开工了</title>
    <link>/%E5%88%86%E7%B1%BB/</link>
    <description>Recent content in 分类 on 老张开工了</description>
    <generator>Hugo</generator>
    <language>zh-cn</language>
    <lastBuildDate>Wed, 15 Jan 2025 00:00:00 +0000</lastBuildDate>
    <atom:link href="/%E5%88%86%E7%B1%BB/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>分类算法</title>
      <link>/posts/2025/01/classification-algorithms/</link>
      <pubDate>Wed, 15 Jan 2025 00:00:00 +0000</pubDate>
      <guid>/posts/2025/01/classification-algorithms/</guid>
      <description>分类是机器学习中最常见的问题类型之一。不管是识别垃圾邮件、诊断疾病、检测欺诈交易还是人脸识别，背后都是分类算法在起作用。本文将深入介绍几种最核心的分类算法，从原理到实战带你全面掌握。&#xA;分类问题概述 分类问题的目标是根据输入特征预测一个离散的类别标签。根据类别数量分为：&#xA;二分类：只有两个类别，如垃圾邮件/非垃圾邮件 多分类：有三个或以上类别，如手写数字识别（0-9） 多标签分类：每个样本可以属于多个类别，如图片标签 本文我们将重点介绍二分类和多分类场景。&#xA;逻辑回归 逻辑回归虽然名字里有&amp;quot;回归&amp;quot;，但它实际上是一种分类算法。它通过 Sigmoid 函数将线性回归的输出映射到 0 到 1 之间的概率值。&#xA;Sigmoid 函数 Sigmoid 函数的数学形式：&#xA;$$\sigma(z) = \frac{1}{1 + e^{-z}}$$ 它把任意实数压缩到 (0, 1) 区间，非常适合表示概率。&#xA;import numpy as np import matplotlib.pyplot as plt def sigmoid(z): return 1 / (1 + np.exp(-z)) z = np.linspace(-10, 10, 100) s = sigmoid(z) plt.figure(figsize=(10, 6)) plt.plot(z, s, &amp;#39;b-&amp;#39;, linewidth=2) plt.axhline(y=0.5, color=&amp;#39;gray&amp;#39;, linestyle=&amp;#39;--&amp;#39;, alpha=0.5) plt.axvline(x=0, color=&amp;#39;gray&amp;#39;, linestyle=&amp;#39;--&amp;#39;, alpha=0.5) plt.xlabel(&amp;#39;z&amp;#39;) plt.ylabel(&amp;#39;σ(z)&amp;#39;) plt.title(&amp;#39;Sigmoid 函数&amp;#39;) plt.</description>
    </item>
  </channel>
</rss>
