【深度学习】论文复现-对论文数据集的一些处理

如何书写伪代码:
ref:https://www.bilibili.com/video/BV12D4y1j7Zf/?vd_source=3f7ae4b9d3a2d84bf24ff25f3294d107

i=14时产出的图片比较合理

import json
import os.path
from matplotlib.ticker import FuncFormatter
import pandas as pd
import matplotlib.pyplot as plt# csv_path= r"/home/justin/Desktop/code/python_project/mypaper/data_process/CAM-01-SRV-lvm0.csv"
# df = pd.read_csv(csv_path, header=0, sep=",")
# df.head(5)
# df = df[["Timestamp", "Hostname", "DiskNumber", "Type", "LBA", "Size", "ResponseTime"]][df["Type"] == "Read"].reset_index(drop=True)
# base_dir = os.path.dirname(os.path.abspath(__file__))
# for i in range(1, 30):
#     # 勾画出,数据的请求分布
#     start_row = i * 100
#     end_row = (i + 1) * 100
#     print(start_row, end_row)
#     df1 = df[['LBA']][start_row:end_row]
#     from matplotlib.ticker import ScalarFormatter
#     plt.plot(df1.index, df1.LBA)
#     plt.title('Irregularity of I/O access locality')
#     plt.xlabel('Access Order')
#     plt.ylabel('Logical Block Address (unit:B)')
#     def format_ticks(x, _):
#         return f'{int(x):,}'
#     plt.gca().yaxis.set_major_formatter(FuncFormatter(format_ticks),ScalarFormatter(useMathText=False))
#     plt.gca().yaxis.get_major_formatter().set_scientific(False)
#     plt.subplots_adjust(left=0.25)
#     # plt.show()
#     save_img_path = os.path.join(base_dir, 'weak_locality','irregularity_io_access_locality_{}.png'.format(i))
#     print(save_img_path)
#     plt.savefig(save_img_path, format='png')
#     plt.clf()import os
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.ticker import FuncFormatter, MultipleLocator# Load the CSV file
csv_path = r"/home/justin/Desktop/code/python_project/mypaper/data_process/CAM-01-SRV-lvm0.csv"
df = pd.read_csv(csv_path, header=0, sep=",")
df.head(5)
pd.set_option('display.max_rows', None)  # Show all rows
pd.set_option('display.max_columns', None)  # Show all columns
pd.set_option('display.expand_frame_repr', False)  # Prevent line wrapping for large DataFrames# Optionally, if you want to set width and precision for better formatting
pd.set_option('display.width', None)  # Auto-detect the width of the display
pd.set_option('display.precision', 3) # Filter the DataFrame for 'Read' types and specific columns
df = df[["Timestamp", "Hostname", "DiskNumber", "Type", "LBA", "Size", "ResponseTime"]][df["Type"] == "Read"].reset_index(drop=True)
# Calculate the differences
df['LBA_diff'] = df['LBA'].diff()# Drop NaN values resulting from the difference computation
df = df.dropna(subset=['LBA_diff'])
LBA_diff_list = df['LBA_diff'].tolist()# def find_repeated_sequences(lst, length):
#     """
#     Find and return the first and last indices of the first repeating sequence of the given length.#     :param lst: List of integers to search for repeating sequences.
#     :param length: Length of the sequence to look for.
#     :return: Tuple containing the first and last indices of the first repeating sequence, or None if not found.
#     """
#     sequence_indices = {}
#     first_index = None
#     last_index = None#     # Iterate through the list to find sequences of the specified length
#     for i in range(len(lst) - length + 1):
#         # Get the current sequence as a tuple (to allow it to be a dictionary key)
#         current_sequence = tuple(lst[i:i + length])#         if current_sequence in sequence_indices:
#             # If the sequence has been seen before, update indices
#             first_index = sequence_indices[current_sequence][0]  # First occurrence
#             last_index = i  # Update last occurrence
#             break  # Only need the first repeating sequence
#         else:
#             # Store the index of the first occurrence of this sequence
#             sequence_indices[current_sequence] = (i,)#     return (first_index, last_index)# # Example usage
# lst = LBA_diff_list[20000:]
# length = 5# result = find_repeated_sequences(lst, length)
# print(f"First occurrence: {result[0]}, Last occurrence: {result[1]}")
# print(df[20117:20123],df[20119:20125])
# # Exit the script if needed
# exit("==========")
# # Get the base directory path
# base_dir = os.path.dirname(os.path.abspath(__file__))# Get the base directory path
base_dir = os.path.dirname(os.path.abspath(__file__))for i in range(1, 30):if i!=14:continue# Define the start and end row indicesstart_row = i * 100end_row = (i + 1) * 100print(start_row, end_row)# Slice the necessary part of the DataFramedf1 = df[['LBA']][start_row:end_row].reset_index(drop=True)# Plot the dataplt.plot(df1.index, df1.LBA)plt.title('Irregularity of I/O Access Locality')plt.xlabel('Access Order (unit:times)')plt.ylabel('Logical Block Address (unit:B)')# Function to format y-ticks with commasdef format_ticks(x, _):return f'{int(x):,}'# Set the y-axis major formatterplt.gca().yaxis.set_major_formatter(FuncFormatter(format_ticks))# Set x-axis major and minor ticksplt.gca().xaxis.set_major_locator(MultipleLocator(10))  # Major ticks every 10 unitsplt.gca().xaxis.set_minor_locator(MultipleLocator(5))   # Minor ticks every 2 unitsax = plt.gca()  # Get the current axesax.spines['top'].set_visible(False)    # Hide the top spineax.spines['right'].set_visible(False)  # Hide the right spineax.spines['left'].set_visible(True)    # Show the left spineax.spines['bottom'].set_visible(True)# Adjust the margins if necessaryplt.subplots_adjust(left=0.25)# Constructing the save image pathsave_img_path = os.path.join(base_dir, 'weak_locality', 'irregularity_io_access_locality_{}.png'.format(i))print(save_img_path)# Save the plot as a PNG fileplt.savefig(save_img_path, format='png')# Clear the figure after savingplt.clf()# Plot the 'Size' columndf2 = df[['Size']][start_row:end_row].reset_index(drop=True)    # Set the figure sizeplt.plot(df2['Size'], marker='o',markersize=2,linestyle='-',linewidth=0.5)  # Plot with markersplt.title('Variablity of I/O Access Size')plt.xlabel('Access Order(unit:times)')plt.ylabel('Size(Unit:B)')plt.gca().xaxis.set_major_locator(MultipleLocator(10))  # Major ticks every 10 unitsplt.gca().xaxis.set_minor_locator(MultipleLocator(5))   # Minor ticks every 2 unitsax = plt.gca()  # Get the current axesax.spines['top'].set_visible(False)    # Hide the top spineax.spines['right'].set_visible(False)  # Hide the right spineax.spines['left'].set_visible(True)    # Show the left spineax.spines['bottom'].set_visible(True)# plt.grid()  # Add grid for better readabilityplt.tight_layout()  # Adjust layout to avoid clippingsave_img_path = os.path.join(base_dir, 'weak_locality', 'io_access_locality_size_{}.png'.format(i))plt.savefig(save_img_path, format='png')print(save_img_path)plt.clf()

Total count: 246990497, Only once count: 52128003, ratio: 21.11%
Mean: 35004.78260010141
Median: 32768.0 中位数
Mode: 65536.0 众数
Minimum: 512.0 最小值
Maximum: 6410240.0 最大值

\documentclass{article}
\usepackage[ruled,longend,linesnumber]{algorithm2e}
\usepackage{xeCJK}\begin{document}
\begin{algorithm}
\KwIn{我在B站刷到了本视频}
\KwOut{我学会了,给个三连}
\Begin{
我在B站刷到了本视频\;
看标题好像有点用,点进去看看\;
\While{视频正在播放}{继续观看\;\tcc{不考虑没看懂某一部分,所以一直回看的死循环}\eIf{理解}{看下部分\;下部分变为这部分\;}{回看这部分\;}
}
我学会了,给个三连!
}
\caption{如何生成好看的伪代码}
\end{algorithm}\end{document}
\documentclass{article}
\usepackage[ruled, longend, linesnumbered]{algorithm2e}
\usepackage{xeCJK}\begin{document}\begin{algorithm}
\KwIn{ $T$: LBA Sequence; \ $L$: Window size;}
\KwOut{$X$, $y$}
\tcc{X是列表,每个item包含(Delta-LBA,SIZE)两个元素数据\;y是列表,每个item包含(Delta-LBA,SIZE)两个元素数据\; L是滑动窗口大小}
\Begin{$i \gets 0$ \; $j \gets 0$ \; \While{$i + L < T.length()$}{$X[j] \gets T[i:i+L-1]$\;$y[j] \gets T[i+L]$\;$i \gets i+k$\;$j \gets j+1$\;}\KwRet{$X$, $y$}
}
\caption{LBA Feature Preprocessor}
\end{algorithm}\end{document}

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

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

相关文章

C#调用WebService的方法

一、前言 在日常工作中&#xff0c;如果涉及到与第三方进行接口对接&#xff0c;有的会使用WebService的方式&#xff0c;这篇文章主要讲解在.NET Framework中如何调用WebService。 1.创建WebService &#xff08;1&#xff09;新建项目——模板选择ASP.NET Web 应用程序 &a…

Java CPU飙升 排查

一、概述 CPU 是整个电脑的核心计算资源&#xff0c;CPU的最小执行单元是 线程&#xff1b; 在现代操作系统中&#xff0c;进程和线程是两种主要的调度单位&#xff1b; 进程是程序中正在运行的一个应用程序&#xff0c;而线程是系统分配处理器时间资源的基本单位。一个进程至少…

Qt creator ,语言家功能缺失解决方法

1、找到工具->外部->配置 2、添加目录&#xff0c;双击命名语言家 3、在语言家目录下&#xff0c;添加工具 双击重命名lupdate&#xff0c;即更新翻译 %{CurrentDocument:Project:QT_INSTALL_BINS}\lupdate%{CurrentDocument:Project:FilePath}%{CurrentDocument:Projec…

12寸半导体厂等保安全的设计思路

等级保护(等保)二级和三级的主要区别在于安全要求的严格程度、所需部署的安全措施和设备、以及对安全事件响应和处理的能力。以下是等保二级和三级之间的一些关键区别: 一、 安全要求严格程度: - 等保二级:适用于需要较高安全保护的信息系统,要求能够防范轻微的恶意攻击…

Docker Compose 配置指南

目录 1. Docker Compose 配置1.1 基本配置结构1.2 docker-compose.yml 的各部分1.3 常用配置选项 2. Docker Compose 使用方法2.1 创建 Docker Compose 配置文件2.2 启动服务2.3 查看容器状态2.4 查看服务日志2.5 停止服务2.6 重新构建服务 3. Docker Compose 常用命令3.1 dock…

Taro小程序开发性能优化实践

我们团队在利用Taro进行秒送频道小程序的同时&#xff0c;一直在探索性能优化的最佳实践。随着需求的不断迭代&#xff0c;项目中的性能问题难免日积月累&#xff0c;逐渐暴露出来影响用户体验。适逢双十一大促&#xff0c;我们趁着这个机会统一进行了Taro性能优化实践&#xf…

手动修改nginx-rtmp模块,让nginx-rtmp-module支持LLHLS

文章目录 1. 背景2. 开发环境搭建2.1 ffmpeg在ubuntu上安装2.2 nginx-rtmp-module在ubuntu上安装2.3 安装vscode环境2. 修改nginx-rtmp-module2.1 主要更新内容2.2 新增配置项2.3 代码更新3. LLHLS验证方法3.1 配置验证3.2 功能验证4. 注意事项5. 已知问题6. 后续计划1. 背景 …

Git的简介

文章目录 一.Git是什么二.核心概念三.工作流程四.Git的优势 下载Git 推荐官网下载 官网地址 一.Git是什么 Git是一个分布式版本控制系统&#xff0c;用于跟踪文件的变化并协调多人对同一项目的开发工作。它就像是一个时光机器&#xff0c;能够记录文件在不同时间点的状态&…

springboot471基于协同过滤算法商品推荐系统(论文+源码)_kaic

摘 要 传统办法管理信息首先需要花费的时间比较多&#xff0c;其次数据出错率比较高&#xff0c;而且对错误的数据进行更改也比较困难&#xff0c;最后&#xff0c;检索数据费事费力。因此&#xff0c;在计算机上安装协同过滤算法商品推荐系统软件来发挥其高效地信息处理的作用…

进程间关系与守护进程

个人主页&#xff1a;C忠实粉丝 欢迎 点赞&#x1f44d; 收藏✨ 留言✉ 加关注&#x1f493;本文由 C忠实粉丝 原创 进程间关系与守护进程 收录于专栏[Linux学习] 本专栏旨在分享学习Linux的一点学习笔记&#xff0c;欢迎大家在评论区交流讨论&#x1f48c; 目录 1. 进程组 什…

【NLP 16、实践 ③ 找出特定字符在字符串中的位置】

看着父亲苍老的白发和渐渐老态的面容 希望时间再慢一些 —— 24.12.19 一、定义模型 1.初始化模型 ① 初始化父类 super(TorchModel, self).__init__()&#xff1a; 调用父类 nn.Module 的初始化方法&#xff0c;确保模型能够正确初始化。 ② 创建嵌入层 self.embedding n…

javaEE-多线程编程-3

目录 java 常见的包 : 回调函数: 什么是线程: 第一个线程: 验证多线程执行: 内核: 调用sleep()方法: 执行结果分析: 线程创建的几种方式: 1.继承Thread类,重写run()方法. 2.实现Runnable接口,重写run()方法. 3.继承Thread类,重写run()方法.但使用匿名内部类 4.实现…

怎么在idea中创建springboot项目

最近想系统学习下springboot&#xff0c;尝试一下全栈路线 从零开始&#xff0c;下面将叙述下如何创建项目 环境 首先确保自己环境没问题 jdkMavenidea 创建springboot项目 1.打开idea&#xff0c;选择file->New->Project 2.选择Spring Initializr->设置JDK->…

设计模式期末复习

一、设计模式的概念以及分类 是一套被反复使用&#xff0c;多数人知晓&#xff0c;经过分类编目&#xff0c;代码设计经验的总结&#xff0c;描述了在软件设计的过程中不断重复发生的问题&#xff0c;以及该问题的解决方案&#xff0c;他是解决特定问题的一系列套路&#xff0c…

哔哩哔哩视频能保存到本地吗

哔哩哔哩&#xff08;B站&#xff09;视频可以保存到本地&#xff0c;但需要根据具体情况选择方法。以下是一些常见的方式&#xff1a; 使用B站客户端的离线功能 B站官方客户端&#xff08;移动端或PC端&#xff09;提供了离线下载功能&#xff0c;适用于已开通权限的视频。 离…

FreeMarker语法

1. 查找转移 <#function getSubSlot x > <#return (x) ? switch( "1", "L", "2", "R", "" )> </#function> 2. 转换数字 ?number ${mergedMap[placement.sequence].material.subs…

OCR(五)linux 环境 基于c++的 paddle ocr 编译【CPU版本 】

1. 下载 下载opencv4.10 2. 编译opencv 2.1 安装依赖库 sudo apt install -y g ++ sudo apt install -y cmake sudo apt install -y make sudo apt install -y wget sudo apt install -y unzip sudo apt-get install build-essential libgtk2.0-dev libgtk-3-devlibavcodec-…

SQL Server 批量插入数据的方式汇总及优缺点分析

在 SQL Server 中,批量插入数据是非常常见的操作,尤其是在需要导入大量数据时。以下是几种常用的批量插入数据的方式: 1. 使用 INSERT INTO ... VALUES • 特点:适用于少量数据插入。 • 优点:简单易用。 • 缺点:不适合大量数据插入,性能较差。 • 示例:…

对于其他管理的理解(下)

信息系统项目管理师的论文还有可行性分析、安全管理、测试管理、招投标管理等 可行性分析(医生的手术前检查) 1. 明确目标&#xff1a;确定手术的必要性 知识点&#xff1a; 在项目启动阶段&#xff0c;需要明确项目的目的、目标和需求&#xff0c;确定是否有必要开展项目。这…

Linux增加回收站功能

功能简介 rm命令是非常危险的命令&#xff0c;为了防止用户误删文件&#xff0c;所以我们在执行rm命令时将文件添加到回收站&#xff0c;防止误删文件。 相关环境变量 名称描述TRASH_DIR 回收站目录&#xff0c;默认为/Recycle_Bin 文件命名规则 文件名生成格式为 原始文件名…