当前位置: 首页 > news >正文

机器学习模型评估指标

模型的评估指标是衡量一个模型应用于对应任务的契合程度,常见的指标有
  1. 准确率(Accuracy): 正确预测的样本数占总样本数的比例。适用于类别分布均衡的数据集。

  2. 精确率(Precision): 在所有被预测为正类的样本中,实际为正类的比例。高精确率意味着较少的假正例。

  3. 召回率(Recall): 在所有实际为正类的样本中,被正确预测为正类的比例。高召回率意味着较少的假负例。

  4. F1分数(F1 Score): 精确率和召回率的调和平均,是两者之间的平衡指标。F1分数在类别不平衡时特别有用。

  5. AUC-ROC曲线下面积(AUC): ROC曲线下的面积,衡量模型对正负样本的区分能力。AUC值越高,模型性能越好。

  6. 平均精度(Average Precision): 每个类别的精确率的平均值,特别用于多标签分类问题。

  7. 平均召回率(Average Recall): 每个类别的召回率的平均值,同样适用于多标签分类。

  8. 混淆矩阵(Confusion Matrix): 一个表格,显示了实际类别与预测类别之间的关系,可以用来计算上述指标。

  9. 平均F1分数(Average F1 Score): 对每个类别计算F1分数后取平均值。

  10. 马修距离(Mean Absolute Error, MAE): 预测值与真实值之间差的绝对值的平均。

  11. 均方误差(Mean Square Error, MSE): 预测值与真实值之间差的平方的平均值。

  12. 均方根误差(Root Mean Square Error, RMSE): MSE的平方根,提供了误差的尺度化度量。

  13. 对数平均绝对误差(Mean Absolute Percentage Error, MAPE): 预测值与真实值之间差的绝对值的百分比的平均值。

  14. 洛斯损失(Log Loss): 常用于逻辑回归模型,衡量预测概率与实际标签之间的差异。

  15. 杰卡指数(Jaccard Index): 1减去预测类别与真实类别的交集与并集的比例,用于衡量两个集合的相似度。

结合场景来看待这些指标

  1. 分类问题(Classification):

    • 类别不平衡(Class Imbalance): 在这种情况下,召回率(Recall)和F1分数(F1 Score)通常比准确率(Accuracy)更能反映模型性能,因为准确率可能会因为多数类而产生误导。
    • 多类别分类(Multi-class Classification): 精确率(Precision)、召回率(Recall)和F1分数(F1 Score)可以为每个类别单独计算,然后平均得到宏平均(Macro-average)或微平均(Micro-average)指标。
  2. 回归问题(Regression):

    • 均方误差(Mean Squared Error, MSE)和均方根误差(Root Mean Squared Error, RMSE)是衡量预测值与实际值之间差异的常用指标。
    • 平均绝对误差(Mean Absolute Error, MAE)提供了预测误差的平均绝对值,对异常值不敏感。
  3. 异常检测:

    • 查准率(Precision)和召回率(Recall)在这里同样重要,尤其是在异常类别较少的情况下。
  4. 排名问题:

    • 平均精度(Mean Average Precision, MAP)是一个关键指标,它衡量的是模型在整个排名列表中保持高精确度的能力。
  5. 多标签分类:

    • 每个标签的精确率和召回率可以单独计算,然后根据标签的分布进行加权平均。
  6. 多输出问题:

    • 对于每个输出变量,可以单独计算MSE、RMSE或准确率等指标。

1.准确率

即希望11(模型正确预测正例)、10(模型正确预测负例)的占比更高

基本原理

准确率是将预测正确的样本数量与总样本数量之比,它衡量的是模型在整个数据集上的表现。然而,当数据集不平衡(即某一类样本数量明显多于其他类别)时,准确率可能不是一个很好的评估指标,因为即使模型预测所有样本都属于多数类别,也能获得相对较高的准确率。

核心点

代码例子

import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import accuracy_score, confusion_matrix# 生成模拟数据集
X, y = make_classification(n_samples=1000, n_features=20, n_classes=2, random_state=42)# 划分训练集和测试集
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)# 训练逻辑回归模型
model = LogisticRegression()
model.fit(X_train, y_train)# 在测试集上做预测
y_pred = model.predict(X_test)# 计算准确率
accuracy = accuracy_score(y_test, y_pred)
print("Accuracy:", accuracy)# 绘制混淆矩阵
conf_matrix = confusion_matrix(y_test, y_pred)
print("Confusion Matrix:")
print(conf_matrix)# 绘制评估指标
plt.imshow(conf_matrix, cmap='binary', interpolation='None')
plt.colorbar()
plt.xticks([0, 1])
plt.yticks([0, 1])
plt.xlabel('Predicted Label')
plt.ylabel('True Label')
plt.title('Confusion Matrix')
plt.show()

2.精确率

基本原理

精确率的核心思想是衡量模型在所有预测为正类别的样本中,真正为正类别的样本所占的比例。这个指标对于那些需要准确识别正例的任务尤为重要,比如医学诊断中的疾病检测。高精确率表示模型在识别正例方面有很好的表现。

核心点

代码例子

import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import precision_score, confusion_matrix# 生成模拟数据集
X, y = make_classification(n_samples=1000, n_features=20, n_classes=2, random_state=42)# 划分训练集和测试集
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)# 训练逻辑回归模型
model = LogisticRegression()
model.fit(X_train, y_train)# 在测试集上做预测
y_pred = model.predict(X_test)# 计算精确率
precision = precision_score(y_test, y_pred)
print("Precision:", precision)# 绘制混淆矩阵
conf_matrix = confusion_matrix(y_test, y_pred)
print("Confusion Matrix:")
print(conf_matrix)# 绘制评估指标
plt.imshow(conf_matrix, cmap='binary', interpolation='None')
plt.colorbar()
plt.xticks([0, 1])
plt.yticks([0, 1])
plt.xlabel('Predicted Label')
plt.ylabel('True Label')
plt.title('Confusion Matrix')
plt.show()

3.召回率

基本原理

召回率的核心思想是衡量模型在识别正例方面的表现。它强调了模型对于实际为正类别的样本的识别能力,对于那些需要尽量避免漏诊的任务,比如疾病检测,召回率是一个非常重要的评估指标。

核心点

代码例子

import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import recall_score, confusion_matrix# 生成模拟数据集
X, y = make_classification(n_samples=1000, n_features=20, n_classes=2, random_state=42)# 划分训练集和测试集
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)# 训练逻辑回归模型
model = LogisticRegression()
model.fit(X_train, y_train)# 在测试集上做预测
y_pred = model.predict(X_test)# 计算召回率
recall = recall_score(y_test, y_pred)
print("Recall:", recall)# 绘制混淆矩阵
conf_matrix = confusion_matrix(y_test, y_pred)
print("Confusion Matrix:")
print(conf_matrix)# 绘制评估指标
plt.imshow(conf_matrix, cmap='binary', interpolation='None')
plt.colorbar()
plt.xticks([0, 1])
plt.yticks([0, 1])
plt.xlabel('Predicted Label')
plt.ylabel('True Label')
plt.title('Confusion Matrix')
plt.show()

4.F1分数

基本原理

F1分数综合考虑了模型的精确率和召回率,因此可以在一定程度上弥补精确率和召回率单独使用时的不足。F1分数越高,表示模型在识别和预测正类别方面的综合表现越好。

核心点

代码例子

import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import f1_score, confusion_matrix# 生成模拟数据集
X, y = make_classification(n_samples=1000, n_features=20, n_classes=2, random_state=42)# 划分训练集和测试集
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)# 训练逻辑回归模型
model = LogisticRegression()
model.fit(X_train, y_train)# 在测试集上做预测
y_pred = model.predict(X_test)# 计算F1分数
f1 = f1_score(y_test, y_pred)
print("F1 Score:", f1)# 绘制混淆矩阵
conf_matrix = confusion_matrix(y_test, y_pred)
print("Confusion Matrix:")
print(conf_matrix)# 绘制评估指标
plt.imshow(conf_matrix, cmap='binary', interpolation='None')
plt.colorbar()
plt.xticks([0, 1])
plt.yticks([0, 1])
plt.xlabel('Predicted Label')
plt.ylabel('True Label')
plt.title('Confusion Matrix')plt.show()

5.ROC曲线和AUC

基本原理

ROC曲线基于真正例率和假正例率,它展示了在不同分类阈值下,模型在识别正例和负例方面的性能。ROC曲线上的点越靠近左上角,表示模型性能越好。AUC是ROC曲线下的面积,它等于ROC曲线与横轴之间的面积,可以用来比较不同模型的性能,AUC越大表示模型性能越好。

核心点

代码例子

import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import roc_curve, auc# 生成模拟数据集
X, y = make_classification(n_samples=1000, n_features=20, n_classes=2, random_state=42)# 划分训练集和测试集
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)# 训练逻辑回归模型
model = LogisticRegression()
model.fit(X_train, y_train)# 在测试集上做预测
y_pred_proba = model.predict_proba(X_test)[:, 1]# 计算ROC曲线和AUC
fpr, tpr, thresholds = roc_curve(y_test, y_pred_proba)
roc_auc = auc(fpr, tpr)
print("AUC:", roc_auc)# 绘制ROC曲线
plt.figure()
plt.plot(fpr, tpr, color='darkorange', lw=2, label='ROC curve (area = %0.2f)' % roc_auc)
plt.plot([0, 1], [0, 1], color='navy', lw=2, linestyle='--')
plt.xlim([0.0, 1.0])
plt.ylim([0.0, 1.05])
plt.xlabel('False Positive Rate')
plt.ylabel('True Positive Rate')
plt.title('Receiver Operating Characteristic Curve')
plt.legend(loc="lower right")
plt.show()

6.混淆矩阵

基本原理

混淆矩阵用于描述模型在不同类别上的预测结果,帮助评估模型的分类准确性和错误情况。通过混淆矩阵,可以计算出模型的精确率、召回率、F1分数等评估指标,从而更全面地评估模型的性能。

核心点

代码例子

import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import confusion_matrix# 生成模拟数据集
X, y = make_classification(n_samples=1000, n_features=20, n_classes=2, random_state=42)# 划分训练集和测试集
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)# 训练逻辑回归模型
model = LogisticRegression()
model.fit(X_train, y_train)# 在测试集上做预测
y_pred = model.predict(X_test)# 计算混淆矩阵
conf_matrix = confusion_matrix(y_test, y_pred)
print("Confusion Matrix:")
print(conf_matrix)# 绘制混淆矩阵
plt.imshow(conf_matrix, cmap='binary', interpolation='None')
plt.colorbar()
plt.xticks([0, 1])
plt.yticks([0, 1])
plt.xlabel('Predicted Label')
plt.ylabel('True Label')
plt.title('Confusion Matrix')
plt.show()

7.均方误差

基本原理

均方误差衡量了模型的预测值与真实值之间的平均偏差的平方。当模型的预测值与真实值之间的偏差较大时,MSE会增大;而当偏差较小时,MSE会减小。因此,MSE越小表示模型对数据的拟合程度越好。

核心点

代码例子

import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_regression
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error# 生成模拟数据集
X, y = make_regression(n_samples=100, n_features=1, noise=0.1, random_state=42)# 划分训练集和测试集
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)# 训练线性回归模型
model = LinearRegression()
model.fit(X_train, y_train)# 在测试集上做预测
y_pred = model.predict(X_test)# 计算均方误差
mse = mean_squared_error(y_test, y_pred)
print("Mean Squared Error:", mse)# 绘制评估指标
plt.scatter(X_test, y_test, color='black', label='Actual')
plt.plot(X_test, y_pred, color='blue', linewidth=3, label='Predicted')
plt.title('Actual vs Predicted')
plt.xlabel('X')
plt.ylabel('y')
plt.legend()
plt.show()

8.平均绝对误差

基本原理

平均绝对误差衡量了模型的预测值与真实值之间的平均绝对偏差。当模型的预测值与真实值之间的偏差较大时,MAE会增大;而当偏差较小时,MAE会减小。因此,MAE越小表示模型对数据的拟合程度越好。

核心点

代码例子

import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_regression
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_absolute_error# 生成模拟数据集
X, y = make_regression(n_samples=100, n_features=1, noise=0.1, random_state=42)# 划分训练集和测试集
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)# 训练线性回归模型
model = LinearRegression()
model.fit(X_train, y_train)# 在测试集上做预测
y_pred = model.predict(X_test)# 计算平均绝对误差
mae = mean_absolute_error(y_test, y_pred)
print("Mean Absolute Error:", mae)# 绘制评估指标
plt.scatter(X_test, y_test, color='black', label='Actual')
plt.plot(X_test, y_pred, color='blue', linewidth=3, label='Predicted')
plt.title('Actual vs Predicted')
plt.xlabel('X')
plt.ylabel('y')
plt.legend()
plt.show()

9.对数损失

基本原理

对数损失衡量了模型的预测概率分布与真实标签之间的差异。当模型的预测概率分布与真实标签完全一致时,对数损失为0;当二者差异较大时,对数损失增大。因此,对数损失越小表示模型性能越好。

核心点

代码例子

import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_classification
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import log_loss# 生成模拟数据集
X, y = make_classification(n_samples=1000, n_features=20, n_classes=2, random_state=42)# 划分训练集和测试集
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)# 训练逻辑回归模型
model = LogisticRegression()
model.fit(X_train, y_train)# 在测试集上做预测
y_pred_proba = model.predict_proba(X_test)# 计算对数损失
logloss = log_loss(y_test, y_pred_proba)
print("Log Loss:", logloss)# 绘制评估指标
thresholds = np.linspace(0.01, 0.99, 100)
logloss_values = []
for threshold in thresholds:
    y_pred_threshold = (y_pred_proba[:, 1] > threshold).astype(int)
    logloss_values.append(log_loss(y_test, y_pred_threshold))plt.plot(thresholds, logloss_values)
plt.xlabel('Threshold')
plt.ylabel('Log Loss')
plt.title('Log Loss vs Threshold')
plt.show()

10.R平方

基本原理

R平方衡量了模型对数据的拟合程度,其取值范围在0到1之间。当模型对数据的拟合程度越好时,R平方越接近1;当模型对数据的拟合程度较差时,R平方越接近0。当模型的拟合程度与随机平均水平相当时,R平方可能为负。

核心点

代码例子

import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import make_regression
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import r2_score# 生成模拟数据集
X, y = make_regression(n_samples=100, n_features=1, noise=0.1, random_state=42)# 划分训练集和测试集
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)# 训练线性回归模型
model = LinearRegression()
model.fit(X_train, y_train)# 在测试集上做预测
y_pred = model.predict(X_test)# 计算R平方
r2 = r2_score(y_test, y_pred)
print("R-squared:", r2)# 绘制评估指标
plt.scatter(X_test, y_test, color='black', label='Actual')
plt.plot(X_test, y_pred, color='blue', linewidth=3, label='Predicted')
plt.title('Actual vs Predicted')
plt.xlabel('X')
plt.ylabel('y')
plt.legend()
plt.show()

11.交叉验证分数

基本原理

交叉验证分数的原理是通过多次训练和测试模型,利用每次测试集上的性能指标来评估模型的泛化能力。通过多次重复这个过程并计算平均值,可以得到更可靠的性能评估结果。

核心点

代码例子

import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
from sklearn.model_selection import cross_val_score
from sklearn.linear_model import LogisticRegression# 加载数据集
iris = load_iris()
X, y = iris.data, iris.target# 初始化逻辑回归模型
model = LogisticRegression()# 计算交叉验证分数
cv_scores = cross_val_score(model, X, y, cv=5, scoring='accuracy')# 打印交叉验证分数
print("Cross-Validation Scores:", cv_scores)
print("Mean Cross-Validation Score:", np.mean(cv_scores))# 绘制评估指标
plt.plot(range(1, 6), cv_scores, marker='o')
plt.xlabel('Fold')
plt.ylabel('Accuracy')
plt.title('Cross-Validation Scores')
plt.show()

相关文章:

机器学习模型评估指标

模型的评估指标是衡量一个模型应用于对应任务的契合程度,常见的指标有: 准确率(Accuracy): 正确预测的样本数占总样本数的比例。适用于类别分布均衡的数据集。 精确率(Precision): 在所有被预测为正类的样…...

C# 特性

总目录 C# 语法总目录 C# 特性 特性1. 特性类自定义格式2. 特性的位置参数和命名参数3. 特性的目标4. 指定多个特性5. 调用者信息特性 特性 1. 特性类自定义格式 自定义特性类需要继承自Attribute类,特性使用通常都会省略名字后面的Attribute,会自动识…...

Reactor测试框架之StepVerifier

Reactor测试框架之StepVerifier 测试步骤1、创建StepVerifier实例2、添加断言3、执行验证 代码实例 在响应式编程中,Reactor框架提供了StepVerifier测试类,用于对响应式序列进行断言和验证。StepVerifier主要用于对Publisher发出的元素序列进行逐步的、精…...

k8s helm部署kafka集群(KRaft模式)——筑梦之路

添加helm仓库 helm repo add bitnami "https://helm-charts.itboon.top/bitnami" --force-update helm repo add grafana "https://helm-charts.itboon.top/grafana" --force-update helm repo add prometheus-community "https://helm-charts.itboo…...

unity action委托举例

using System; using UnityEngine; public class DelegateExample : MonoBehaviour { void Start() { // 创建委托实例并添加方法 Action myAction Method1; myAction Method2; myAction Method3; // 调用委托,会依次执…...

conda 批量安装requirements.txt文件

conda 批量安装requirements.txt文件中包含的组件依赖 conda install --yes --file requirements.txt #这种执行方式,一遇到安装不上就整体停止不会继续下面的包安装。 下面这条命令能解决上面出现的不执行后续包的问题,需要在CMD窗口执行: 点…...

Flutter:封装一个自用的bottom_picker选择器

效果图&#xff1a;单列选择器 使用bottom_picker: ^2.9.0实现&#xff0c;单列选择器&#xff0c;官方文档 pubspec.yaml # 底部选择 bottom_picker: ^2.9.0picker_utils.dart AppTheme&#xff1a;自定义的颜色 TextWidget.body Text() <Widget>[].toRow Row()下边代…...

Group3r:一款针对活动目录组策略安全的漏洞检测工具

关于Group3r Group3r是一款针对活动目录组策略安全的漏洞检测工具&#xff0c;可以帮助广大安全研究人员迅速枚举目标AD组策略中的相关配置&#xff0c;并识别其中的潜在安全威胁。 Group3r专为红蓝队研究人员和渗透测试人员设计&#xff0c;该工具可以通过将 LDAP 与域控制器…...

支持向量机算法(一):像讲故事一样讲明白它的原理及实现奥秘

1、支持向量机算法介绍 支持向量机&#xff08;Support Vector Machine&#xff0c;SVM&#xff09;是一种基于统计学习理论的模式识别方法&#xff0c; 属于有监督学习模型&#xff0c;主要用于解决数据分类问题。SVM将每个样本数据表示为空间中的点&#xff0c;使不同类别的…...

力扣-数组-35 搜索插入位置

解析 时间复杂度要求&#xff0c;所以使用二分的思想&#xff0c;漏掉了很多问题&#xff0c;这里记录 在left-right1时&#xff0c;已经找到了插入位置&#xff0c;但是没有赋值&#xff0c;然后break&#xff0c;所以导致一直死循环。 if(right - left 1){result right;b…...

List ---- 模拟实现LIST功能的发现

目录 listlist概念 list 中的迭代器list迭代器知识const迭代器写法list访问自定义类型 附录代码 list list概念 list是可以在常数范围内在任意位置进行插入和删除的序列式容器&#xff0c;并且该容器可以前后双向迭代。list的底层是双向链表结构&#xff0c;双向链表中每个元素…...

HashMap和HashTable区别问题

并发&#xff1a;hashMap线程不安全&#xff0c;hashTable线程安全&#xff0c;底层在put操作的方法上加了synchronized 初始化&#xff1a;hashTable初始容量为11&#xff0c;hashmap初始容量为16 阔容因子&#xff1a;阔容因子都是0.75 扩容比例&#xff1a; 补充 hashMap…...

mysql -> 达梦数据迁移(mbp大小写问题兼容)

安装 注意后面初始化需要忽略大小写 初始化程序启动路径 F:\dmdbms\tool dbca.exe 创建表空间&#xff0c;用户&#xff0c;模式 管理工具启动路径 F:\dmdbms\tool manager.exe 创建表空间 创建用户 创建同名模式&#xff0c;指定模式拥有者TEST dts 工具数据迁移 mysql -&g…...

leetcode热门100题1-4

第一天 两数之和 //暴力枚举 class Solution { public:vector<int> twoSum(vector<int>& nums, int target) {int n nums.size();for (int i 0; i < n; i) {for (int j i 1; j < n; j) {if (nums[i] nums[j] target) {return {i, j};}}}return {…...

作业:IO:day2

题目一 第一步&#xff1a;创建一个 struct Student 类型的数组 arr[3],初始化该数组中3个学生的属性 第二步&#xff1a;编写一个叫做save的函数&#xff0c;功能为 将数组arr中的3个学生的所有信息&#xff0c;保存到文件中去&#xff0c;使用fread实现fwrite 第三步&#xf…...

UVM: TLM机制

topic overview 不建议的方法&#xff1a;假如没有TLM TLM TLM 1.0 整个TLM机制下&#xff0c;底层逻辑离不开动作发起者和被动接受者这个底层的模型基础&#xff0c;但实际上&#xff0c;在验证环境中&#xff0c;任何一个组件&#xff0c;都有可能成为动作的发起者&#xff0…...

flink的EventTime和Watermark

时间机制 Flink中的时间机制主要用在判断是否触发时间窗口window的计算。 在Flink中有三种时间概念&#xff1a;ProcessTime、IngestionTime、EventTime。 ProcessTime&#xff1a;是在数据抵达算子产生的时间&#xff08;Flink默认使用ProcessTime&#xff09; IngestionT…...

arcgis的合并、相交、融合、裁剪、联合、标识操作的区别和使用

1、相交 需要输入两个面要素&#xff0c;最终得到的是两个输入面要素相交部分的结果面要素。 2、合并 合并能将两个单独存放的两个要素类的内容&#xff0c;汇集到一个要素类里面。 3、融合 融合能将一个要素类内的所有元素融合成一个整体。 4、裁剪 裁剪需要输入两个面要…...

【Leetcode 热题 100】20. 有效的括号

问题背景 给定一个只包括 ‘(’&#xff0c;‘)’&#xff0c;‘{’&#xff0c;‘}’&#xff0c;‘[’&#xff0c;‘]’ 的字符串 s s s&#xff0c;判断字符串是否有效。 有效字符串需满足&#xff1a; 左括号必须用相同类型的右括号闭合。左括号必须以正确的顺序闭合。每…...

比较procfs 、 sysctl和Netlink

procfs 文件系统和 sysctl 的使用: procfs 文件系统(/proc) procfs 文件系统是 Linux 内核向用户空间暴露内核数据结构以及配置信息的一种方式。`procfs` 的挂载点是 /proc 目录,这个目录中的文件和目录呈现内核的运行状况和配置信息。通过读写这些文件,可以查看和控制内…...

在HarmonyOS ArkTS ArkUI-X 5.0及以上版本中,手势开发全攻略:

在 HarmonyOS 应用开发中&#xff0c;手势交互是连接用户与设备的核心纽带。ArkTS 框架提供了丰富的手势处理能力&#xff0c;既支持点击、长按、拖拽等基础单一手势的精细控制&#xff0c;也能通过多种绑定策略解决父子组件的手势竞争问题。本文将结合官方开发文档&#xff0c…...

Mac软件卸载指南,简单易懂!

刚和Adobe分手&#xff0c;它却总在Library里给你写"回忆录"&#xff1f;卸载的Final Cut Pro像电子幽灵般阴魂不散&#xff1f;总是会有残留文件&#xff0c;别慌&#xff01;这份Mac软件卸载指南&#xff0c;将用最硬核的方式教你"数字分手术"&#xff0…...

OpenLayers 分屏对比(地图联动)

注&#xff1a;当前使用的是 ol 5.3.0 版本&#xff0c;天地图使用的key请到天地图官网申请&#xff0c;并替换为自己的key 地图分屏对比在WebGIS开发中是很常见的功能&#xff0c;和卷帘图层不一样的是&#xff0c;分屏对比是在各个地图中添加相同或者不同的图层进行对比查看。…...

如何在最短时间内提升打ctf(web)的水平?

刚刚刷完2遍 bugku 的 web 题&#xff0c;前来答题。 每个人对刷题理解是不同&#xff0c;有的人是看了writeup就等于刷了&#xff0c;有的人是收藏了writeup就等于刷了&#xff0c;有的人是跟着writeup做了一遍就等于刷了&#xff0c;还有的人是独立思考做了一遍就等于刷了。…...

分布式增量爬虫实现方案

之前我们在讨论的是分布式爬虫如何实现增量爬取。增量爬虫的目标是只爬取新产生或发生变化的页面&#xff0c;避免重复抓取&#xff0c;以节省资源和时间。 在分布式环境下&#xff0c;增量爬虫的实现需要考虑多个爬虫节点之间的协调和去重。 另一种思路&#xff1a;将增量判…...

HDFS分布式存储 zookeeper

hadoop介绍 狭义上hadoop是指apache的一款开源软件 用java语言实现开源框架&#xff0c;允许使用简单的变成模型跨计算机对大型集群进行分布式处理&#xff08;1.海量的数据存储 2.海量数据的计算&#xff09;Hadoop核心组件 hdfs&#xff08;分布式文件存储系统&#xff09;&a…...

android13 app的触摸问题定位分析流程

一、知识点 一般来说,触摸问题都是app层面出问题,我们可以在ViewRootImpl.java添加log的方式定位;如果是touchableRegion的计算问题,就会相对比较麻烦了,需要通过adb shell dumpsys input > input.log指令,且通过打印堆栈的方式,逐步定位问题,并找到修改方案。 问题…...

渗透实战PortSwigger靶场:lab13存储型DOM XSS详解

进来是需要留言的&#xff0c;先用做简单的 html 标签测试 发现面的</h1>不见了 数据包中找到了一个loadCommentsWithVulnerableEscapeHtml.js 他是把用户输入的<>进行 html 编码&#xff0c;输入的<>当成字符串处理回显到页面中&#xff0c;看来只是把用户输…...

OCR MLLM Evaluation

为什么需要评测体系&#xff1f;——背景与矛盾 ​​ 能干的事&#xff1a;​​ 看清楚发票、身份证上的字&#xff08;准确率>90%&#xff09;&#xff0c;速度飞快&#xff08;眨眼间完成&#xff09;。​​干不了的事&#xff1a;​​ 碰到复杂表格&#xff08;合并单元…...

CppCon 2015 学习:Time Programming Fundamentals

Civil Time 公历时间 特点&#xff1a; 共 6 个字段&#xff1a; Year&#xff08;年&#xff09;Month&#xff08;月&#xff09;Day&#xff08;日&#xff09;Hour&#xff08;小时&#xff09;Minute&#xff08;分钟&#xff09;Second&#xff08;秒&#xff09; 表示…...