course-nlp——2-svd-nmf-topic-modeling

本文参考自https://github.com/fastai/course-nlp。

使用NMF and SVD进行主题建模

问题

主题建模是开始学习 NLP 的一种有趣方式。我们将使用两种流行的矩阵分解技术。考虑最极端的情况——使用两个向量的外积重建矩阵。显然,在大多数情况下,我们无法精确地重建矩阵。但是,如果我们有一个向量表示总单词数中每个词汇单词的相对频率,另一个向量表示每个文档的平均单词数,那么外积将尽可能接近。现在考虑将矩阵增加到两列和两行。现在的最佳分解是将文档聚类为两组,每组的单词分布尽可能不同,但聚类中的文档尽可能相似。我们将这两组称为“主题”。我们会根据每个主题中出现频率最高的单词将单词聚类为两组。

开始

我们将获取几个不同类别的文档数据集,并找到它们的主题(由词组组成)。了解实际类别有助于我们评估找到的主题是否有意义。
我们将使用两种不同的矩阵分解来尝试此操作:奇异值分解 (SVD) 和非负矩阵分解 (NMF)。

import numpy as np
from sklearn.datasets import fetch_20newsgroups
from sklearn import decomposition
from scipy import linalg
import matplotlib.pyplot as plt
%matplotlib inline
np.set_printoptions(suppress=True)

数据集

Scikit Learn 附带许多内置数据集,以及用于加载多个标准外部数据集的加载实用程序。这是一个很棒的资源,数据集包括波士顿房价、人脸图像、森林斑块、糖尿病、乳腺癌等。我们将使用新闻组数据集。

新闻组是 Usenet 上的讨论组,在网络真正起飞之前的 80 年代和 90 年代很流行。该数据集包括 18,000 个新闻组帖子和 20 个主题。

# 这里直接下载会出现forbidden 403的情况,所以我手动下载了数据集用load_files读取
categories = ['alt.atheism', 'talk.religion.misc', 'comp.graphics', 'sci.space']
remove = ('headers', 'footers', 'quotes')
train_data_folder = './20news-bydate/20news-bydate-train'
test_data_folder = './20news-bydate/20news-bydate-test'
newsgroups_train = load_files(train_data_folder, categories=categories, encoding='utf-8', decode_error='ignore')
newsgroups_test = load_files(test_data_folder, categories=categories, encoding='utf-8', decode_error='ignore')
# newsgroups_train = fetch_20newsgroups(subset='train', categories=categories, remove=remove)
# newsgroups_test = fetch_20newsgroups(subset='test', categories=categories, remove=remove)
newsgroups_train.filenames.shape, newsgroups_train.target.shape
((2034,), (2034,))

我们来看一个数据。你能猜出消息属于哪一类吗?

print("\n".join(newsgroups_train.data[:1]))
From: fineman@stein2.u.washington.edu (Twixt your toes)
Subject: Anyone know use "rayshade" out there?
Organization: University of Washington
Lines: 12
NNTP-Posting-Host: stein2.u.washington.edu
Keywords: rayshade, uw.I'm using "rayshade" on the u.w. computers here, and i'd like input
from other users, and perhaps swap some ideas.  I could post
uuencoded .gifs here, or .ray code, if anyone's interested.  I'm having
trouble coming up with colors that are metallic (i.e. brass, steel)
from the RGB values.If you're on the u.w. machines, check out "~fineman/rle.files/*.rle" on 
stein.u.washington.edu for some of what i've got.  dan
np.array(newsgroups_train.target_names)[newsgroups_train.target[:3]]
array(['comp.graphics'], dtype='<U18')

目标属性是类别的整数索引。

newsgroups_train.target[:10]
array([1, 2, 2, 2, 2, 2, 2, 1, 2, 1])
num_topics, num_top_words = 6, 8

停用词、词干提取、词形还原

停用词

一些极其常见的单词似乎对帮助选择符合用户需求的文档没有什么价值,因此被完全排除在词汇表之外。这些单词被称为停用词。
随着时间的推移,IR 系统的总体趋势是从标准使用相当大的停用词表(200-300 个词)到非常小的停用词表(7-12 个词),再到根本不使用停用词表。网络搜索引擎通常不使用停用词表。

NLTK
from sklearn.feature_extraction.text import ENGLISH_STOP_WORDS
sorted(list(ENGLISH_STOP_WORDS))[:20]
['a','about','above','across','after','afterwards','again','against','all','almost','alone','along','already','also','although','always','am','among','amongst','amoungst']

不存在单一的通用停用词列表。

词干提取、词形还原

摘自《信息检索》教科书:
以下单词相同吗?
organize, organizes, and organizing
democracy, democratic, and democratization

词干提取和词形还原都生成单词的词根形式。
词形还原使用语言规则。生成的标记都是实际单词
“词干提取是穷人的词形还原。”(Noah Smith,2011)词干提取是一种粗略的启发式方法,它会切断单词的末尾。生成的标记可能不是实际单词。词干提取速度更快。

import nltk
nltk.download('wordnet')
[nltk_data] Downloading package wordnet to
[nltk_data]     C:\Users\wuzhongyanqiu\AppData\Roaming\nltk_data...
True
from nltk import stem
wnl = stem.WordNetLemmatizer()
porter = stem.porter.PorterStemmer()
word_list = ['feet', 'foot', 'foots', 'footing']
[wnl.lemmatize(word) for word in word_list]
output:['foot', 'foot', 'foot', 'footing']
[porter.stem(word) for word in word_list]
output:['feet', 'foot', 'foot', 'foot']

这里再试一下其他的单词集合,词干提取、词形还原对于形态很复杂的语言可能有更大的好处。

word_list1 = ['fly', 'flies', 'flying']
word_list2 = ['organize', 'organizes', 'organizing']
word_list3 = ['universe', 'university']
word_list = word_list + word_list1 + word_list2 + word_list3
[wnl.lemmatize(word) for word in word_list]
['foot','foot','foot','footing','fly','fly','flying','organize','organizes','organizing','universe','university']
[porter.stem(word) for word in word_list]
['feet','foot','foot','foot','fli','fli','fli','organ','organ','organ','univers','univers']
Spacy

Spacy 是一个非常现代且快速的 nlp 库。 Spacy 有自己的主见,它通常提供一种高度优化的方式来做某事(而 nltk 提供了各种各样的方法,尽管它们通常没有那么优化)。

import spacy
!spacy download en_core_web_sm

Spacy 不提供词干提取器(因为词形还原被认为更好——这是一个固执己见的例子!)

nlp = spacy.load("en_core_web_sm")
sorted(list(nlp.Defaults.stop_words))[:20]
["'d","'ll","'m","'re","'s","'ve",'a','about','above','across','after','afterwards','again','against','all','almost','alone','along','already','also']

练习:哪些停用词在 spacy 中出现但在 sklearn 中没有出现?

#Exercise:What stop words appear in spacy but not in sklearn?
sklearn_stop_words = set(ENGLISH_STOP_WORDS)
spacy_stop_words = set(nlp.Defaults.stop_words)
unique_to_spacy = spacy_stop_words - sklearn_stop_words
sorted(list(unique_to_spacy))[:20]
["'d","'ll","'m","'re","'s","'ve",'ca','did','does','doing','just','make',"n't",'n‘t','n’t','quite','really','regarding','say','unless']

练习:哪些停用词在 sklearn 中有,但在 spacy 中没有?

#Exercise:What stop words appear in sklearn but not in spacy?
unique_to_sklearn = sklearn_stop_words - spacy_stop_words
sorted(list(unique_to_sklearn))[:20]
['amoungst','bill','cant','co','con','couldnt','cry','de','describe','detail','eg','etc','fill','find','fire','found','hasnt','ie','inc','interest']

何时使用这些?

这些长期以来被认为是标准技术,但如果使用深度学习,它们通常会损害您的表现。词干提取、词形还原和删除停用词都涉及丢弃信息。
但是,在使用较简单的模型时,它们仍然很有用。

数据处理

接下来,scikit learn 有一个方法可以帮我们提取所有单词计数。在下一课中,我们将学习如何编写自己的 CountVectorizer 版本,以了解底层发生了什么。

from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
import nltk
# 一个CountVectorizer对象,用于将文本转换为特征向量
vectorizer = CountVectorizer(stop_words='english')
vectors = vectorizer.fit_transform(newsgroups_train.data).todense()
vectors.shape
(2034, 33809)
print(len(newsgroups_train.data), vectors.shape)
2034 (2034, 33809)
vocab = np.array(vectorizer.get_feature_names_out())
vocab.shape
(33809,)
vocab[7000:7020]
array(['bnn', 'bnn_post', 'bnr', 'bnsc', 'bnsgs195', 'board', 'boarded','boards', 'boast', 'boasted', 'boasts', 'boat', 'boats', 'bob','bobbe', 'bobbing', 'bobby', 'bobc', 'bobcat', 'bobs'],dtype=object)

奇异值分解 (SVD)

我们显然会期望在一个主题中出现频率最高的单词在另一个主题中出现的频率较低 - 否则该单词就不是区分这两个主题的好选择。因此,我们期望主题是正交的。
SVD 算法将矩阵分解为一个具有正交列的矩阵和一个具有正交行的矩阵(以及一个对角矩阵,其中包含每个因素的相对重要性)。
在这里插入图片描述
SVD 是一种精确分解,因为它创建的矩阵足够大,可以完全覆盖原始矩阵。SVD 在线性代数中应用极其广泛,特别是在数据科学中,包括:

  • 语义分析(潜在语义分析 (LSA) 使用 SVD。您有时会听到将主题建模称为 LSA。)
  • 协同过滤/推荐(Netflix 奖获奖作品)
  • 计算 Moore-Penrose 伪逆
  • 数据压缩
  • 主成分分析
%time U, s, Vh = linalg.svd(vectors, full_matrices=False)
CPU times: total: 1min 57s
Wall time: 15.7 s
print(U.shape, s.shape, Vh.shape)
(2034, 2034) (2034,) (2034, 33809)

确认这是输入的分解。

s[:4]
output:
array([449.50641673, 303.09932748, 260.75217804, 233.74189479])
s[:4].shape
output:
(4,)
np.diag(s[:4])
output:
array([[449.50641673,   0.        ,   0.        ,   0.        ],[  0.        , 303.09932748,   0.        ,   0.        ],[  0.        ,   0.        , 260.75217804,   0.        ],[  0.        ,   0.        ,   0.        , 233.74189479]])

练习:确认U, s, Vh是向量的分解

# Exercise: confrim that U, s, Vh is a decomposition of `vectors`
# allclose()用于匹配两个数组输出为布尔值,默认在1e-05的误差范围内
vectors_check = np.dot(U, np.dot(np.diag(s), Vh))
assert np.allclose(vectors, vectors_check), 'The decomposition is wrong!'
print('The decomposition is confirmed.')
The decomposition is confirmed.

练习:确认U, Vh是正交的

# Exercise: Confirm that U, Vh are orthonormal
assert np.allclose(np.dot(U.T, U), np.eye(U.shape[0])), 'U is not orthonormal'
assert np.allclose(np.dot(Vh, Vh.T), np.eye(Vh.shape[0])), 'Vh is not orthonormal'
print('True')
True

关于奇异值 s 我们能说些什么呢?

plt.plot(s)

在这里插入图片描述

plt.plot(s[:10])

在这里插入图片描述

num_top_words = 8# vocab是词汇表,top_words是lambda函数,接收权重向量t,先对t进行排序,然后选取top_words
def show_topics(a):top_words = lambda t: [vocab[i] for i in np.argsort(t) [:-num_top_words-1:-1]]topic_words = ([top_words(t) for t in a])return [' '.join(t) for t in topic_words]
show_topics(Vh[:10])
['antti siivonen suut imein siberian stint siis tuusniemi','jpeg gif file image color quality format jfif','god jesus people space atheists does matthew don','space launch satellite nasa commercial satellites year market','edu jpeg space graphics ray mail pub com','jesus matthew prophecy messiah isaiah psalm david said','launch satellite commercial market graphics god atheists satellites','edu writes lines com organization article launch subject','image probe lunar surface mars argument probes moon','god atheists image religious atheism jesus probe religion']

我们得到的主题与我们预期的集群类型相匹配!尽管这是一个无监督算法,这意味着我们从未真正告诉算法我们的文档是如何分组的。

我们稍后会更详细地介绍 SVD。现在,重要的是我们有一个工具,可以让我们准确地将矩阵分解为正交列和正交行。

非负矩阵分解(NMF)

除了将因子限制为正交之外,另一个想法是将它们限制为非负。NMF 是非负数据集V的因式分解:
V = W H V=WH V=WH
转换为非负矩阵 W , H W, H W,H。通常积极因素会更容易解释(这也是 NMF 受欢迎的原因)。
在这里插入图片描述
非负矩阵分解 (NMF) 是一种非精确分解,可分解为一个细正矩阵和一个短正矩阵。NMF 是 NP-hard 且非唯一的。它有许多变体,可通过添加不同的约束来创建。

NMF from sklearn

我们将使用 scikit-learn 的 NMF 实现:

m, n = vectors.shape
d = 5 # num topicsclf = decomposition.NMF(n_components=d, random_state=1)W1 = clf.fit_transform(np.asarray(vectors))
H1 = clf.components_show_topics(H1)
['edu graphics pub mail ray 128 send ftp','jpeg image gif file color images format quality','god jesus people does atheists matthew atheism just','space launch satellite nasa commercial year satellites data','image data available software processing ftp analysis images']

TF-IDF

主题频率-逆文档频率 (TF-IDF) 是一种通过考虑术语在文档中出现的频率、文档的长度以及术语的常见/罕见程度来规范化术语计数的方法。

TF = (文档中术语 t 的出现次数) / (文档中的单词数量)

IDF = log(文档数量/包含术语 t 的文档数量)

vectorizer_tfidf = TfidfVectorizer(stop_words='english')
vectors_tfidf = vectorizer_tfidf.fit_transform(newsgroups_train.data) # (documents, vocab)newsgroups_train.data[10:20]
['From: jbrandt@NeoSoft.com (J Brandt)\nSubject: Beta Testers Wanted for Graphics Libraries\nOrganization: NeoSoft Communications Services -- (713) 684-5900\nKeywords: xeg ceg beta imsl vni x graphics\nLines: 48\n\n\n  Visual Numerics Inc. (formerly IMSL and Precision Visuals) is in the\nprocess of securing sites for beta testing X Exponent Graphics 1.0 \nand C Exponent Graphics 2.0.  (Both X Exponent Graphics and C Exponent\nGraphics are 3GL products).  The beta period is from April 26 through \nJune 18.  The platform is HP9000/700 running under OS 8.07 with \nansi C 8.71 compiler.  The media will be sent on 4mm DAT cartridge \ntape.  Here are some of the key facts about the two products.\n \nX Exponent Graphics 1.0 key facts:\n \n1. Complete collection of high-level 2D and 3D application plot types\n   available through a large collection of X resources.\n2. Cstom widget for OSF/Motif developers.\n3. Built-in interactive GUI for plot customization.\n4. Easily-implemented callbacks for customized application feedback.\n5. XEG 1.0, being built on the Xt Toolkit provides the user a widget \n   library that conforms to the expected syntax and standards familar \n   to X programmers.\n6. XEG will also be sold as a bundle with Visual Edge\'s UIM/X product.\n   This will enable user to use a GUI builder to create the graphical\n   layout of an application.\n \nC Exponent Graphics 2.0 key facts:\n \n1. Written in C for C application programmers/developers.  The library\n   is 100% written in C, and the programming interface conforms to C\n   standards, taking advantage fo the most desirable features of C.\n2. Build-in GUI for interactive plot customization.  Through mouse \n   interaction, the user has complete interactive graph output control\n   with over 200 graphics attributes for plot customization.\n3. Large collection of high-level application functions for "two-call"\n   graph creation.  A wide variety of 2D and 3D plot types are available\n   with minimal programming effort.\n4. User ability to interrupt and control the X event.  By controlling\n   the X event loop, when the user use the mouse to manipulate the  plot\n   the user can allow CEG to control the event loop or the user can \n   control the event loop.\n \nIf anyone is interested in beta testing either of the products, please\ncontact Wendy Hou at Visual Numerics via email at hou@imsl.com or call\n713-279-1066.\n \n \n-- \nJaclyn Brandt\njbrandt@NeoSoft.com\n--\n',......
W1 = clf.fit_transform(vector_tfidf)
H1 = clf.components_show_topics(H1)
['god edu people jesus bible believe say don','space nasa edu gov access com graphics digex','sandvik kent apple newton com alink ksand private','keith caltech livesey sgi morality solntze wpd jon','henry toronto zoo spencer zoology edu work utzoo']
plt.plot(clf.components_[0])

在这里插入图片描述

# 模型对象clf在使用训练数据进行拟合后,重建数据与原始数据之间的误差
clf.reconstruction_err_
44.03858988389047

截断 SVD

通过仅计算我们感兴趣的列子集,我们在计算 NMF 时节省了大量时间。有没有办法用 SVD 获得这种好处?有!这叫做截断 SVD。我们只对与最大奇异值相对应的向量感兴趣。在这里插入图片描述

经典分解算法的缺点:

  • 矩阵“非常大”
  • 数据经常缺失或不准确。当输入的不精确性限制了输出的精度时,为什么要花费额外的计算资源?
  • 数据传输现在在算法时间中起着重要作用。需要较少数据传递的技术可能会快得多,即使它们需要更多的浮点运算(浮点运算 = 浮点运算)。
  • 充分利用 GPU 很重要。

随机算法的优点:

  • 固有稳定性
  • 性能保证不依赖于微妙的光谱特性
  • 所需的矩阵向量积可以并行完成

时间比较

%time u, s, v = np.linalg.svd(vectors, full_matrices=False)
CPU times: total: 43.2 s
Wall time: 36.3 s
from sklearn import decomposition
import fbpca%time u, s, v = decomposition.randomized_svd(vectors, 10)
CPU times: total: 2.7 s
Wall time: 4.18 s

来自 Facebook 库 fbpca 的随机 SVD:

%time u, s, v = fbpca.pca(vectors, 10)
CPU times: total: 953 ms
Wall time: 1.23 s

很明显,随机算法大大减少了时间,fbpca的随机SVD更快。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/22992.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

《微服务大揭秘:SpringBoot与SpringCloud的魔法组合》

加入我们的探险队伍&#xff0c;一起深入SpringBoot与SpringCloud构建的微服务世界。以轻松幽默的笔触&#xff0c;带你一步步揭开微服务架构的神秘面纱&#xff0c;从服务发现的智能地图Eureka&#xff0c;到API网关Zuul的城市门卫&#xff0c;每一个环节都充满了惊喜。不仅如…

2. JavaScript 语法和数据结构

1. 基础 JavaScript不区分大小写 2. 注释 // 单行注释/* 这是一个更长的&#xff0c;多行注释 *//* 然而&#xff0c;你不能&#xff0c;/* 嵌套注释 */ 语法错误 */3. 声明 var 声明一个变量&#xff0c;可选初始化一个值。 let 声明一个块作用域的局部变量&#xff0c;可…

蒸汽流量积算仪数采上云案例

蒸汽流量积算仪数采上云案例 背景需求 中晟环境项目&#xff0c;蒸汽流量积算仪数据采集上云。传统方案&#xff0c;采用人工抄表方式&#xff0c;人工成本高&#xff0c;记录繁琐&#xff0c;数据记录常常出现记录错乱、模糊的情形。根据现有需求&#xff0c;实现积算仪的数…

6.4分享会

介绍 严格意义上讲&#xff0c;我们在 JavaScript 阶段学习的知识绝大部分属于 ECMAScript 的知识体系&#xff0c;ECMAScript 简称 ES 它提供了一套语言标准规范&#xff0c;如变量、数据类型、表达式、语句、函数等语法规则都是由 ECMAScript 规定的。浏览器将 ECMAScript 大…

Wi-Fi 6E vs. Wi-Fi 7: Which is the Best Fit for Your Infrastructure?

Wi-Fi 6E vs. Wi-Fi 7: Which is the Best Fit for Your Infrastructure? With the rapid advancement of wireless technology, organizations face a critical decision: should they adopt Wi-Fi 6E now or wait for Wi-Fi 7? This decision impacts various aspects of …

短剧市场大爆炸:小米和华为的亿万争夺战,谁能笑到最后?

在数字化媒体的浪潮中&#xff0c;内容消费模式正经历着翻天覆地的变化。短视频的兴起引领了一种全新的娱乐方式&#xff0c;而短剧作为其衍生形式&#xff0c;正逐渐成为各大科技巨头争夺的新战场。 小米和华为&#xff0c;作为中国科技界的两大巨头&#xff0c;也在这一新兴…

关于焊点检测SJ-BIST)模块实现

关于焊点检测SJ-BIST)模块实现 语言 :Verilg HDL 、VHDL EDA工具:ISE、Vivado、Quartus II 关于焊点检测SJ-BIST)模块实现一、引言二、焊点检测功能的实现方法(1) 输入接口(2) 输出接口(3) 模块实现核心状态图(4) 模块实现原理图关键词: Verilog HDL,焊点检测功能…

欲除烦恼须无我,各有前因莫羡人

欲除烦恼须无我&#xff0c;各有前因莫羡人

深度学习-09-让函数更简单

深度学习-09-让函数更简单 本文是《深度学习入门2-自製框架》 的学习笔记&#xff0c;记录自己学习心得&#xff0c;以及对重点知识的理解。如果内容对你有帮助&#xff0c;请支持正版&#xff0c;去购买正版书籍&#xff0c;支持正版书籍不仅是尊重作者的辛勤劳动&#xff0c;…

leetcode455.分发饼干、376. 摆动序列、53. 最大子序和

455.分发饼干 为了满足更多的小孩&#xff0c;就不要造成饼干尺寸的浪费 大尺寸的饼干既可以满足胃口大的孩子也可以满足胃口小的孩子&#xff0c;那么就应该优先满足胃口大的 这里的局部最优就是大饼干喂给胃口大的&#xff0c;充分利用饼干尺寸喂饱一个&#xff0c;全局最…

前端面试题日常练-day54 【面试题】

题目 希望这些选择题能够帮助您进行前端面试的准备&#xff0c;答案在文末 1. 在PHP中&#xff0c;以下哪个函数用于将一个字符串转换为日期时间对象&#xff1f; a) date() b) strtotime() c) datetime() d) time() 2. PHP中的超全局变量$_COOKIE用于存储什么类型的数据&a…

一致性hash算法的应用与go语言实现

一致性hash算法的应用与实现 设计目标&#xff1a;一致性hash算法的主要设计目标是在分布式系统中实现节点增减时数据映射关系的最小变动&#xff0c;从而保证数据的一致性和系统的稳定性。 一致性hash算法的应用场景 分布式负载均衡 一致性hash算法在分布式系统中得到广泛应…

揭秘AI 原生应用技术栈

一次性把“AI 原生应用技术栈”说明白 AI热潮持续&#xff0c;厂商努力推动有价值的应用涌现&#xff0c;并打造服务AI原始应用的平台产品。本文精简介绍业界最新的AI原生应用技术栈&#xff0c;让您迅速把握前沿科技脉搏。 整体架构 AI技术栈逻辑图精简呈现&#xff0c;多层…

图形学初识--透视修正

文章目录 前言正文为什么需要透视矫正&#xff1f;1、视图坐标空间--->NDC坐标空间&#xff08;透视投影&#xff09;&#xff08;1&#xff09;直线&#xff1a;&#xff08;2&#xff09;三角形&#xff1a;总结&#xff1a; 2、NDC坐标空间--->屏幕坐标空间&#xff0…

PID控制算法介绍及使用举例

PID 控制算法是一种常用的反馈控制算法&#xff0c;用于控制系统的稳定性和精度。PID 分别代表比例&#xff08;Proportional&#xff09;、积分&#xff08;Integral&#xff09;和微分&#xff08;Derivative&#xff09;&#xff0c;通过组合这三个部分来调节控制输出&#…

因子区间[牛客周赛44]

思路分析: 我们可以发现125是因子个数的极限了,所以我们可以用二维数组来维护第几个数有几个因子,然后用前缀和算出来每个区间合法个数,通过一个排列和从num里面选2个 ,c num 2 来计算即可 #include<iostream> #include<cstring> #include<string> #include…

用户反馈解决方案 —— 兔小巢构建反馈功能

目录 01: 前言 02: 用户反馈整体实现方案分析 03: 兔小巢全解析 04: 基于兔小巢实现用户反馈 05: 总结 01: 前言 在前台系统中&#xff0c;用户反馈 功能也是一个非常常见的需求。 通过反馈功能&#xff0c;我们可以知道当前的应用存在的一些不足和用户相应的一些诉求。…

【Linux系统】进程信号

本篇博客整理了进程信号从产生到处理的过程细节&#xff0c;通过不同过程中的系统调用和其背后的原理&#xff0c;旨在让读者更深入地理解操作系统的设计与软硬件管理手段。 目录 一、信号是什么 1.以生活为鉴 2.默认动作与自定义动作 3.信号的分类、保存、产生 二、产生…

蓝桥杯物联网竞赛_STM32L071KBU6_解决脉冲输出频率数值不稳定BUG

问题&#xff1a; 在用脉冲进行做题的时候发现脉冲输出的频率随着脉冲数值增大而越来越不稳定 典型的情况是10000HZ的时候会变成0HZ或者infHZ也就是无穷大 代码&#xff1a; int BEIGNNUMBER 0; int ENDNUMBER 0; unsigned char STATETIM 0; void HAL_TIM_IC_CaptureCal…

ChatGPT-4o抢先体验

速度很快&#xff0c;结果很智能&#xff0c;支持多模态输入输出&#xff0c;感兴趣联系作者