SKLearn - Biclustering

文章目录

  • Biclustering (双聚类)
  • 谱二分聚类算法演示
    • 生成样本数据
    • 拟合 `SpectralBiclustering`
    • 绘制结果
  • Spectral Co-Clustering 算法演示
  • 使用光谱协同聚类算法进行文档的二分聚类


Biclustering (双聚类)

关于双聚类技术的示例。


双聚类算法演示


谱双聚类的演示

谱双聚类的演示
谱协同聚类算法演示


使用谱协同聚类算法对文档进行双聚类

使用谱协同聚类算法对文档进行双聚类
新闻组文档的双聚类


使用谱协同聚类算法对新闻组文档进行双聚类

使用谱协同聚类算法对新闻组文档进行双聚类


注意:前往末尾下载完整示例代码或通过 JupyterLite 或 Binder 在浏览器中运行此示例。


谱二分聚类算法演示

本例演示了如何使用 SpectralBiclustering 算法生成方格数据集并对其进行二分聚类。谱二分聚类算法专门设计用于通过同时考虑矩阵的行(样本)和列(特征)来聚类数据。它的目标是识别样本之间以及样本子集中的模式,从而在数据中检测到局部化结构。这使得谱二分聚类特别适合于特征顺序或排列固定的数据集,例如图像、时间序列或基因组。

数据生成后,经过打乱并传递给谱二分聚类算法。然后重新排列打乱矩阵的行和列来绘制找到的二分聚类。


# 作者:scikit-learn 开发者
# SPDX-License-Identifier: BSD-3-Clause

生成样本数据

我们使用 make_checkerboard 函数生成样本数据。shape=(300, 300) 中的每个像素都代表来自均匀分布的值。噪声来自正态分布,其中 noise 的值是标准差。

如您所见,数据分布在 12 个簇单元中,且相对容易区分。

from matplotlib import pyplot as pltfrom sklearn.datasets import make_checkerboardn_clusters = (4, 3)
data, rows, columns = make_checkerboard(shape=(300, 300), n_clusters=n_clusters, noise=10, shuffle=False, random_state=42
)plt.matshow(data, cmap=plt.cm.Blues)
plt.title("原始数据集")
plt.show()

原始数据集


我们打乱数据,目标是之后使用 SpectralBiclustering 重建它。

import numpy as np# 创建打乱行和列索引的列表
rng = np.random.RandomState(0)
row_idx_shuffled = rng.permutation(data.shape[0])
col_idx_shuffled = rng.permutation(data.shape[1])

我们重新定义打乱的数据并绘制它。我们观察到我们失去了原始数据矩阵的结构。

data = data[row_idx_shuffled][:, col_idx_shuffled]plt.matshow(data, cmap=plt.cm.Blues)
plt.title("打乱的数据集")
plt.show()

打乱的数据集


拟合 SpectralBiclustering

我们拟合模型并比较获得的聚类与真实值。请注意,在创建模型时,我们指定了与创建数据集时相同的簇数(n_clusters = (4, 3)),这将有助于获得良好的结果。

from sklearn.cluster import SpectralBiclustering
from sklearn.metrics import consensus_scoremodel = SpectralBiclustering(n_clusters=n_clusters, method="log", random_state=0)
model.fit(data)# 计算两组二分聚类之间的相似度
score = consensus_score(model.biclusters_, (rows[:, row_idx_shuffled], columns[:, col_idx_shuffled]))
print(f"一致性得分:{score:.1f}")
***
一致性得分:1.0

该得分介于 0 和 1 之间,其中 1 对应于完美的匹配。它显示了二分聚类的质量。


绘制结果

现在,我们根据 SpectralBiclustering 模型分配的行和列标签按升序重新排列数据,并再次绘制。row_labels_ 的范围从 0 到 3,而 column_labels_ 的范围从 0 到 2,代表每行有 4 个簇,每列有 3 个簇。

# 首先重新排列行,然后是列。
reordered_rows = data[np.argsort(model.row_labels_)]
reordered_data = reordered_rows[:, np.argsort(model.column_labels_)]plt.matshow(reordered_data, cmap=plt.cm.Blues)
plt.title("二分聚类后;重新排列以显示二分聚类")
plt.show()

二分聚类后;重新排列以显示二分聚类


最后一步,我们想展示模型分配的行和列标签之间的关系。因此,我们使用 numpy.outer 创建一个网格,它将排序后的 row_labels_column_labels_ 相加 1,以确保标签从 1 开始而不是 0,以便更好地可视化。

plt.matshow(np.outer(np.sort(model.row_labels_) + 1, np.sort(model.column_labels_) + 1), cmap=plt.cm.Blues)
plt.title("重新排列数据的方格结构")
plt.show()

重新排列数据的方格结构


行和列标签向量的外积显示了方格结构的表示,其中不同的行和列标签组合用不同的蓝色阴影表示。

脚本的总运行时间:(0 分钟 0.534 秒)


  • 启动 binder : https://mybinder.org/v2/gh/scikit-learn/scikit-learn/1.6.X?urlpath=lab/tree/notebooks/auto_examples/bicluster/plot_spectral_biclustering.ipynb
  • 启动 JupyterLite : https://scikit-learn.org/stable/lite/lab/index.html?path=auto_examples/bicluster/plot_spectral_biclustering.ipynb
  • 下载 Jupyter notebook:`plot_spectral_biclustering.ipynb](https://scikit-learn.org/stable/_downloads//6b00e458f3e282f1cc421f077b2fcad1/plot_spectral_biclustering.ipynb>
  • 下载 Python 源代码:plot_spectral_biclustering.py : https://scikit-learn.org/stable/_downloads//ac19db97f4bbd077ccffef2736ed5f3d/plot_spectral_biclustering.py
  • 下载 zip 文件:plot_spectral_biclustering.zip: <https://scikit-learn.org/stable/_downloads//f66c3a9f3631c05c52d31172371922ab/plot_spectral_biclustering.zip`

Spectral Co-Clustering 算法演示

本例演示了如何使用 Spectral Co-Clustering 算法生成数据集并对其进行二分聚类。

数据集使用 make_biclusters 函数生成,该函数创建一个包含小值的矩阵,并植入具有大值的大值二分块。然后,行和列进行洗牌,并传递给 Spectral Co-Clustering 算法。通过重新排列洗牌后的矩阵以显示连续的二分块,展示了算法找到二分块的高准确性。

  • 原始数据集

  • 洗牌后的数据集

  • 二分聚类后;重新排列以显示二分块

一致性得分:1.000

# 作者:scikit-learn 开发者
# SPDX-License-Identifier: BSD-3-Clauseimport numpy as np
from matplotlib import pyplot as pltfrom sklearn.cluster import [SpectralCoclustering](https://scikit-learn.org/stable/modules/generated/sklearn.cluster.SpectralCoclustering.html#sklearn.cluster.SpectralCoclustering "sklearn.cluster.SpectralCoclustering")
from sklearn.datasets import [make_biclusters](https://scikit-learn.org/stable/modules/generated/sklearn.datasets.make_biclusters.html#sklearn.datasets.make_biclusters "sklearn.datasets.make_biclusters")
from sklearn.metrics import [consensus_score](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.consensus_score.html#sklearn.metrics.consensus_score "sklearn.metrics.consensus_score")data, rows, columns = [make_biclusters](https://scikit-learn.org/stable/modules/generated/sklearn.datasets.make_biclusters.html#sklearn.datasets.make_biclusters "sklearn.datasets.make_biclusters")(shape=(300, 300), n_clusters=5, noise=5, shuffle=False, random_state=0
)[plt.matshow](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.matshow.html#matplotlib.pyplot.matshow "matplotlib.pyplot.matshow")(data, cmap=plt.cm.Blues)
[plt.title](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.title.html#matplotlib.pyplot.title "matplotlib.pyplot.title")("原始数据集")# 洗牌聚类
rng = [np.random.RandomState](https://numpy.org/doc/stable/reference/random/legacy.html#numpy.random.RandomState "numpy.random.RandomState")(0)
row_idx = rng.permutation(data.shape[0])
col_idx = rng.permutation(data.shape[1])
data = data[row_idx][:, col_idx][plt.matshow](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.matshow.html#matplotlib.pyplot.matshow "matplotlib.pyplot.matshow")(data, cmap=plt.cm.Blues)
[plt.title](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.title.html#matplotlib.pyplot.title "matplotlib.pyplot.title")("洗牌后的数据集")model = [SpectralCoclustering](https://scikit-learn.org/stable/modules/generated/sklearn.cluster.SpectralCoclustering.html#sklearn.cluster.SpectralCoclustering "sklearn.cluster.SpectralCoclustering")(n_clusters=5, random_state=0)
model.fit(data)
score = [consensus_score](https://scikit-learn.org/stable/modules/generated/sklearn.metrics.consensus_score.html#sklearn.metrics.consensus_score "sklearn.metrics.consensus_score")(model.biclusters_, (rows[:, row_idx], columns[:, col_idx]))print("一致性得分:{:.3f}".format(score))fit_data = data[[np.argsort](https://numpy.org/doc/stable/reference/generated/numpy.argsort.html#numpy.argsort "numpy.argsort")(model.row_labels_)]
fit_data = fit_data[:, [np.argsort](https://numpy.org/doc/stable/reference/generated/numpy.argsort.html#numpy.argsort "numpy.argsort")(model.column_labels_)][plt.matshow](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.matshow.html#matplotlib.pyplot.matshow "matplotlib.pyplot.matshow")(fit_data, cmap=plt.cm.Blues)
[plt.title](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.title.html#matplotlib.pyplot.title "matplotlib.pyplot.title")("二分聚类后;重新排列以显示二分块")[plt.show](https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.show.html#matplotlib.pyplot.show "matplotlib.pyplot.show")()

脚本的总运行时间: (0 分钟 0.347 秒)

  • 启动 binder : https://mybinder.org/v2/gh/scikit-learn/scikit-learn/1.6.X?urlpath=lab/tree/notebooks/auto_examples/bicluster/plot_spectral_coclustering.ipynb
  • 启动 JupyterLite : https://scikit-learn.org/stable/lite/lab/index.html?path=auto_examples/bicluster/plot_spectral_coclustering.ipynb
  • 下载 Jupyter notebook:`plot_spectral_coclustering.ipynb](https://scikit-learn.org/stable/_downloads//ee8e74bb66ae2967f890e19f28090b37/plot_spectral_coclustering.ipynb>
  • 下载 Python 源代码:plot_spectral_coclustering.py : https://scikit-learn.org/stable/_downloads//bc8849a7cb8ea7a8dc7237431b95a1cc/plot_spectral_coclustering.py
  • 下载 zip 文件:plot_spectral_coclustering.zip: <https://scikit-learn.org/stable/_downloads//3019a99f3f124514f9a0650bcb33fa27/plot_spectral_coclustering.zip`


使用光谱协同聚类算法进行文档的二分聚类

本例展示了如何使用光谱协同聚类算法对二十个新闻组数据集进行处理。由于“comp.os.ms-windows.misc”类别包含大量仅包含数据的帖子,因此该类别被排除。

TF-IDF 向量化后的帖子形成了一个词频矩阵,然后使用 Dhillon 的光谱协同聚类算法进行二分聚类。结果文档-词二分聚类表示了那些子文档中更常用的一些子词。

对于一些最好的二分聚类,打印出其最常见的文档类别和十个最重要的词。最好的二分聚类是由其归一化切割确定的。最好的词是通过比较其在二分聚类内外部的和来确定的。

为了比较,文档还使用 MiniBatchKMeans 进行了聚类。从二分聚类中得到的文档簇比 MiniBatchKMeans 找到的簇的 V-measure 更好。

向量化...
协同聚类...
完成耗时 1.20 秒。V-measure: 0.4415
MiniBatchKMeans...
完成耗时 2.28 秒。V-measure: 0.3015最佳二分聚类:
----------------
二分聚类 0 : 8 个文档,6 个词
类别   : 100% talk.politics.mideast
词        : cosmo, angmar, alfalfa, alphalpha, proline, benson二分聚类 1 : 1948 个文档,4325 个词
类别   : 23% talk.politics.guns, 18% talk.politics.misc, 17% sci.med
词        : gun, guns, geb, banks, gordon, clinton, pitt, cdt, surrender, veal二分聚类 2 : 1259 个文档,3534 个词
类别   : 27% soc.religion.christian, 25% talk.politics.mideast, 25% alt.atheism
词        : god, jesus, christians, kent, sin, objective, belief, christ, faith, moral二分聚类 3 : 775 个文档,1623 个词
类别   : 30% comp.windows.x, 25% comp.sys.ibm.pc.hardware, 20% comp.graphics
词        : scsi, nada, ide, vga, esdi, isa, kth, s3, vlb, bmug二分聚类 4 : 2180 个文档,2802 个词
类别   : 18% comp.sys.mac.hardware, 16% sci.electronics, 16% comp.sys.ibm.pc.hardware
词        : voltage, shipping, circuit, receiver, processing, scope, mpce, analog, kolstad, umass

# Authors: The scikit-learn developers
# SPDX-License-Identifier: BSD-3-Clause
from collections import Counter
from time import timeimport numpy as npfrom sklearn.cluster import MiniBatchKMeans, SpectralCoclustering
from sklearn.datasets import fetch_20newsgroups
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.metrics.cluster import v_measure_scoredef number_normalizer(tokens):"""将所有数字标记映射到占位符。对于许多应用,以数字开头的标记不是直接有用的,但这样的标记存在的事实可能很重要。通过应用这种形式的降维,某些方法可能表现得更好。"""return ("#NUMBER" if token[0].isdigit() else token for token in tokens)class NumberNormalizingVectorizer(TfidfVectorizer):def build_tokenizer(self):tokenize = super().build_tokenizer()return lambda doc: list(number_normalizer(tokenize(doc)))# 排除 'comp.os.ms-windows.misc'
categories = ["alt.atheism", "comp.graphics", "comp.sys.ibm.pc.hardware", "comp.sys.mac.hardware", "comp.windows.x", "misc.forsale", "rec.autos", "rec.motorcycles", "rec.sport.baseball", "rec.sport.hockey", "sci.crypt", "sci.electronics", "sci.med", "sci.space", "soc.religion.christian", "talk.politics.guns", "talk.politics.mideast", "talk.politics.misc", "talk.religion.misc", ]
newsgroups = fetch_20newsgroups(categories=categories)
y_true = newsgroups.targetvectorizer = NumberNormalizingVectorizer(stop_words="english", min_df=5)
cocluster = SpectralCoclustering(n_clusters=len(categories), svd_method="arpack", random_state=0
)
kmeans = MiniBatchKMeans(n_clusters=len(categories), batch_size=20000, random_state=0, n_init=3
)print("向量化...")
X = vectorizer.fit_transform(newsgroups.data)print("协同聚类...")
start_time = time()
cocluster.fit(X)
y_cocluster = cocluster.row_labels_
print(f"完成耗时 {time() - start_time:.2f}s. V-measure: {v_measure_score(y_cocluster, y_true):.4f}"
)print("MiniBatchKMeans...")
start_time = time()
y_kmeans = kmeans.fit_predict(X)
print(f"完成耗时 {time() - start_time:.2f}s. V-measure: {v_measure_score(y_kmeans, y_true):.4f}"
)feature_names = vectorizer.get_feature_names_out()
document_names = list(newsgroups.target_names[i] for i in newsgroups.target)def bicluster_ncut(i):rows, cols = cocluster.get_indices(i)if not (np.any(rows) and np.any(cols)):import sysreturn sys.float_info.maxrow_complement = np.nonzero(np.logical_not(cocluster.rows_[i]))[0]col_complement = np.nonzero(np.logical_not(cocluster.columns_[i]))[0]# 注意:以下与 X[rows[:, np.newaxis], cols].sum() 相同,但在 scipy <= 0.16 中更快weight = X[rows][:, cols].sum()cut = X[row_complement][:, cols].sum() + X[rows][:, col_complement].sum()return cut / weightbicluster_ncuts = list(bicluster_ncut(i) for i in range(len(newsgroups.target_names)))
best_idx = np.argsort(bicluster_ncuts)[:5]print()
print("最佳二分聚类:")
print("----------------")
for idx, cluster in enumerate(best_idx):n_rows, n_cols = cocluster.get_shape(cluster)cluster_docs, cluster_words = cocluster.get_indices(cluster)if not len(cluster_docs) or not len(cluster_words):continue# 类别counter = Counter(document_names[doc] for doc in cluster_docs)cat_string = ", ".join(f"{(c / n_rows * 100):.0f}% {name}" for name, c in counter.most_common(3))# 词out_of_cluster_docs = cocluster.row_labels_ != clusterout_of_cluster_docs = np.where(out_of_cluster_docs)[0]word_col = X[:, cluster_words]word_scores = np.array(word_col[cluster_docs, :].sum(axis=0)- word_col[out_of_cluster_docs, :].sum(axis=0))word_scores = word_scores.ravel()important_words = list(feature_names[cluster_words[i]] for i in word_scores.argsort()[:-11:-1])print(f"二分聚类 {idx} : {n_rows} 个文档,{n_cols} 个词")print(f"类别   : {cat_string}")print(f"词        : {', '.join(important_words)}\n")

脚本的总运行时间: (0 分钟 15.176 秒)

  • 启动 binder : https://mybinder.org/v2/gh/scikit-learn/scikit-learn/1.6.X?urlpath=lab/tree/notebooks/auto_examples/bicluster/plot_bicluster_newsgroups.ipynb
  • 启动 JupyterLite : https://scikit-learn.org/stable/lite/lab/index.html?path=auto_examples/bicluster/plot_bicluster_newsgroups.ipynb
  • 下载 Jupyter notebook: plot_bicluster_newsgroups.ipynb](https://scikit-learn.org/stable/_downloads//3f7191b01d0103d1886c959ed7687c4d/plot_bicluster_newsgroups.ipynb>
  • 下载 Python 源代码: plot_bicluster_newsgroups.py` : https://scikit-learn.org/stable/_downloads//e68419b513284db108081422c73a5667/plot_bicluster_newsgroups.py
  • 下载 zip 文件: plot_bicluster_newsgroups.zip: <https://scikit-learn.org/stable/_downloads//ccd24a43e08ccb154430edf7f927cfc7/plot_bicluster_newsgroups.zip

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

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

相关文章

PostSwigger Web 安全学习:CSRF漏洞2

CSRF 漏洞学习网站&#xff1a;What is CSRF (Cross-site request forgery)? Tutorial & Examples | Web Security Academy CSRF 漏洞&#xff1a;SameSite相关绕过 当浏览器访问服务器时&#xff0c;服务器会在 Cookie 中添加 SameSite 属性来告诉浏览器是否在来自其他…

从基础到实战的量化交易全流程学习:1.3 数学与统计学基础——概率与统计基础 | 数字特征

从基础到实战的量化交易全流程学习&#xff1a;1.3 数学与统计学基础——概率与统计基础 | 数字特征 第一部分&#xff1a;概率与统计基础 第2节&#xff1a;数字特征&#xff1a;期望值、方差、协方差与相关系数 一、期望值&#xff08;Expected Value&#xff09;&#xff1a…

MySQL(聚合函数)

单行函数 对每一条记录输入值进行计算&#xff0c;得到相应的计算结果&#xff0c;返回给用户&#xff0c;也就是说&#xff0c;每条记录作为一个输入参数&#xff0c;经过函数计算得到每条记录的计算结果。 每一个函数中都有一些常用的函数&#xff08;方法&#xff09; 在学…

babel核心知识点

Babel 是一个 JavaScript 编译器&#xff0c;主要用于将 ECMAScript 2015 版本的代码转换为向后兼容的 JavaScript 代码&#xff0c;以便在旧版本的浏览器或环境中运行。以下是 Babel 的核心知识点&#xff1a; 1. 基本概念 编译器&#xff1a;Babel 本质上是一个编译器&…

javaScript--数据结构和算法

在 JavaScript 里&#xff0c;数据结构和算法是十分关键的部分&#xff0c;下面介绍几种常见的数据结构和对应的算法。 数组&#xff08;Array&#xff09; 数组是最基础的数据结构&#xff0c;用于存储一系列有序的数据。 // 创建数组 const arr [1, 2, 3, 4, 5];// 访问元素…

π0.5:带开放世界泛化的视觉-语言-动作模型

25年4月来自具身机器人创业公司 PI 公司的论文“π0.5: a Vision-Language-Action Model with Open-World Generalization”。 为了使机器人发挥作用&#xff0c;它们必须在实验室之外的现实世界中执行实际相关的任务。虽然视觉-语言-动作 (VLA) 模型在端到端机器人控制方面已…

使用 OpenCV 和 dlib 进行人脸检测

文章目录 1. 什么是 dlib2. 前期准备介绍2.1 环境准备2.2 dlib 的人脸检测器 3. 代码实现3.1 导入库3.2 加载检测器3.3 读取并调整图像大小3.4 检测人脸3.5 绘制检测框3.6 显示结果 4. 完整代码5. 优化与改进5.1 提高检测率5.2 处理 BGR 与 RGB 问题 6. 总结 人脸检测是计算机视…

spring 的PropertySource 类与 @PropertySource 注解详解与对比

PropertySource 类与 PropertySource 注解详解与对比 在这里插入图片描述 一、PropertySource 类详解 1. 类型与作用 类型&#xff1a;接口&#xff08;org.springframework.core.env.PropertySource&#xff09;作用&#xff1a;抽象配置数据源&#xff0c;提供统一的键值…

Java后端开发day37--源码解析:TreeMap可变参数--集合工具类:Collections

&#xff08;以下内容全部来自上述课程&#xff09; 1. TreeMap 1.1 须知 1.1.1 Entry 节点初始为黑色&#xff1a;提高代码阅读性 1.1.2 TreeMap中的成员变量 comparator&#xff1a;比较规则root&#xff1a;红黑树根节点的地址值size&#xff1a;集合的长度和红黑树…

基于Playwright的浏览器自动化MCP服务

一、服务定位与核心功能 github.com/executeautomation/mcp-playwright 是一个基于 Playwright&#xff08;微软开源的跨浏览器自动化测试框架&#xff09;的 Model Context Protocol (MCP) 服务&#xff0c;核心功能是将浏览器自动化能力集成到大语言模型&#xff08;LLM&…

OSPF网络协议

OSPF&#xff08;Open Shortest Path First&#xff09;是一种链路状态路由协议&#xff0c;属于IGP&#xff08;内部网关协议&#xff09;&#xff0c;用于在单一自治系统&#xff08;AS&#xff09;内动态分发路由信息。它通过计算最短路径&#xff08;基于Dijkstra算法&…

Ubuntu 22.04.4操作系统初始化详细配置

上一章节&#xff0c;主要讲解了Ubuntu 22.04.4操作系统的安装&#xff0c;但是在实际生产环境中&#xff0c;需要对Ubuntu操作系统初始化&#xff0c;从而提高系统的性能和稳定性。 一、查看Ubuntu系统版本和内核版本 # 查看系统版本 testubuntu:~$ sudo lsb_release -a Rel…

【Linux应用】开发板快速上手:镜像烧录、串口shell、外设挂载、WiFi配置、SSH连接、文件交互(RADXA ZERO 3为例)

【Linux应用】开发板快速上手&#xff1a;镜像烧录、串口shell、外设挂载、WiFi配置、SSH连接、文件交互&#xff08;RADXA ZERO 3为例&#xff09; 参考&#xff1a; ZERO 3 | Radxa Docs 大部分的Linux开发板等设备都大同小异 如树莓派、香橙派、STM32MP135的Linux开发板等 …

Redis使用总结

NoSQL 1.1为什么要用NoSQL 面对现在用户数据的急剧上升&#xff0c;我们需要对这些用户数据进行挖掘&#xff0c;传统的关系型数据库已经不适合这些 应用了.Nosql 的发展可以很了的处理这些大的数据. 1.2什么是NoSQL Not Only Sql->NoSQL(不仅仅是SQL) 非关系型数据库.随…

Unity ML-Agents + VScode 环境搭建 Windows

安装Unity 先去官网下载Unity Hub&#xff0c;然后安装在D盘就可以了&#xff0c;你需要手机上安装一个Unity Connect进行账号注册。 详细的注册可以参考&#xff1a; https://blog.csdn.net/Dugege007/article/details/128472571 注册好了以后登入电脑端的Unity Hub&#x…

Linux电源管理(2)_常规的电源管理的基本概念和软件架构

原文&#xff1a; Linux电源管理(2)_Generic PM之基本概念和软件架构 1. 前言 Linux系统中那些常规的电源管理手段&#xff0c;包括关机&#xff08;Power off&#xff09;、待机&#xff08;Standby or Hibernate&#xff09;、重启&#xff08;Reboot&#xff09;等。这些…

机器学习基础理论 - 分类问题评估指标

几个定义:混淆矩阵 TP: True Positives, 表示实际为正例且被分类器判定为正例的样本数FP: False Positives, 表示实际为负例且被分类器判定为正例的样本数FN: False Negatives, 表示实际为正例但被分类器判定为负例的样本数TN: True Negatives, 表示实际为负例且被分类…

在线教育系统开发常见问题及解决方案:源码部署到运营维护

当下&#xff0c;越来越多的教育机构、企业培训部门以及创业者&#xff0c;选择开发属于自己的在线教育系统。然而&#xff0c;从源码部署到实际运营&#xff0c;整个过程中常常会遇到一系列技术与管理难题。今天&#xff0c;笔者将从在线教育系统源码维护、运营等几个方向为大…

RAG(Retrieval-Augmented Generation,检索增强生成)

RAG&#xff08;Retrieval-Augmented Generation&#xff0c;检索增强生成&#xff09;是一种结合 信息检索 和 文本生成 的技术&#xff0c;旨在提升大语言模型&#xff08;LLM&#xff09;生成内容的准确性和时效性。其核心思想是&#xff1a;先检索相关知识&#xff0c;再基…

项目实战 -- 状态管理

redux基础 还记得好久好久之前就想要实现的一个功能吗&#xff1f; 收起侧边栏折叠菜单&#xff0c;没错&#xff0c;现在才实现 因为不是父子通信&#xff0c;所以处理起来相对麻烦一点 可以使用状态树或者中间人模式 这就需要会redux了 Redux工作流&#xff1a; 异步就…