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

html简单网站成品免费合肥市建设工程造价信息网

html简单网站成品免费,合肥市建设工程造价信息网,wordpress网站发布文章,做外贸最适合的网站系统目录 一、实验介绍 二、实验环境 三、实验内容 0. 导入库 1. 归一化处理 归一化 实验内容 2. 绘制归一化数据折线图 报错 解决 3. 计算移动平均值SMA 移动平均值 实验内容 4. 绘制移动平均值折线图 5 .同时绘制两图 6. array转换为tensor张量 7. 打印张量 一、…目录 一、实验介绍 二、实验环境 三、实验内容 0. 导入库 1. 归一化处理 归一化 实验内容 2. 绘制归一化数据折线图 报错 解决 3. 计算移动平均值SMA 移动平均值 实验内容 4. 绘制移动平均值折线图 5 .同时绘制两图 6. array转换为tensor张量 7. 打印张量 一、实验介绍 Visualizing the Trend of Random Data Changes可视化随机数据变化的趋势 二、实验环境 conda create -n DL python3.7  conda activate DL pip install torch1.8.1cu102 torchvision0.9.1cu102 torchaudio0.8.1 -f https://download.pytorch.org/whl/torch_stable.htmlconda install matplotlib 三、实验内容 0. 导入库 According to the usual convention, import numpy, matplotlib.pyplot, and torch.按照通常的惯例导入 numpy、matplotlib.pyplot 和 torch。import numpy as np import matplotlib.pyplot as plt import torch 1. 归一化处理 归一化 归一化处理是一种常用的数据预处理技术用于将数据缩放到特定的范围内通常是[0,1]或[-1,1]。这个过程可以确保不同特征或指标具有相似的数值范围避免某些特征对模型训练的影响过大。 在机器学习和数据分析中归一化可以帮助改善模型的收敛速度和性能减少由于特征尺度差异导致的问题。例如某些机器学习算法如梯度下降对特征的尺度敏感如果不进行归一化处理可能会导致模型难以收敛或产生不准确的结果。 常用的归一化方法包括最小-最大归一化Min-Max normalization和Z-score归一化标准化。 最小-最大归一化将数据线性地缩放到指定的范围内。Z-score归一化通过计算数据的均值和标准差将数据转换为均值为0标准差为1的分布。 实验内容 Read the file named data.txt containing 100 integers using NumPy, normalize all values to the range [0, 1], and store the normalized array with two decimal places.使用 NumPy 读取包含 100 个整数的名为“data.txt”的文件将所有值规范化为范围 [0 1]并存储具有两个小数位的规范化数组。 data np.loadtxt(data.txt) # 归一化处理 normalized_array (data - np.min(data)) / (np.max(data) - np.min(data)) # 保留两位小数 normalized_data np.round(normalized_array, 2) # 打印归一化后的数组 print(normalized_array) 2. 绘制归一化数据折线图 Create a line plot using Matplotlib where the x-axis represents the indices of the normalized array ranging from 1 to 100, and the y-axis represents the values of the normalized array ranging from 0 to 1. 使用 Matplotlib 创建一个折线图其中 x 轴表示规范化数组的索引范围从1到100y 轴表示规范化数组的值范围从0到1。 # 创建x轴数据 x np.arange(1, 101) # 绘制折线图 plt.plot(x, normalized_array)# 设置x轴和y轴的范围 plt.xlim(1, 100) plt.ylim(0, 1) plt.title(Normalized Data) plt.xlabel(Index) plt.ylabel(Normalized Array) plt.show() 报错 OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized. OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OKTRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.解决 conda install nomkl 3. 计算移动平均值SMA 移动平均值 移动平均值Moving Average是一种数据平滑处理的方法可以在一段时间内计算数据序列的平均值。这种方法通过不断更新计算的平均值使得输出的数据更加平滑减少噪声和突变的影响。 移动平均值有多种类型其中最常见的是简单移动平均值Simple Moving AverageSMA和指数移动平均值Exponential Moving AverageEMA。这两种方法的计算方式略有不同。 简单移动平均值SMA 简单移动平均值是对指定时间段内的数据进行平均处理的方法计算公式如下 SMA (X1 X2 X3 ... Xn) / n 其中X1, X2, ..., Xn 是指定时间段内的数据n 是时间段的长度。 例如要计算最近5天的简单移动平均值可以将这5天的数据相加再除以5。 指数移动平均值EMA 指数移动平均值是对数据进行加权平均处理的方法计算公式如下 EMA (X * (2/(n1))) (EMA_previous * (1 - (2/(n1)))) 其中X 是当前数据点的值n 是时间段的长度EMA_previous 是上一个时间段的指数移动平均值。 指数移动平均值使用了指数衰减的加权系数更加重视最近的数据点。 使用移动平均值可以平滑数据序列使得数据更具可读性减少随机波动的影响。这在时间序列分析、技术分析和数据预测等领域经常被使用。 实验内容 Calculate the moving average of the normalized results using NumPy with a window size of 5. Store the calculated moving average values in a new one-dimensional NumPy array, referred to as the average values array. 使用窗口大小为 5 的 NumPy 计算归一化结果的移动平均值。将计算出的移动平均值存储在新的一维 NumPy 数组称为“平均值数组”中。 # 计算移动平均值 average_values_array np.convolve(normalized_array, np.ones(5)/5, modevalid) print(average_values_array) 4. 绘制移动平均值折线图 Create another line plot using Matplotlib where the x-axis represents the indices of the average values array ranging from 5 to 100, and the y-axis represents the values of the average values array ranging from 0 to 1. 使用 Matplotlib 创建另一个线图其中 x 轴表示平均值数组的索引范围从 5 到 100y 轴表示从 0 到 1 的平均值数组的值。 x_axis range(5, 101)# 绘制折线图 plt.plot(x_axis, average_values_array)plt.xlim(5, 100) plt.ylim(0, 1) plt.title(Moving Average Line) plt.xlabel(Index) plt.ylabel(Average Values Array.) plt.show() 5 .同时绘制两图 Combine the line plots of the normalized array and the average values array in the same figure using different colors for each line.  将归一化数组的线图和平均值数组组合在同一图中每条线使用不同的颜色。 plt.plot(x, normalized_array, colorr, labelNormalized Array Line) plt.plot(x_axis, average_values_array, colorb, labelMoving Average Line) plt.legend() plt.xlim(1, 100) plt.ylim(0, 1) plt.xlabel(Index) plt.ylabel(Value) plt.show() 6. array转换为tensor张量 Transform the normalized array into a 2x50 Tensor by reshaping the data. 通过重塑数据将归一化数组转换为 2x50 张量。 normalized_tensor torch.tensor(normalized_array).reshape(2, 50) 7. 打印张量 Print the resulting Tensor. print(normalized_tensor)
http://www.hkea.cn/news/14344190/

相关文章:

  • 如何在百度开个网站网建公司转型
  • 做的物流网站cms企业网站源码
  • 众筹网站功能本地升级wordpress
  • 网站开发服务费会计分录怎么用源码搭建网站
  • 做问卷网站大宗商品交易平台
  • 做网站要学的代码做装修广告网站好
  • 琼筑网站是哪家做的设计网站轮廓模板
  • 可以做音基题的音乐网站游戏推广怎么快速拉人
  • 武隆网站建设爱做奈官方网站
  • 不写代码门户网站建设南宁网站建设官网
  • 黄冈网站建设wordpress小型门户
  • 电子商务网站建设 第二版重庆手机网站制作费用
  • 网站开发毕设文档品牌网站建设要选磐石网络
  • 网站内容很少如何做seo淘宝推广工具
  • 网站建站销售怎么做权重提升
  • 中国建设招标网是私人网站吗九江网站建设网站制作
  • 自己创办网站wordpress 会话过期
  • 口碑好网站建设定制ui网站界面设计模板
  • 英语培训东莞网站建设中信建设有限责任公司 人力资源部
  • 安庆建设网站高碑店住房和城乡建设局网站
  • 专业手机网站建设多少钱网站图标的制作h1优化代码
  • 网站建设调研通知电脑网站和手机网站怎么做相同路径
  • 个人做网站简单的网站设计多少钱
  • 设计公司做网站有用吗网站制作最新技术
  • 老的网站为什么要改版新网站邢台市政建设集团网站
  • 海南智能网站建设报价学院网站建设 需求分析
  • 太原网站建设公司5858wordpress 支持vr吗
  • 网络推广培训有哪些课程枫林seo工具
  • dw做网站如何让用户可编辑网站提交自动秒收录
  • 网站后台建设招聘手机无法访问wordpress