特征交叉-DeepCross Network学习
一 tensorflow官方实现
tensorflow的官方实现已经是V2版本
class Cross(tf.keras.layers.Layer):"""Cross Layer in Deep & Cross Network to learn explicit feature interactions.Args:projection_dim: int,低秩矩阵的维度,应该小于input_dim/2, 官方建议input_dim/4diag_scale: float,增加交互权重矩阵对角线的缩放因子,主要用于增强低秩分解的稳定性。use_bias: 决定是否在交互计算中加入偏置项。preactivation: 在权重矩阵和输入特征点乘前使用的激活函数。kernel_initializer: Initializer to use on the kernel matrix.bias_initializer: Initializer to use on the bias vector.kernel_regularizer: Regularizer to use on the kernel matrix.bias_regularizer: Regularizer to use on bias vector.Input shape: A tuple of 2 (batch_size, `input_dim`) dimensional inputs.Output shape: A single (batch_size, `input_dim`) dimensional output."""def __init__(self,projection_dim: Optional[int] = None,diag_scale: Optional[float] = 0.0,use_bias: bool = True,preactivation: Optional[Union[str, tf.keras.layers.Activation]] = None,kernel_initializer: Union[Text, tf.keras.initializers.Initializer] = "truncated_normal",bias_initializer: Union[Text,tf.keras.initializers.Initializer] = "zeros",kernel_regularizer: Union[Text, None,tf.keras.regularizers.Regularizer] = None,bias_regularizer: Union[Text, None,tf.keras.regularizers.Regularizer] = None,**kwargs):super(Cross, self).__init__(**kwargs)self._projection_dim = projection_dimself._diag_scale = diag_scaleself._use_bias = use_biasself._preactivation = tf.keras.activations.get(preactivation)self._kernel_initializer = tf.keras.initializers.get(kernel_initializer)self._bias_initializer = tf.keras.initializers.get(bias_initializer)self._kernel_regularizer = tf.keras.regularizers.get(kernel_regularizer)self._bias_regularizer = tf.keras.regularizers.get(bias_regularizer)self._input_dim = Noneself._supports_masking = Trueif self._diag_scale < 0: # pytype: disable=unsupported-operandsraise ValueError("`diag_scale` should be non-negative. Got `diag_scale` = {}".format(self._diag_scale))def build(self, input_shape):# 根据输入特征的维度动态初始化交互权重矩阵last_dim = input_shape[-1] # 获取输入特征维度 input-dimif self._projection_dim is None:# 全参数模式,Dense 层会负责计算 𝑊⋅𝑥self._dense = tf.keras.layers.Dense(last_dim, # 输入等于输出kernel_initializer=_clone_initializer(self._kernel_initializer), # 初始化权重方式bias_initializer=self._bias_initializer, # 偏置初始化方式kernel_regularizer=self._kernel_regularizer, # 权重正则bias_regularizer=self._bias_regularizer, # 偏置正则use_bias=self._use_bias,dtype=self.dtype,activation=self._preactivation, # 激活函数)else:# 低秩分解模式:U 负责将输入降维到 r 维,V 再将降维结果恢复到原始维度self._dense_u = tf.keras.layers.Dense(self._projection_dim,kernel_initializer=_clone_initializer(self._kernel_initializer),kernel_regularizer=self._kernel_regularizer,use_bias=False,dtype=self.dtype,)self._dense_v = tf.keras.layers.Dense(last_dim,kernel_initializer=_clone_initializer(self._kernel_initializer),bias_initializer=self._bias_initializer,kernel_regularizer=self._kernel_regularizer,bias_regularizer=self._bias_regularizer,use_bias=self._use_bias,dtype=self.dtype,activation=self._preactivation,)self.built = Truedef call(self, x0: tf.Tensor, x: Optional[tf.Tensor] = None) -> tf.Tensor:"""Computes the feature cross.Args:x0: The input tensorx: Optional second input tensor. If provided, the layer will computecrosses between x0 and x; if not provided, the layer will computecrosses between x0 and itself.Returns:Tensor of crosses."""if not self.built:self.build(x0.shape)if x is None: # 如果不输入待交叉x,那么就是自己和自己交叉x = x0if x0.shape[-1] != x.shape[-1]:raise ValueError("`x0` and `x` dimension mismatch! Got `x0` dimension {}, and x ""dimension {}. This case is not supported yet.".format(x0.shape[-1], x.shape[-1]))# W * x if self._projection_dim is None:prod_output = self._dense(x)else:prod_output = self._dense_v(self._dense_u(x))# 确保计算结果与层的数据类型(compute_dtype)一致prod_output = tf.cast(prod_output, self.compute_dtype)# 添加对角线缩放if self._diag_scale:prod_output = prod_output + self._diag_scale * xreturn x0 * prod_output + xclass DCN(tfrs.Model):def __init__(self, use_cross_layer, deep_layer_sizes, projection_dim=None):super().__init__()self.embedding_dimension = 32 # embedding维度str_features = ["movie_id", "user_id", "user_zip_code","user_occupation_text"] int_features = ["user_gender", "bucketized_user_age"]self._all_features = str_features + int_featuresself._embeddings = {}# Compute embeddings for string features.# 对于类别特征进行embedding编码for feature_name in str_features:vocabulary = vocabularies[feature_name]self._embeddings[feature_name] = tf.keras.Sequential([tf.keras.layers.StringLookup(vocabulary=vocabulary, mask_token=None),tf.keras.layers.Embedding(len(vocabulary) + 1,self.embedding_dimension)])# Compute embeddings for int features.# 对于数字类型进行编码,这里int,所以也可以embedding,如果是float,这么做就不ok了for feature_name in int_features:vocabulary = vocabularies[feature_name]self._embeddings[feature_name] = tf.keras.Sequential([tf.keras.layers.IntegerLookup(vocabulary=vocabulary, mask_value=None),tf.keras.layers.Embedding(len(vocabulary) + 1, self.embedding_dimension)])# 论文中的cross模块if use_cross_layer:self._cross_layer = tfrs.layers.dcn.Cross(projection_dim=projection_dim,kernel_initializer="glorot_uniform")else:self._cross_layer = None# DNN模块self._deep_layers = [tf.keras.layers.Dense(layer_size, activation="relu")for layer_size in deep_layer_sizes]self._logit_layer = tf.keras.layers.Dense(1)self.task = tfrs.tasks.Ranking(loss=tf.keras.losses.MeanSquaredError(),metrics=[tf.keras.metrics.RootMeanSquaredError("RMSE")])def call(self, features):"""官方实现,这里的来源是DCN-V2,其中探讨了串联和并联以及mixed"""# Concatenate embeddingsembeddings = []for feature_name in self._all_features:embedding_fn = self._embeddings[feature_name]embeddings.append(embedding_fn(features[feature_name]))x = tf.concat(embeddings, axis=1)# Build Cross Networkif self._cross_layer is not None:x = self._cross_layer(x)# Build Deep Network, 串联模式for deep_layer in self._deep_layers:x = deep_layer(x)return self._logit_layer(x)def compute_loss(self, features, training=False):labels = features.pop("user_rating")scores = self(features)return self.task(labels=labels,predictions=scores,)# 使用
cached_train = train.shuffle(100_000).batch(8192).cache()
cached_test = test.batch(4096).cache()def run_models(use_cross_layer, deep_layer_sizes, projection_dim=None, num_runs=5):models = []rmses = []for i in range(num_runs):model = DCN(use_cross_layer=use_cross_layer,deep_layer_sizes=deep_layer_sizes,projection_dim=projection_dim)model.compile(optimizer=tf.keras.optimizers.Adam(learning_rate))models.append(model)model.fit(cached_train, epochs=epochs, verbose=False)metrics = model.evaluate(cached_test, return_dict=True)rmses.append(metrics["RMSE"])mean, stdv = np.average(rmses), np.std(rmses)return {"model": models, "mean": mean, "stdv": stdv}
一. torch实现
代码摘录于deepctr-torch。
import torch
import torch.nn as nn
from .basemodel import BaseModel
from ..inputs import combined_dnn_input
from ..layers import CrossNet, DNNclass CrossNet(nn.Module):"""The Cross Network part of Deep&Cross Network model,which leans both low and high degree cross feature.Input shape- 2D tensor with shape: ``(batch_size, units)``.Output shape- 2D tensor with shape: ``(batch_size, units)``.Arguments- in_features : Positive integer, dimensionality of input features.- input_feature_num: Positive integer, shape(Input tensor)[-1]- layer_num: Positive integer, the cross layer number- parameterization: string, ``"vector"``or ``"matrix"`` , way to parameterize the cross network.- l2_reg: float between 0 and 1. L2 regularizer strength applied to the kernel weights matrix- seed: A Python integer to use as random seed."""def __init__(self, in_features, layer_num=2, parameterization='vector', seed=1024, device='cpu'):super(CrossNet, self).__init__()self.layer_num = layer_numself.parameterization = parameterizationif self.parameterization == 'vector':# weight in DCN. (in_features, 1)self.kernels = nn.Parameter(torch.Tensor(self.layer_num, in_features, 1))elif self.parameterization == 'matrix':# weight matrix in DCN-M. (in_features, in_features)self.kernels = nn.Parameter(torch.Tensor(self.layer_num, in_features, in_features))else: # errorraise ValueError("parameterization should be 'vector' or 'matrix'")self.bias = nn.Parameter(torch.Tensor(self.layer_num, in_features, 1))for i in range(self.kernels.shape[0]):nn.init.xavier_normal_(self.kernels[i])for i in range(self.bias.shape[0]):nn.init.zeros_(self.bias[i])self.to(device)def forward(self, inputs):x_0 = inputs.unsqueeze(2)x_l = x_0for i in range(self.layer_num):if self.parameterization == 'vector':xl_w = torch.tensordot(x_l, self.kernels[i], dims=([1], [0]))dot_ = torch.matmul(x_0, xl_w)x_l = dot_ + self.bias[i] + x_lelif self.parameterization == 'matrix':xl_w = torch.matmul(self.kernels[i], x_l) # W * xi (bs, in_features, 1)dot_ = xl_w + self.bias[i] # W * xi + bx_l = x_0 * dot_ + x_l # x0 · (W * xi + b) + xl Hadamard-productelse: # errorraise ValueError("parameterization should be 'vector' or 'matrix'")x_l = torch.squeeze(x_l, dim=2)return x_lclass DCN(BaseModel):"""Instantiates the Deep&Cross Network architecture. Including DCN-V (parameterization='vector')and DCN-M (parameterization='matrix').:param linear_feature_columns: An iterable containing all the features used by linear part of the model.:param dnn_feature_columns: An iterable containing all the features used by deep part of the model.:param cross_num: positive integet,cross layer number:param cross_parameterization: str, ``"vector"`` or ``"matrix"``, how to parameterize the cross network.:param dnn_hidden_units: list,list of positive integer or empty list, the layer number and units in each layer of DNN:param l2_reg_embedding: float. L2 regularizer strength applied to embedding vector:param l2_reg_cross: float. L2 regularizer strength applied to cross net:param l2_reg_dnn: float. L2 regularizer strength applied to DNN:param init_std: float,to use as the initialize std of embedding vector:param seed: integer ,to use as random seed.:param dnn_dropout: float in [0,1), the probability we will drop out a given DNN coordinate.:param dnn_use_bn: bool. Whether use BatchNormalization before activation or not DNN:param dnn_activation: Activation function to use in DNN:param task: str, ``"binary"`` for binary logloss or ``"regression"`` for regression loss:param device: str, ``"cpu"`` or ``"cuda:0"``:param gpus: list of int or torch.device for multiple gpus. If None, run on `device`. `gpus[0]` should be the same gpu with `device`.:return: A PyTorch model instance."""def __init__(self, linear_feature_columns, dnn_feature_columns, cross_num=2, cross_parameterization='vector',dnn_hidden_units=(128, 128), l2_reg_linear=0.00001, l2_reg_embedding=0.00001, l2_reg_cross=0.00001,l2_reg_dnn=0, init_std=0.0001, seed=1024, dnn_dropout=0, dnn_activation='relu', dnn_use_bn=False,task='binary', device='cpu', gpus=None):super(DCN, self).__init__(linear_feature_columns=linear_feature_columns,dnn_feature_columns=dnn_feature_columns, l2_reg_embedding=l2_reg_embedding,init_std=init_std, seed=seed, task=task, device=device, gpus=gpus)self.dnn_hidden_units = dnn_hidden_unitsself.cross_num = cross_numself.dnn = DNN(self.compute_input_dim(dnn_feature_columns), dnn_hidden_units,activation=dnn_activation, use_bn=dnn_use_bn, l2_reg=l2_reg_dnn, dropout_rate=dnn_dropout,init_std=init_std, device=device)if len(self.dnn_hidden_units) > 0 and self.cross_num > 0:dnn_linear_in_feature = self.compute_input_dim(dnn_feature_columns) + dnn_hidden_units[-1]elif len(self.dnn_hidden_units) > 0:dnn_linear_in_feature = dnn_hidden_units[-1]elif self.cross_num > 0:dnn_linear_in_feature = self.compute_input_dim(dnn_feature_columns)self.dnn_linear = nn.Linear(dnn_linear_in_feature, 1, bias=False).to(device)self.crossnet = CrossNet(in_features=self.compute_input_dim(dnn_feature_columns),layer_num=cross_num, parameterization=cross_parameterization, device=device)self.add_regularization_weight(filter(lambda x: 'weight' in x[0] and 'bn' not in x[0], self.dnn.named_parameters()), l2=l2_reg_dnn)self.add_regularization_weight(self.dnn_linear.weight, l2=l2_reg_linear)self.add_regularization_weight(self.crossnet.kernels, l2=l2_reg_cross)self.to(device)def forward(self, X):logit = self.linear_model(X)sparse_embedding_list, dense_value_list = self.input_from_feature_columns(X, self.dnn_feature_columns,self.embedding_dict)dnn_input = combined_dnn_input(sparse_embedding_list, dense_value_list)if len(self.dnn_hidden_units) > 0 and self.cross_num > 0: # Deep & Crossdeep_out = self.dnn(dnn_input)cross_out = self.crossnet(dnn_input)stack_out = torch.cat((cross_out, deep_out), dim=-1)logit += self.dnn_linear(stack_out)elif len(self.dnn_hidden_units) > 0: # Only Deepdeep_out = self.dnn(dnn_input)logit += self.dnn_linear(deep_out)elif self.cross_num > 0: # Only Crosscross_out = self.crossnet(dnn_input)logit += self.dnn_linear(cross_out)y_pred = self.out(logit)return y_pred
cross 和deep串并联比较
对比维度 | 串联结构 | 并联结构 |
---|---|---|
设计复杂度 | 简单,直观,易实现 | 较复杂,需要对特征维度对齐和拼接有更多设计 |
特征交互建模 | 逐层提取,显式交互优先 | 并行建模,显式和隐式交互并重 |
计算效率 | 更高效,计算开销小 | 计算开销大,特别是高维稀疏特征 |
特征信息保留 | 特征在 Cross Network 后可能丢失部分信息 | 输入特征直接进入两条路径,信息无损 |
模型表现 | 适合低阶显式交互为主的任务 | 适合需要复杂高阶交互的任务 |
适用数据规模 | 小规模特征或低维度特征 | 大规模高维稀疏特征 |
鲁棒性 | 难以避免特征交互部分对后续网络的影响 | 路径独立,干扰小,更鲁棒 |
Reference:
1. DCN-V2论文
2. DCN论文地址
3.视频介绍-wangshusheng
4. tensorflow实现-官方
5. tensorflow实现-官方
6. pytorch实现,deepctr-torch
7. torchrec实现
相关文章:

特征交叉-DeepCross Network学习
一 tensorflow官方实现 tensorflow的官方实现已经是V2版本 class Cross(tf.keras.layers.Layer):"""Cross Layer in Deep & Cross Network to learn explicit feature interactions.Args:projection_dim: int,低秩矩阵的维度,应该小…...

stm32cubemx+VSCODE+GCC+makefile 开发环境搭建
title: stm32cubemxVSCODEGCCmakefile 开发环境搭建 tags: FreertosHalstm32cubeMx 文章目录 内容往期内容导航第一步准备环境vscode 插件插件配置点灯 内容 往期内容导航 第一步准备环境 STM32CubeMXVSCODEMinGWOpenOcdarm-none-eabi-gcc 然后把上面下载的软件 3 4 5 bin 文…...
Go语言中的Defer机制详解与示例
在Go语言中,defer是一个关键字,用于确保资源的清理和释放,特别是在函数中创建的资源。defer语句会将其后的函数调用推迟到包含它的函数即将返回时执行。这使得defer成为处理文件关闭、数据库连接释放、解锁等资源清理操作的理想选择。 Defer…...

H.265流媒体播放器EasyPlayer.js H5流媒体播放器如何验证视频播放是否走硬解
随着技术的不断进步和5G网络的推广,中国流媒体播放器行业市场规模以及未来发展趋势都将持续保持稳定的增长,并将在未来几年迎来新的发展机遇。流媒体播放器将继续作为连接内容创作者和观众的重要桥梁,推动数字媒体产业的创新和发展。 EasyPla…...
ms-hot目录
1. ms-hot1...

vulfocus在线靶场:骑士cms_cve_2020_35339:latest 速通手册
目录 一、启动环境,访问页面,ip:端口号/index.php?madmin,进入后台管理页面,账号密码都是adminadmin 二、进入之后,根据图片所示,地址后追加一下代码,保存修改 三、新开标签页访问:①ip:端…...

AI Large Language Model
AI 的 Large Language model LLM , 大语言模型: 是AI的模型,专门设计用来处理自然语言相关任务。它们通过深度学习和庞大的训练数据集,在理解和生成自然语言文本方面表现出色。常见的 LLM 包括 OpenAI 的 GPT 系列、Google 的 PaLM 和 Meta…...
React Native的`react-native-reanimated`库中的`useAnimatedStyle`钩子来创建一个动画样式
React Native的react-native-reanimated库中的useAnimatedStyle钩子来创建一个动画样式,用于一个滑动视图的每个项目(SliderItem)。useAnimatedStyle钩子允许你根据动画值(在这个例子中是scrollX)来动态地设置组件的样…...

FastJson反序列化漏洞(CVE-2017-18349)
漏洞原理 原理就不多说了,可以去看我这篇文章,已经写得很详细了。 Java安全—log4j日志&FastJson序列化&JNDI注入-CSDN博客 影响版本 FastJson<1.2.24 复现过程 这里我是用vulfocus.cn这个漏洞平台去复现的,比较方便&#x…...

【优选算法篇】分治乾坤,万物归一:在重组中窥见无声的秩序
文章目录 分治专题(二):归并排序的核心思想与进阶应用前言、第二章:归并排序的应用与延展2.1 归并排序(medium)解法(归并排序)C 代码实现易错点提示时间复杂度和空间复杂度 2.2 数组…...

C++:探索AVL树旋转的奥秘
文章目录 前言 AVL树为什么要旋转?一、插入一个值的大概过程1. 插入一个值的大致过程2. 平衡因子更新原则3. 旋转处理的目的 二、左单旋1. 左单旋旋转方式总处理图2. 左单旋具体会遇到的情况3. 左单旋代码总结 三、右单旋1. 右单旋旋转方式总处理图2. 右单旋具体会遇…...

2. Django中的URL调度器 (自定义路径转换器)
在 Django 中,URL 路由通常使用路径转换器(path converters)来匹配和捕获 URL 中的特定模式,例如整数、字符串或 slug 等。默认情况下,Django 提供了一些内置的路径转换器,如 <int>、<str>、&l…...
深度学习:神经网络中线性层的使用
深度学习:神经网络中线性层的使用 在神经网络中,线性层(也称为全连接层或密集层)是基础组件之一,用于执行输入数据的线性变换。通过这种变换,线性层可以重新组合输入数据的特征,并将其映射到新…...
【刷题】算法设计题+程序设计题【2】2019-2024
11.202019年真题*2BST二叉排序树分裂、双向冒泡排序 2019 真题 【2019 1】编写算法,将一棵二叉排序树 分解成两棵二叉排序树 t1和t2,使得t1中的所有结点关键字的值都小于x,t2中所有结点关键字都大于x。 typedef struct BSTNode{int data;str…...
搭建es环境
centos7搭建elasticsearch环境 首先考虑使用 Docker 来安装 Elasticsearch、Kibana 和 Logstash。在安装过程中,可能会遇到一些问题,但通过适当的方法可以解决。 docker pull docker.elastic.co/elasticsearch/elasticsearch:8.14.3 首先创建一个网络&a…...
阿里云和七牛云对象存储区别和实现
七牛云对象存储操作(QiniuUtil) 配置:使用 com.qiniu.storage.Configuration 类来配置上传设置,如指定区域(Region)和分片上传版本。上传管理器:通过 UploadManager 类来处理文件上传。认证&am…...

uniapp微信小程序接入airkiss插件进行WIFI配网
本文可参考uniapp小程序插件 一.申请插件 微信公众平台设置页链接:微信公众平台 登录您的小程序微信公众平台,进入设置页,在第三方设置->插件管理->添加插件中申请AiThinkerAirkissforWXMini插件,申请的插件appId为【wx6…...

03 —— Webpack 自动生成 html 文件
HtmlWebpackPlugin | webpack 中文文档 | webpack中文文档 | webpack中文网 安装 npm install --save-dev html-webpack-plugin 下载html-webpack-plugin本地软件包 npm i html-webpack-plugin --save-dev 配置webpack.config.js让webpack拥有插件功能 const HtmlWebpack…...

Python毕业设计选题:基于python的豆瓣电影数据分析可视化系统-flask+spider
开发语言:Python框架:flaskPython版本:python3.7.7数据库:mysql 5.7数据库工具:Navicat11开发软件:PyCharm 系统展示 系统首页 个人中心 管理员登录界面 管理员功能界面 电影管理 用户管理 系统管理 摘要…...
抽象类能使用final修饰吗?
不能。 在java中,抽象类不能使用final修饰。原因是final修饰符用于类不能被继承,而抽象类的主要用途就是被继承以提供基础实现或定义抽象方法供子类实现。这两个互相矛盾,因此不能同时使用。 具体解释 abstract修饰符:用于定义一个抽象类&…...

深入解析C++中的extern关键字:跨文件共享变量与函数的终极指南
🚀 C extern 关键字深度解析:跨文件编程的终极指南 📅 更新时间:2025年6月5日 🏷️ 标签:C | extern关键字 | 多文件编程 | 链接与声明 | 现代C 文章目录 前言🔥一、extern 是什么?&…...
JVM暂停(Stop-The-World,STW)的原因分类及对应排查方案
JVM暂停(Stop-The-World,STW)的完整原因分类及对应排查方案,结合JVM运行机制和常见故障场景整理而成: 一、GC相关暂停 1. 安全点(Safepoint)阻塞 现象:JVM暂停但无GC日志,日志显示No GCs detected。原因:JVM等待所有线程进入安全点(如…...
CMake控制VS2022项目文件分组
我们可以通过 CMake 控制源文件的组织结构,使它们在 VS 解决方案资源管理器中以“组”(Filter)的形式进行分类展示。 🎯 目标 通过 CMake 脚本将 .cpp、.h 等源文件分组显示在 Visual Studio 2022 的解决方案资源管理器中。 ✅ 支持的方法汇总(共4种) 方法描述是否推荐…...
【碎碎念】宝可梦 Mesh GO : 基于MESH网络的口袋妖怪 宝可梦GO游戏自组网系统
目录 游戏说明《宝可梦 Mesh GO》 —— 局域宝可梦探索Pokmon GO 类游戏核心理念应用场景Mesh 特性 宝可梦玩法融合设计游戏构想要素1. 地图探索(基于物理空间 广播范围)2. 野生宝可梦生成与广播3. 对战系统4. 道具与通信5. 延伸玩法 安全性设计 技术选…...
【SSH疑难排查】轻松解决新版OpenSSH连接旧服务器的“no matching...“系列算法协商失败问题
【SSH疑难排查】轻松解决新版OpenSSH连接旧服务器的"no matching..."系列算法协商失败问题 摘要: 近期,在使用较新版本的OpenSSH客户端连接老旧SSH服务器时,会遇到 "no matching key exchange method found", "n…...

初探用uniapp写微信小程序遇到的问题及解决(vue3+ts)
零、关于开发思路 (一)拿到工作任务,先理清楚需求 1.逻辑部分 不放过原型里说的每一句话,有疑惑的部分该问产品/测试/之前的开发就问 2.页面部分(含国际化) 整体看过需要开发页面的原型后,分类一下哪些组件/样式可以复用,直接提取出来使用 (时间充分的前提下,不…...

实现p2p的webrtc-srs版本
1. 基本知识 1.1 webrtc 一、WebRTC的本质:实时通信的“网络协议栈”类比 将WebRTC类比为Linux网络协议栈极具洞察力,二者在架构设计和功能定位上高度相似: 分层协议栈架构 Linux网络协议栈:从底层物理层到应用层(如…...

【Redis】Redis 的持久化策略
目录 一、RDB 定期备份 1.2 触发方式 1.2.1 手动触发 1.2.2.1 自动触发 RDB 持久化机制的场景 1.2.2.2 检查是否触发 1.2.2.3 线上运维配置 1.3 检索工具 1.4 RDB 备份实现原理 1.5 禁用 RDB 快照 1.6 RDB 优缺点分析 二、AOF 实时备份 2.1 配置文件解析 2.2 开启…...
Steam爬取相关游戏评测
## 因为是第一次爬取Steam。所以作为一次记录发出;有所错误欢迎指出。 无时间指定爬取 import requests import time import csv import osappid "553850" # 这里你也可以改成 #appid int(input()) max_reviews 10000 # 想爬多少条 # max_reviews…...

【立体匹配】:双目立体匹配SGBM:(1)运行
注:这是一个专题,我会一步步介绍SGBM的实现,按照我的使用和优化过程逐步改善算法,附带实现方法 系列文章【立体匹配】:双目立体匹配SGBM:(1)运行 【立体匹配】:双目立体匹…...