Excel表格文件压缩与解压技巧介绍

版权申诉
0 下载量 117 浏览量 更新于2024-10-20 收藏 7KB ZIP 举报
在当前信息中,我们有一个文件名为"ds.zip_zip",这表明该文件是一个压缩包,且后缀名为.zip,通常用于压缩文件的存储和传输。文件描述中提到的"it is a good one two three"虽然语义不清,但我们可以忽略它,因为它不构成有效的技术信息。标签"zip"确认了文件类型,而文件名列表中只出现了一个文件:新建 Microsoft Excel Worksheet.xlsx,这表明在解压"ds.zip_zip"后,我们会找到一个名为"新建 Microsoft Excel Worksheet.xlsx"的文件,这是一个Excel工作表文件。 知识点详细说明: 1. ZIP文件格式: - ZIP文件是一种常见的压缩文件格式,用于减小文件大小,便于存储和网络传输。 - ZIP文件能够将多个文件和文件夹压缩成一个文件,从而节省空间并减少传输时间。 - ZIP格式广泛支持于各种操作系统,包括Windows、macOS、Linux等,几乎所有平台都内置或支持第三方工具解压ZIP文件。 2. ZIP文件的特点: - ZIP文件可以通过多种方式创建,包括操作系统自带的压缩工具、第三方压缩软件如WinRAR、7-Zip等。 - ZIP文件格式支持各种压缩级别,从无压缩(存储模式)到最大压缩,以平衡压缩速度和压缩率。 - ZIP文件可包含密码保护,提供基本的安全性,以防止未授权访问。 - ZIP格式支持文件列表信息的存储,包括文件名、大小、压缩前后的大小、修改日期等元数据。 - ZIP文件还支持跨平台使用,这意味着在一台计算机上创建的ZIP文件可以在另一台计算机上解压。 3. Excel工作表文件: - 新建 Microsoft Excel Worksheet.xlsx文件名表明这是一个Excel电子表格文件,用于存储和处理数据。 - Excel是Microsoft Office套件中的一部分,广泛应用于数据管理、财务分析、报告、信息汇总等领域。 - Excel文件通常使用.xlsx作为文件扩展名,这表示它们是Excel 2007及以后版本的文件格式。 - Excel文件可以包含多种类型的数据,如文本、数字、公式、图表、宏等,并支持复杂的数学和逻辑运算。 - Excel工作表由多个单元格组成,每个单元格可单独或批量编辑,同时支持数据筛选、排序、分组等功能。 4. 文件解压缩操作: - 解压ZIP文件通常需要使用专门的解压缩工具,这些工具可以列出压缩包内的所有文件,并允许用户选择性地提取文件。 - 常用的Windows系统中的解压工具包括WinRAR、7-Zip等,macOS和Linux通常也内置了解压缩功能。 - 在解压文件时,用户应该确保足够的磁盘空间来保存解压后的文件,并注意文件名、文件路径以避免覆盖已有文件。 5. 文件安全性考虑: - 虽然ZIP格式不提供高级加密功能,但可以设置密码保护,防止未经授权的用户访问压缩包内的文件。 - 对于需要高安全性的文件传输和存储,可以考虑使用更高级的加密压缩工具,例如使用AES-256加密的7-Zip。 - 用户在处理含有敏感信息的文件时,应确保压缩包在传输和存储过程中的安全性,避免数据泄露。 总结: 本文件"ds.zip_zip"是包含至少一个Excel工作表文件的压缩包,表明它可能用于数据备份或文件传输。理解ZIP文件的特性和Excel文件的使用,有助于用户正确地管理和操作这些文件。在处理此类文件时,用户应注意使用合适的工具进行解压,并注意文件的安全性和隐私保护。

import tensorflow as tf from tensorflow.keras.layers import Dense, Flatten, Conv2D, MaxPool2D, Dropoutfrom tensorflow.keras import Model​# 在GPU上运算时,因为cuDNN库本身也有自己的随机数生成器,所以即使tf设置了seed,也不会每次得到相同的结果tf.random.set_seed(100)​mnist = tf.keras.datasets.mnist(X_train, y_train), (X_test, y_test) = mnist.load_data()X_train, X_test = X_train/255.0, X_test/255.0​# 将特征数据集从(N,32,32)转变成(N,32,32,1),因为Conv2D需要(NHWC)四阶张量结构X_train = X_train[..., tf.newaxis]    X_test = X_test[..., tf.newaxis]​batch_size = 64# 手动生成mini_batch数据集train_ds = tf.data.Dataset.from_tensor_slices((X_train, y_train)).shuffle(10000).batch(batch_size)test_ds = tf.data.Dataset.from_tensor_slices((X_test, y_test)).batch(batch_size)​class Deep_CNN_Model(Model):    def __init__(self):        super(Deep_CNN_Model, self).__init__()        self.conv1 = Conv2D(32, 5, activation='relu')        self.pool1 = MaxPool2D()        self.conv2 = Conv2D(64, 5, activation='relu')        self.pool2 = MaxPool2D()        self.flatten = Flatten()        self.d1 = Dense(128, activation='relu')        self.dropout = Dropout(0.2)        self.d2 = Dense(10, activation='softmax')        def call(self, X):    # 无需在此处增加training参数状态。只需要在调用Model.call时,传递training参数即可        X = self.conv1(X)        X = self.pool1(X)        X = self.conv2(X)        X = self.pool2(X)        X = self.flatten(X)        X = self.d1(X)        X = self.dropout(X)   # 无需在此处设置training状态。只需要在调用Model.call时,传递training参数即可        return self.d2(X)​model = Deep_CNN_Model()loss_object = tf.keras.losses.SparseCategoricalCrossentropy()optimizer = tf.keras.optimizers.Adam()​train_loss = tf.keras.metrics.Mean(name='train_loss')train_accuracy = tf.keras.metrics.SparseCategoricalAccuracy(name='train_accuracy')test_loss = tf.keras.metrics.Mean(name='test_loss')test_accuracy = tf.keras.metrics.SparseCategoricalAccuracy(name='test_accuracy')​# TODO:定义单批次的训练和预测操作@tf.functiondef train_step(images, labels):       ......    @tf.functiondef test_step(images, labels):       ......    # TODO:执行完整的训练过程EPOCHS = 10for epoch in range(EPOCHS)补全代码

149 浏览量

# -*- coding: utf-8 -*- from machine import Pin import onewire import ds18x20 import time # ====== 硬件配置 ====== ‌:ml-citation{ref="1,3" data="citationList"} # 5641AS数码管引脚定义(共阴型) # 位选引脚(控制哪一位显示) DIGITS = [Pin(5, Pin.OUT), # 第1位 Pin(18, Pin.OUT), # 第2位 Pin(19, Pin.OUT), # 第3位 Pin(21, Pin.OUT)] # 第4位 # 段选引脚(控制显示数字形状) SEGMENTS = [Pin(13, Pin.OUT), # a段 Pin(12, Pin.OUT), # b段 Pin(14, Pin.OUT), # c段 Pin(27, Pin.OUT), # d段 Pin(26, Pin.OUT), # e段 Pin(25, Pin.OUT), # f段 Pin(33, Pin.OUT), # g段 Pin(32, Pin.OUT)] # 小数点dp # 数字编码(共阴型,0表示点亮) NUMBERS = { 0: [0,0,0,0,0,0,1,1], # 0 1: [1,0,0,1,1,1,1,1], # 1 2: [0,0,1,0,0,1,0,1], # 2 3: [0,0,0,0,1,1,0,1], # 3 4: [1,0,0,1,1,0,0,1], # 4 5: [0,1,0,0,1,0,0,1], # 5 6: [0,1,0,0,0,0,0,1], # 6 7: [0,0,0,1,1,1,1,1], # 7 8: [0,0,0,0,0,0,0,1], # 8 9: [0,0,0,0,1,0,0,1], # 9 '-': [1,1,1,1,1,1,0,1], # 负号 'E': [0,1,1,0,0,0,0,1] # 错误标识 } # ====== DS18B20初始化 ====== ‌:ml-citation{ref="3" data="citationList"} ds_pin = Pin(15) # 温度传感器接GPIO15(示例引脚,可修改) ds_sensor = ds18x20.DS18X20(onewire.OneWire(ds_pin)) roms = ds_sensor.scan() # ====== 温度读取函数 ====== ‌:ml-citation{ref="3,4" data="citationList"} def read_temp(): try: ds_sensor.convert_temp() time.sleep_ms(750) # 等待温度转换 temp = ds_sensor.read_temp(roms) return round(temp, 1) except: return None # 传感器异常返回空值 # ====== 数码管显示函数 ====== ‌:ml-citation{ref="1,2" data="citationList"} def display_number(number, decimal_pos=-1): # 异常显示处理 if number is None: segments = NUMBERS['E'] + NUMBERS['E'][:-1] for i in range(4): DIGITS[i].value(0 if i==0 else 1) # 仅第一位显示E for seg, val in zip(SEGMENTS, segments): seg.value(val) time.sleep_ms(5) return # 数字分解处理 str_num = f"{abs(number):4.1f}".replace(' ','').zfill(4)

2025-03-09 上传
127 浏览量

Use the credictcard-reduced.csv dataset ([Data description] and build Five classification models. Please plot confusion matrix, and evaluate your model performance using accuracy, precision, recall, F-score (70 points). A list of classification models can be found我现在需要完成上面的任务。已知导入的数据是这样的 Time V1 V2 V3 V4 V5 V6 V7 V8 V9 ... V21 V22 V23 V24 V25 V26 V27 V28 Amount Class 0 406 -2.312227 1.951992 -1.609851 3.997906 -0.522188 -1.426545 -2.537387 1.391657 -2.770089 ... 0.517232 -0.035049 -0.465211 0.320198 0.044519 0.177840 0.261145 -0.143276 0.00 1 names = [ "Nearest Neighbors", "Linear SVM", "RBF SVM", "Gaussian Process", "Decision Tree", "Random Forest", "Neural Net", "AdaBoost", "Naive Bayes", "QDA", ] classifiers = [ KNeighborsClassifier(3), SVC(kernel="linear", C=0.025, random_state=42), SVC(gamma=2, C=1, random_state=42), GaussianProcessClassifier(1.0 * RBF(1.0), random_state=42), DecisionTreeClassifier(max_depth=5, random_state=42), RandomForestClassifier( max_depth=5, n_estimators=10, max_features=1, random_state=42 ), MLPClassifier(alpha=1, max_iter=1000, random_state=42), AdaBoostClassifier(random_state=42), GaussianNB(), QuadraticDiscriminantAnalysis(), ] X, y = make_classification( n_features=2, n_redundant=0, n_informative=2, random_state=1, n_clusters_per_class=1 ) rng = np.random.RandomState(2) X += 2 * rng.uniform(size=X.shape) linearly_separable = (X, y) datasets = [ make_moons(noise=0.3, random_state=0), make_circles(noise=0.2, factor=0.5, random_state=1), linearly_separable, ] figure = plt.figure(figsize=(27, 9)) i = 1 # iterate over datasets for ds_cnt, ds in enumerate(datasets): # preprocess dataset, split into training and test part X, y = ds X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.4, random_state=42 ) x_min, x_max = X[:, 0].min() - 0.5, X[:, 0].max() + 0.5 y_min, y_max = X[:, 1].min() - 0.5, X[:, 1].max() + 0.5 # just plot the dataset first cm = plt.cm.RdBu cm_bright = ListedColormap(["#FF0000", "#0000FF"]) ax = plt.subplot(len(datasets), len(classifiers) + 1, i) if ds_cnt == 0: ax.set_title("Input data") # Plot the training points ax.scatter(X_train[:, 0], X_train[:, 1], c=y_train, cmap=cm_bright, edgecolors="k") # Plot the testing points ax.scatter( X_test[:, 0], X_test[:, 1], c=y_test, cmap=cm_bright, alpha=0.6, edgecolors="k" ) ax.set_xlim(x_min, x_max) ax.set_ylim(y_min, y_max) ax.set_xticks(()) ax.set_yticks(()) i += 1 # iterate over classifiers for name, clf in zip(names, classifiers): ax = plt.subplot(len(datasets), len(classifiers) + 1, i) clf = make_pipeline(StandardScaler(), clf) clf.fit(X_train, y_train) score = clf.score(X_test, y_test) DecisionBoundaryDisplay.from_estimator( clf, X, cmap=cm, alpha=0.8, ax=ax, eps=0.5 ) # Plot the training points ax.scatter( X_train[:, 0], X_train[:, 1], c=y_train, cmap=cm_bright, edgecolors="k" ) # Plot the testing points ax.scatter( X_test[:, 0], X_test[:, 1], c=y_test, cmap=cm_bright, edgecolors="k", alpha=0.6, ) ax.set_xlim(x_min, x_max) ax.set_ylim(y_min, y_max) ax.set_xticks(()) ax.set_yticks(()) if ds_cnt == 0: ax.set_title(name) ax.text( x_max - 0.3, y_min + 0.3, ("%.2f" % score).lstrip("0"), size=15, horizontalalignment="right", ) i += 1 plt.tight_layout() plt.show() 老师给的模板是这样的,请帮我写类似的代码

2025-03-13 上传