全国大学生数据建模比赛——深度学习

news2024/9/22 15:43:11

全国大学生数学建模比赛中,深度学习可以成为解决复杂问题的有力手段。

一、深度学习的优势在比赛中的体现

  1. 强大的模式识别能力:深度学习模型,如卷积神经网络(CNN)和循环神经网络(RNN),在处理图像、文本、时间序列等数据方面表现出卓越的性能。在数学建模比赛中,可能会遇到需要对图像进行分类、对文本进行情感分析或对时间序列数据进行预测等问题,深度学习可以有效地提取数据中的特征,提高模型的准确性。
  2. 自动特征提取:与传统的机器学习方法相比,深度学习模型能够自动从原始数据中学习特征,无需人工设计特征。这在处理大规模、高维度数据时尤为重要,可以节省大量的时间和精力。
  3. 良好的泛化能力:经过充分训练的深度学习模型通常具有较好的泛化能力,能够在新的数据上表现出良好的性能。这对于数学建模比赛中未知的测试数据非常关键,能够提高模型的可靠性和实用性。

二、在比赛中应用深度学习的步骤

  1. 问题理解与数据收集:

    • 首先,深入理解比赛问题的背景和要求,确定需要解决的具体问题。
    • 然后,收集与问题相关的各种数据,包括训练数据和测试数据。数据的质量和数量对深度学习模型的性能至关重要。
  2. 数据预处理:

    • 对收集到的数据进行预处理,包括数据清洗、归一化、标准化等操作。对于图像数据,可能还需要进行裁剪、缩放、旋转等增强操作,以增加数据的多样性。
    • 将数据划分为训练集、验证集和测试集,用于模型的训练、调参和评估。
  3. 模型选择与搭建:

    • 根据问题的特点和数据的类型,选择合适的深度学习模型。例如,对于图像分类问题,可以选择 CNN;对于文本处理问题,可以选择 RNN 或 Transformer 架构。
    • 使用深度学习框架,如 TensorFlow、PyTorch 等,搭建所选的模型。可以从现有的开源模型开始,根据需要进行修改和调整。
  4. 模型训练与调参:

    • 使用训练集对模型进行训练,调整模型的参数,以最小化损失函数。可以采用随机梯度下降等优化算法,设置适当的学习率、批次大小等参数。
    • 在训练过程中,使用验证集对模型进行评估,及时调整模型的结构和参数,防止过拟合。可以采用正则化、Dropout 等技术来提高模型的泛化能力。
  5. 模型评估与改进:

    • 使用测试集对训练好的模型进行最终评估,计算模型的准确率、召回率、F1 值等指标,评估模型的性能。
    • 根据评估结果,分析模型存在的问题,如过拟合、欠拟合等,采取相应的改进措施,如增加数据量、调整模型结构、改进训练方法等。

三、注意事项与挑战

  1. 计算资源需求:深度学习模型通常需要大量的计算资源,包括 GPU 等硬件设备。在比赛中,可能需要合理安排计算资源,提高计算效率。
  2. 数据量要求:深度学习模型需要大量的训练数据才能发挥出良好的性能。在数据量有限的情况下,可以考虑采用数据增强、迁移学习等技术来提高模型的性能。
  3. 模型解释性:深度学习模型通常具有较高的复杂性,难以解释其决策过程。在比赛中,可能需要对模型的结果进行解释和说明,以增强模型的可信度。
  4. 时间限制:数学建模比赛通常有时间限制,需要在有限的时间内完成模型的训练和评估。因此,需要合理安排时间,选择合适的模型和算法,提高建模效率。

总之,在全国大学生数学建模比赛中,深度学习可以为解决复杂问题提供强大的工具。但在应用深度学习时,需要充分考虑问题的特点、数据的类型和计算资源等因素,选择合适的模型和算法,并进行充分的实验和调参,以提高模型的性能和可靠性。

例题案例:

1. TensorFlow框架的基本使用(5-1)

  1. 获取训练数据

构建一个简单的线性模型:W,b为参数,W=2,b=1,运用tf.random.normal() 产生1000个随机数,产生x,y数据。

用matplotlib库,用蓝色绘制训练数据。

  1. 定义模型

通过对样本数据的离散图可以判断,呈线性规律变化,因此可以建立一个线性模型,即 ,把该线性模型定义为一个简单的类,里面封装了变量和计算,变量设置用tf.Variable()。

  1. 定义损失函数

损失函数是衡量给定输入的模型输出与期望输出的匹配程度,采用均方误差(L2范数损失函数)。

  1. 模型训练

运用数据和模型来训练得到模型的变量(W和b),观察W和b的变化(使用matplotlib绘制W和b的变化情况曲线)。

import tensorflow as tf
import matplotlib.pyplot as plt

# 步骤1:生成训练数据
num_samples = 1000
true_W = 2
true_b = 1
inputs = tf.random.normal(shape=(num_samples,))
noise = tf.random.normal(shape=(num_samples,))
outputs = inputs * true_W + true_b + noise

# 绘制训练数据
plt.scatter(inputs, outputs, c='b', label='Training data')
plt.xlabel('Input')
plt.ylabel('Output')
plt.legend()
plt.show()

# 步骤2:定义模型
class LinearModel(tf.Module):
    def __init__(self):
        self.W = tf.Variable(tf.random.normal(shape=(), stddev=0.1))
        self.b = tf.Variable(tf.random.normal(shape=(), stddev=0.1))

    def __call__(self, x):
        return self.W * x + self.b

# 步骤3:定义损失函数
def loss(y_true, y_pred):
    return tf.reduce_mean(tf.square(y_true - y_pred))

# 步骤4:模型训练
model = LinearModel()
learning_rate = 0.1
epochs = 50
history_W, history_b = [], []

for epoch in range(epochs):
    with tf.GradientTape() as tape:
        current_loss = loss(outputs, model(inputs))
    dW, db = tape.gradient(current_loss, [model.W, model.b])
    model.W.assign_sub(learning_rate * dW)
    model.b.assign_sub(learning_rate * db)
    history_W.append(model.W.numpy())
    history_b.append(model.b.numpy())

# 可视化W和b的变化
plt.plot(history_W, label='W')
plt.plot(history_b, label='b')
plt.xlabel('Epochs')
plt.ylabel('Values')
plt.legend()
plt.show()

 

 

2. 多层神经网络分类(5-2)

  1. 数据获取与预处理

MNIST 数据集来自美国国家标准与技术研究所, National Institute of Standards and Technology (NIST). 训练集 (training set) 由来自 250 个不同人手写的数字构成, 其中 50% 是高中学生, 50% 来自人口普查局 (the Census Bureau) 的工作人员. 测试集(test set) 也是同样比例的手写数字数据。

每张图像的大小都是28x28像素。MNIST数据集有60000张图像用于训练和10000张图像用于测试,其中每张图像都被标记了对应的数字(0-9)。

  1. 加载数据集
  2. 查看数据集

  1. 归一化处理

  1. 模型构建
  1. 模型定义

  1. 编译模型

  1. 输出模型参数

  1. 模型训练
  1. 训练

  1. 获取训练历史数据中的各指标值

  1. 绘制指标在训练过程中的变化图

  1. 模型评估

使用测试集对模型进行评估

代码:

import tensorflow as tf
import numpy as np
import matplotlib.pyplot as plt
# 加载MNIST数据集
mnist = tf.keras.datasets.mnist
(x_train, y_train), (x_test, y_test) = mnist.load_data()
# 输出第一张图片和对应的标签
# 查看训练集中的一张图像和对应的标签
plt.imshow(x_train[0], cmap='gray')
plt.title(f"Label: {x_train[0]}")
plt.axis('off')
plt.show()
# 查看测试集中的一张图像和对应的标签
plt.imshow(x_test[0], cmap='gray')
plt.title(f"Label: {x_test[0]}")
plt.axis('off')
plt.show()
# 对输入数据进行归一化处理
x_train = x_train / 255.0
x_test = x_test / 255.0
# 定义显示图片的函数
def plot_images(images):
    plt.imshow(images, cmap='binary')
    plt.show()
# 构建神经网络模型
model = tf.keras.models.Sequential([
    tf.keras.layers.Flatten(input_shape=(28,28)),  # 将输入展平为一维数组
    tf.keras.layers.Dense(256, activation='relu'),  # 全连接层,使用ReLU激活函数
    tf.keras.layers.Dropout(0.2),  # Dropout层,可以防止过拟合
    tf.keras.layers.Dense(128, activation='relu'), # 全连接层,使用ReLU激活函数
    tf.keras.layers.Dense(64, activation='relu'),
    tf.keras.layers.Dense(10, activation='softmax')  # 输出层,使用softmax激活函数输出分类概率
])
# 编译模型
model.compile(optimizer='adam',
              loss='sparse_categorical_crossentropy',  # 使用交叉熵损失函数
              metrics=['sparse_categorical_accuracy'])

# 输出模型结构
model.summary()
# 训练模型
history = model.fit(x_train, y_train, epochs=50, validation_split=0.2, verbose=1)
train_loss = history.history['loss']
val_loss = history.history['val_loss']
train_accuracy = history.history['sparse_categorical_accuracy']
val_accuracy = history.history['val_sparse_categorical_accuracy']
# 生成图形
plt.figure(figsize=(12, 4))
# Loss 图
plt.subplot(1, 2, 1)
plt.plot(train_loss, label='Training Loss')
plt.plot(val_loss, label='Validation Loss')
plt.title('Training and Validation Loss')
plt.xlabel('Epochs')
plt.ylabel('Loss')
plt.legend()
# Accuracy 图
plt.subplot(1, 2, 2)
plt.plot(train_accuracy, label='Training Accuracy')
plt.plot(val_accuracy, label='Validation Accuracy')
plt.title('Training and Validation Accuracy')
plt.xlabel('Epochs')
plt.ylabel('Accuracy')
plt.legend()
plt.show()


test_loss, test_accuracy = model.evaluate(x_test, y_test)
print(f"Test Loss: {test_loss}")
print(f"Test Accuracy: {test_accuracy}")

 

 

3. 多层神经网络回归(5-3)

  1. 数据获取与预处理

Auto MPG 数据集,它记录了各种汽车效能指标MPG(Mile Per Gallon)与气缸数、重量、马力等因素的真实数据。除了产地的数字字段表示类别外,其他字段都是数值类型。对于产地地段,1 表示美国,2 表示欧洲,3 表示日本。

  1. 加载数据集

column_names = ['MPG','Cylinders','Displacement','Horsepower','Weight',

                'Acceleration', 'Model Year', 'Origin']       #选定需要的数据特征

raw_dataset = pd.read_csv('./data/auto-mpg.data', names=column_names,

                      na_values = "?", comment='\t',

                      sep=" ", skipinitialspace=True)    #读取刚下载的数据

  1. 数据清洗

统计数据集中各列中空值的个数,并删除包含空值的行。

  1. 将Origin列转换为one-hot(独热)编码。
  2. 数据探索
  • 使用describe方法查看数据的统计指标
  • 使用seaborn库中pairplot方法绘制"MPG", "Cylinders", "Displacement", "Weight"四列的联合分布图
  1. 数据标准化

labels = dataset.pop('MPG')  #从数据集中取出目标值MPG

#数据标准化

from sklearn.preprocessing import StandardScaler

def norm(x):

  return (x - train_stats['mean']) / train_stats['std'] #标准化公式

scaler = StandardScaler()

normed_dataset = scaler.fit_transform(dataset)

  1. 划分训练集与测试集

#拆分训练数据集和测试数据集,将数据集拆分为一个训练数据集和一个测试数据集。

X_train, X_test, Y_train, Y_test = train_test_split(normed_dataset,labels,test_size=0.2,random_state=0)

  1. 模型构建
  1. 模型定义

model = tf.keras.Sequential([

    tf.keras.layers.Dense(64, activation='relu', input_shape=[X_train.shape[1]]),

    tf.keras.layers.Dense(64, activation='relu'),

    tf.keras.layers.Dense(1)

  ])

  1. 编译模型

loss='mse'  #损失用mse

optimizer='adam'

metrics=['mae', 'mse'])

  1. 输出模型参数

print(model.summary())

  1. 模型训练
  1. 训练

epochs=100,

validation_split = 0.2

verbose=1

  1. 获取训练历史数据中的各指标值

mae = history.history['mae']

val_mae = history.history['val_mae']

mse = history.history['mse']

val_mse = history.history['val_mse']

  1. 绘制指标在训练过程中的变化图

plt.figure(1)

plt.plot(mae, label='Training MAE')

plt.plot(val_mae, label='Validation MAE')

plt.title('Training and Validation MAE')

plt.legend()

 

plt.figure(2)

plt.plot(mse, label='Training MSE')

plt.plot(val_mse, label='Validation MSE')

plt.title('Training and Validation MSE')

plt.legend()

plt.show()

  1. 模型评估

使用测试集对模型进行评估

# 测试模型

model.evaluate(X_test, Y_test, verbose=1)

代码:

# -*- coding: utf-8 -*-
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import tensorflow as tf
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
# 加载数据集
column_names = ['MPG','Cylinders','Displacement','Horsepower','Weight',
                'Acceleration', 'Model Year', 'Origin']
raw_dataset = pd.read_csv('auto-mpg.data', names=column_names,
                      na_values = "?", comment='\t',
                      sep=" ", skipinitialspace=True)
print(raw_dataset)
# 数据清洗
dataset = raw_dataset.dropna()
# 将Origin列转换为one-hot编码
dataset['Origin'] = dataset['Origin'].map({1: 'USA', 2: 'Europe', 3: 'Japan'})
dataset = pd.get_dummies(dataset, columns=['Origin'], prefix='', prefix_sep='')
# 数据探索
print(dataset.describe())
sns.pairplot(dataset[['MPG', 'Cylinders', 'Displacement', 'Weight']], diag_kind='kde')
# 数据标准化
labels = dataset.pop('MPG')
train_stats = dataset.describe().transpose()
def norm(x):
    return (x - train_stats['mean']) / train_stats['std']
normed_dataset = norm(dataset)
# 划分训练集与测试集
X_train, X_test, Y_train, Y_test = train_test_split(normed_dataset, labels, test_size=0.2, random_state=0)
# 模型构建
model = tf.keras.Sequential([
    tf.keras.layers.Dense(64, activation='relu', input_shape=[X_train.shape[1]]),
    tf.keras.layers.Dropout(0.3),
    tf.keras.layers.Dense(64, activation='relu'),
    tf.keras.layers.Dropout(0.2),
    tf.keras.layers.Dense(64, activation='relu'),
    tf.keras.layers.Dense(1)
])
# 编译模型
model.compile(loss='mse', optimizer='adam', metrics=['mae', 'mse'])

# 输出模型参数
print(model.summary())
# 模型训练
history = model.fit(X_train, Y_train, epochs=1000, validation_split=0.3, verbose=1)
# 获取训练历史数据中的各指标值
mae = history.history['mae']
val_mae = history.history['val_mae']
mse = history.history['mse']
val_mse = history.history['val_mse']
plt.figure()
plt.plot(mae, label='Training MAE')
plt.plot(val_mae, label='Validation MAE')
plt.title('Training and Validation MAE')
plt.legend()
plt.show()
plt.figure()
plt.plot(mse, label='Training MSE')
plt.plot(val_mse, label='Validation MSE')
plt.title('Training and Validation MSE')
plt.legend()
plt.show()
# 模型评估
h1=model.evaluate(X_test, Y_test, verbose=1)
print(h1)

 

 

 

数据集例样:

18.0   8   307.0      130.0      3504.      12.0   70  1    "chevrolet chevelle malibu"
15.0   8   350.0      165.0      3693.      11.5   70  1    "buick skylark 320"
18.0   8   318.0      150.0      3436.      11.0   70  1    "plymouth satellite"
16.0   8   304.0      150.0      3433.      12.0   70  1    "amc rebel sst"
17.0   8   302.0      140.0      3449.      10.5   70  1    "ford torino"
15.0   8   429.0      198.0      4341.      10.0   70  1    "ford galaxie 500"
14.0   8   454.0      220.0      4354.       9.0   70  1    "chevrolet impala"
14.0   8   440.0      215.0      4312.       8.5   70  1    "plymouth fury iii"
14.0   8   455.0      225.0      4425.      10.0   70  1    "pontiac catalina"
15.0   8   390.0      190.0      3850.       8.5   70  1    "amc ambassador dpl"
15.0   8   383.0      170.0      3563.      10.0   70  1    "dodge challenger se"
14.0   8   340.0      160.0      3609.       8.0   70  1    "plymouth 'cuda 340"
15.0   8   400.0      150.0      3761.       9.5   70  1    "chevrolet monte carlo"
14.0   8   455.0      225.0      3086.      10.0   70  1    "buick estate wagon (sw)"
24.0   4   113.0      95.00      2372.      15.0   70  3    "toyota corona mark ii"
22.0   6   198.0      95.00      2833.      15.5   70  1    "plymouth duster"
18.0   6   199.0      97.00      2774.      15.5   70  1    "amc hornet"
21.0   6   200.0      85.00      2587.      16.0   70  1    "ford maverick"
27.0   4   97.00      88.00      2130.      14.5   70  3    "datsun pl510"
26.0   4   97.00      46.00      1835.      20.5   70  2    "volkswagen 1131 deluxe sedan"
25.0   4   110.0      87.00      2672.      17.5   70  2    "peugeot 504"
24.0   4   107.0      90.00      2430.      14.5   70  2    "audi 100 ls"
25.0   4   104.0      95.00      2375.      17.5   70  2    "saab 99e"
26.0   4   121.0      113.0      2234.      12.5   70  2    "bmw 2002"
21.0   6   199.0      90.00      2648.      15.0   70  1    "amc gremlin"
10.0   8   360.0      215.0      4615.      14.0   70  1    "ford f250"
10.0   8   307.0      200.0      4376.      15.0   70  1    "chevy c20"
11.0   8   318.0      210.0      4382.      13.5   70  1    "dodge d200"
9.0    8   304.0      193.0      4732.      18.5   70  1    "hi 1200d"
27.0   4   97.00      88.00      2130.      14.5   71  3    "datsun pl510"
28.0   4   140.0      90.00      2264.      15.5   71  1    "chevrolet vega 2300"
25.0   4   113.0      95.00      2228.      14.0   71  3    "toyota corona"
25.0   4   98.00      ?          2046.      19.0   71  1    "ford pinto"
19.0   6   232.0      100.0      2634.      13.0   71  1    "amc gremlin"
16.0   6   225.0      105.0      3439.      15.5   71  1    "plymouth satellite custom"
17.0   6   250.0      100.0      3329.      15.5   71  1    "chevrolet chevelle malibu"
19.0   6   250.0      88.00      3302.      15.5   71  1    "ford torino 500"
18.0   6   232.0      100.0      3288.      15.5   71  1    "amc matador"
14.0   8   350.0      165.0      4209.      12.0   71  1    "chevrolet impala"
14.0   8   400.0      175.0      4464.      11.5   71  1    "pontiac catalina brougham"
14.0   8   351.0      153.0      4154.      13.5   71  1    "ford galaxie 500"
14.0   8   318.0      150.0      4096.      13.0   71  1    "plymouth fury iii"
12.0   8   383.0      180.0      4955.      11.5   71  1    "dodge monaco (sw)"
13.0   8   400.0      170.0      4746.      12.0   71  1    "ford country squire (sw)"
13.0   8   400.0      175.0      5140.      12.0   71  1    "pontiac safari (sw)"
18.0   6   258.0      110.0      2962.      13.5   71  1    "amc hornet sportabout (sw)"
22.0   4   140.0      72.00      2408.      19.0   71  1    "chevrolet vega (sw)"
19.0   6   250.0      100.0      3282.      15.0   71  1    "pontiac firebird"
18.0   6   250.0      88.00      3139.      14.5   71  1    "ford mustang"
23.0   4   122.0      86.00      2220.      14.0   71  1    "mercury capri 2000"
28.0   4   116.0      90.00      2123.      14.0   71  2    "opel 1900"
30.0   4   79.00      70.00      2074.      19.5   71  2    "peugeot 304"
30.0   4   88.00      76.00      2065.      14.5   71  2    "fiat 124b"
31.0   4   71.00      65.00      1773.      19.0   71  3    "toyota corolla 1200"
35.0   4   72.00      69.00      1613.      18.0   71  3    "datsun 1200"
27.0   4   97.00      60.00      1834.      19.0   71  2    "volkswagen model 111"
26.0   4   91.00      70.00      1955.      20.5   71  1    "plymouth cricket"
24.0   4   113.0      95.00      2278.      15.5   72  3    "toyota corona hardtop"
25.0   4   97.50      80.00      2126.      17.0   72  1    "dodge colt hardtop"
23.0   4   97.00      54.00      2254.      23.5   72  2    "volkswagen type 3"
20.0   4   140.0      90.00      2408.      19.5   72  1    "chevrolet vega"
21.0   4   122.0      86.00      2226.      16.5   72  1    "ford pinto runabout"
13.0   8   350.0      165.0      4274.      12.0   72  1    "chevrolet impala"
14.0   8   400.0      175.0      4385.      12.0   72  1    "pontiac catalina"
15.0   8   318.0      150.0      4135.      13.5   72  1    "plymouth fury iii"
14.0   8   351.0      153.0      4129.      13.0   72  1    "ford galaxie 500"
17.0   8   304.0      150.0      3672.      11.5   72  1    "amc ambassador sst"
11.0   8   429.0      208.0      4633.      11.0   72  1    "mercury marquis"
13.0   8   350.0      155.0      4502.      13.5   72  1    "buick lesabre custom"
12.0   8   350.0      160.0      4456.      13.5   72  1    "oldsmobile delta 88 royale"
13.0   8   400.0      190.0      4422.      12.5   72  1    "chrysler newport royal"
19.0   3   70.00      97.00      2330.      13.5   72  3    "mazda rx2 coupe"

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

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

相关文章

Linux 系统进程管理实战

今天给伙伴们分享一下Linux 系统进程管理,希望看了有所收获。 我是公众号「想吃西红柿」「云原生运维实战派」作者,对云原生运维感兴趣,也保持时刻学习,后续会分享工作中用到的运维技术,在运维的路上得到支持和共同进步…

系统分析师6:计算机网络

文章目录 1 OSI/RM七层模型2 TCP/IP协议族2.1 常见TCP/IP协议基础2.2 DNS 3 IP地址4 网络规划与设计4.1 网络规划与设计的阶段4.2 层次化网络设计 5 综合布线6 网络存储技术-Raid7 网络接入技术 1 OSI/RM七层模型 集线器多个端口属于同一个冲突域; 交换机多个端口属…

nexus 清理 docker 镜像

下载配置 nexus-cli 看网上文档都用如下地址,但现在已经不能下载: wget https://s3.eu-west-2.amazonaws.com/nexus-cli/1.0.0-beta/linux/nexus-cli chmod x nexus-cli 在 github 上下载: wget https://github.com/heyonggs/nexus-cli/r…

【202408最新】Anaconda+VSCode+CUDA+Pytorch安装配置保姆级教程

最近新换了电脑,又开始从头配置代码环境,到处看教程真的一个头两个大,干脆自己整理了一下,方便以后一站式重装。也提供给大家参考。 1.Anaconda下载安装 Anaconda和Python是替代品(也不是),下…

uniapp引入最新版Animate.css及使用示例

亲测可用,不好用请移至评论区揍我 动画库官网:https://animate.style/ cdn地址:https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css(截至目前最新版为:v4.1.1) 1. 将css下载后导入项目static目录中 2. 重要!修改下载的css文件内容 文件内容如…

Audi TT MK1保险丝盒布局说明书

Audi TT MK1保险丝盒布局说明书 保险丝序号额定最大电流(A)对应功能描述110加热式洗涤器喷嘴、加热式后视镜210转向灯35车牌灯45通用电气,导航57.5停车辅助65中控锁系统710倒车灯85电话95防抱死制动系统/ESP1015发动机正时:汽油机115仪表盘、换档锁、自动&#xff0…

了解内网穿透以及简单应用

因特网概述 节点(Node):网络中的节点可以是计算机(笔记本电脑、台式电脑,服务器等)、网络互联设备(集线器、交换机,路由器等)、其他具有联网功能的设备 (网络…

TCP 之 三次握手 (面经计网篇)

这是tcp 简历连接的三次握手方式 , 其中的特殊符号 , 我解释下 , SYN 是 同步的这个单词(synchronization), ACK 是回执,承认的单词(acknowledgement), SYN-ACK 服务器收到SYN报文后,回复一个带有SYN和ACK标志的报文段,这表示服务器已经收到了客户端的SY…

【C++ Primer Plus习题】8.7

问题: 解答: #include <iostream>using namespace std;template <typename T> T SumArray(T arr[], int n) {T sum arr[0] - arr[0];for (int i 0; i < n; i){sum arr[i];}return sum; }template <typename T> T SumArray(T *arr[], int n) {T sum *…

sqli-libs第四关详解

首先判断是数字型注入还是字符型注入 正常显示&#xff0c;说明是字符型注入&#xff0c;那么尝试单引号闭合 还是正常显示&#xff0c;尝试双引号闭合 有报错信息&#xff0c;含有括号&#xff0c;这时就应该想到&#xff0c;sql代码是("$id")这样写的了。直接采取闭…

强化学习——马尔可夫决策过程的理解

目录 一、马尔可夫决策过程1.策略2.状态价值函数3.动作价值函数4.贝尔曼期望方程 参考文献 一、马尔可夫决策过程 马尔可夫决策过程&#xff08;MDP&#xff09;是马尔可夫奖励过程&#xff08;MRP&#xff09;的扩展&#xff0c;它引入了“动作”这一外界的影响因素&#xff0…

翻译新选择!除了在线翻译百度,还有这三款宝藏工具等你发现

咱们来聊聊现在世界变成一个“大家庭”的事儿。现在&#xff0c;世界各地的人们交流越来越多&#xff0c;语言不通不再是障碍了&#xff01;翻译工具就像超级护照&#xff0c;帮我们轻松跨越语言障碍。说到翻译&#xff0c;百度翻译真的很有名&#xff0c;速度快&#xff0c;翻…

JAVA中的线程池说明一

系列文章 JAVA中的线程池说明一 JAVA中的线程池说明二 目录 1.为什么需要线程池? 2.什么是线程池? 3.标准库中的线程池 4.实现自定义线程池 1.为什么需要线程池? 线程的存在意义在于解决并发编程中进程开销过大的问题&#xff0c;因此引入了线程&#xff0c;也被称为…

【Hot100】LeetCode—74. 搜索二维矩阵

原题链接&#xff1a; 74. 搜索二维矩阵 1- 思路 二分 ① 实现一个二分函数② 对每行数组进行二分 2- 实现 ⭐74. 搜索二维矩阵——题解思路 class Solution {public boolean searchMatrix(int[][] matrix, int target) {for(int[] m:matrix){if(binarySearch(m,target)){re…

【知识图谱】3、Python操作图数据库neo4j示例

今天突然想起上次知识图谱系列埋了一个坑&#xff08;【知识图谱】1、Neo4j环境搭建入门指南:从零开始玩转图数据库&#xff09;&#xff0c;说后续写一篇关于Python操作neo4j的示例。趁着周六有充足时间&#xff0c;这里写个demo补上。 本文demo还是以面试的求职者、岗位要求…

浅谈-Unity内存管理

灵魂拷问-什么是内存 物理内存虚拟内存内存寻址方位 物理内存 下面是一张i7的处理器的芯片细节图&#xff0c;在整个板载面积上我们可以很明显的看到Shared L3 Cache占用了最大面积。为什么&#xff1f;因为硬件产商为了让我们忽略掉CPU访问内存是一个非常慢速的过程&#x…

Nginx: TCP建立连接的优化和启用Fast Open功能

TCP 建立连接优化 在三次握手中&#xff0c;相关TCP的内核参数可优化这一过程 net.ipv4.tcp_syn_retries 6net.ipv4.tcp_synack_retries 5net.ipv4.tcp_syncookies 0net.ipv4.tcp_max_syn_backlognet.core.somaxconnnet.core.netdev_max_backlog 1 &#xff09; net.ipv4…

游戏:科技强国的璀璨星芒与经济增长新动力

游戏&#xff1a;科技强国的璀璨星芒与经济增长新动力 在时代的浪潮中&#xff0c;游戏正以一种令人瞩目的姿态&#xff0c;成为科技强国之路上一颗闪耀的星&#xff0c;同时也对经济有着多方面的深远影响。 从《黑神话&#xff1a;悟空》的爆火&#xff0c;到美国、英国、法国…

磐石云AXB小号平台同时支持AXYB、AXN、AXYBN

外卖订单&#xff0c;物流配送&#xff0c;金融&#xff0c;房地产&#xff0c;等行业都在使用订单小号或者说是工作号。 在当今数字化信息爆炸的时代&#xff0c;通信方式的多样化和复杂化给我们带来了便利&#xff0c;但也带来了管理的挑战。面对繁杂的通信需求&#xff0c;…

Ai Illustrator 取消吸附到像素点,鼠标拖动的时候只能到像素点

Ai Illustrator 取消吸附到像素点&#xff0c;鼠标拖动的时候只能到像素点 在做图的时候无意间变成吸附到像素点了&#xff0c;导致无法更细致的移动点。 像这样&#xff1a; 关闭的方法是打开上面菜单中的 【视图】取消勾选【对齐像素】 即可。 结果就是&#xff1a;