摘要: tensorflow import tensorflow as tf import timeit physical_gpus = tf.config.list_physical_devices("GPU") # 获得本地GPU列表 physical_cpus = tf.config.list_phy 阅读全文
posted @ 2023-07-12 23:45 ho_ho 阅读(74) 评论(0) 推荐(0) 编辑
摘要: 要求求出给出的序列中的最长的递增或递减序列。 笨办法-两个动态规划合并 input = [5, 2, 3, 4, 1] def longList(nums): dp1 = [1] * len(nums) # 递减dp dp2 = [1] * len(nums) result1 = 1 result2 阅读全文
posted @ 2021-10-05 12:50 ho_ho 阅读(172) 评论(0) 推荐(0) 编辑
摘要: ####1. 统计文件夹下的文件个数 ls -lh | grep '^-' | wc -l ####2. 筛选的文件复制到另一个目录 举例:查找7天内的文件,复制到另一个tmp目录 find ./ -mtime -7 -exec cp {} ../tmp/ \; 阅读全文
posted @ 2021-08-19 16:01 ho_ho 阅读(31) 评论(0) 推荐(0) 编辑
摘要: 如果想让list数据直接展示为html表格,可以用pandas.to_html()。 这里主要涉及到可以改变表格内的数据样式,如果想将数据的某个字词进行样式改变,可以直接在list中的数据上加html标签,如<span style="color:red">等。 html1 = """<!DOCTYP 阅读全文
posted @ 2021-08-16 16:47 ho_ho 阅读(697) 评论(0) 推荐(0) 编辑
摘要: word tokenize NLTK nltk.word_tokenize substring,按标点字符和空格划分,但保留小数、分数一类 nltk.tokenize.RegexpTokenizer 正则可保留固定的一部分,如对一些金钱'$10'表示或者其他非空白序列 nltk.tokenize.s 阅读全文
posted @ 2021-08-16 16:04 ho_ho 阅读(1254) 评论(0) 推荐(0) 编辑
摘要: d = {'a': 1, 'b': 2} print(list(d.values())[0]) print(next(iter(d.values()))) #适用于数据量多的时候会更快 阅读全文
posted @ 2021-07-31 14:15 ho_ho 阅读(3751) 评论(0) 推荐(0) 编辑
摘要: 恢复内容开始 来自https://blog.csdn.net/sinat_36190649/article/details/107941638,根据需求略做修改 import pymysql import pandas as pd import gc import time import threa 阅读全文
posted @ 2021-07-13 10:21 ho_ho 阅读(148) 评论(0) 推荐(0) 编辑
摘要: gym包在服务器使用无法可视化,会大大影响其使用的便捷性。可以在训练时禁止显示,测试时使用jupyter进行可视化,可以大大提高训练效率和结果的可视化。 训练时,会屏蔽代码env.render()禁止显示游戏画面, 测试时,使用下面方法将使用matplotlib来进行游戏画面的可视化。 在服务器中安 阅读全文
posted @ 2021-06-09 14:51 ho_ho 阅读(851) 评论(0) 推荐(0) 编辑
摘要: 记个笔记,进一步理解了模型融合,开心,整理一下模型融合方式:stacking、blending和voting 直接上代码(来自网络大佬的分享),理论后续补。 blending '''创建训练的数据集''' data, target = make_blobs(n_samples=50000, cent 阅读全文
posted @ 2021-05-25 14:03 ho_ho 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 实际情况是:在读取文件中的“类别”信息,将类别信息转为id,且顺序按照原来的数据顺序排序 labels = list(data['product_classification']) unordered = set(labels) print("unorderd_class: ",unordered) 阅读全文
posted @ 2021-05-08 17:45 ho_ho 阅读(167) 评论(0) 推荐(0) 编辑