- 博客(116)
- 收藏
- 关注
原创 ElasticSearch安装和使用
(1)必须:在/etc/yum.repos.d/中,创建文件elasticsearch.repo(2)必须:然后用如下命令来安装(注意记录生成的password)(3)可选:安装后,修改配置文件。
2023-03-23 21:10:51
571
原创 【论文阅读】语言识别ASR
阅读《Automatic Speech Recognition and Text-to-Speech》,整理了如下关于ASR的笔记。
2023-03-23 20:36:24
583
1
原创 python os常用例子
例子 得到文件名 os.path.split('a://b.txt') 拼接路径 os.path.join('folder', 'file_name')
2021-08-24 22:01:21
184
原创 Pytorch如何去掉模型的最后一层
new_model = torch.nn.Sequential( *( list(model.children())[:-1] ) )print(new_model)
2021-08-24 21:54:59
3329
原创 keras没有用gpu训练,需要安装tensorflow-gpu
可以用如下代码检查tensorflow版本是否可用GPUimport tensorflow as tftf.test.is_gpu_available()由于没有安装tensorflow-gpu,使用keras无法利用GPU训练。需要安装tensorflow-gpu和keras
2020-12-20 18:58:38
868
转载 python “image file is truncated“
python PIL image "image file is truncated"问题解决方法方法1:删除truncated image方法2:from PIL import ImageFileImageFile.LOAD_TRUNCATED_IMAGES = True
2020-12-20 18:53:10
302
转载 多张eps合并成一张
(1)详情见原博客https://blog.youkuaiyun.com/weixin_43971980/article/details/96029952把生成图片的代码放在tex中 winedt顶部有个【Latex】按钮,再点击顶部的【dvi-ps】按钮 打开对应的.ps文件 在GSview点击【file-ps to eps】的时候,注意保存的文件名需要以.eps为后缀(2)如果想让figur...
2020-06-04 21:16:08
5472
原创 利用python的matplotlib画多个子图
import matplotlib.pyplot as plt# 比如画两个图plt.figure(figsize=(10,20)) #设置图片大小plt.subplot(2,1,1) #表示两行1列,第一个图....这里是画图的代码plt.subplot(2,1,2) # 第二个图....画图的代码其中子图的title可以用如下方法设置plt.gca(...
2020-06-04 21:15:52
707
原创 python删去非空文件夹
要删去这个文件目录folder_path,如下:import shutilshutil.rmtree(folder_path)
2020-04-05 16:45:46
293
原创 linux kill某用户下所有进程
想kill用户名name1下的所有进程,可以用如下命令killall --user name1ref:https://unix.stackexchange.com/questions/35131/kill-all-process-of-users-in-ubuntu
2020-03-21 18:34:11
2012
原创 python中df.to_csv中文乱码
df.to_csv(file_name,encoding="utf_8_sig")参考:https://blog.youkuaiyun.com/zhuzuwei/article/details/80890007
2020-03-12 15:56:15
2304
原创 seaborn画图,怎么调整图例
fig =seaborn.lineplot(....这里略)fig.legend(loc='center right', bbox_to_anchor=(1,0.1), ncol=1)ref:https://stackoverflow.com/questions/53733755/how-to-move-legend-to-outside-of-a-seaborn-scatterp...
2020-03-05 17:05:31
12399
原创 python numpy中给nan赋值,删去nan
array 是numpy中一个数组import numpy as np# 给nan赋值0array[ np.isnan(array) ] = 0# 筛掉nanarray[~ np.isnan(array) ]
2020-03-03 11:32:24
5226
3
原创 Linux统计当前文件夹下的文件个数
ls -l | grep "^-" | wc -lref:http://noahsnail.com/2017/02/07/2017-02-07-Linux%E7%BB%9F%E8%AE%A1%E6%96%87%E4%BB%B6%E5%A4%B9%E4%B8%8B%E7%9A%84%E6%96%87%E4%BB%B6%E6%95%B0%E7%9B%AE/
2020-03-02 14:04:27
228
原创 R中读取配置文件
config.yml内容为host : foo.example.com name : Foo Base user : user453 pass : zoomR中读取的代码为library(yaml)config = yaml.load_file("config.yml")参考:https://stackoverflow.com/questions/5272846...
2020-02-26 19:42:21
579
原创 scipy.optimize注意constraints
求解带有等式约束的最优化问题,遇到了Optimization terminated successfully. (Exit mode 0)参考了问题https://stackoverflow.com/questions/37791680/scipy-optimize-minimize-slsqp-with-linear-constraints-fails,找到了原因是constr...
2020-02-25 18:02:44
2048
原创 scipy中abnormal termination in LNSRCH
最近调用scipy.minimize函数时,用L-BFGS算法,但是遇到了如下报错ABNORMAL_TERMINATION_IN_LNSRCH看提醒知道可能原因是输入的gradient函数有误。再检查了几遍后,总算找到原因。目标是 max g(x),g(x)的梯度是 h(x)在输入到scipy.minimize中自己记得把目标函数改成了 -g(x),但忘记把梯度也乘以-1...
2020-02-24 14:08:55
2253
原创 github 版本回退
git log查看了commit_id后,resetgit reset --hard commit_id再推送到远程git push --force
2020-02-22 15:48:45
174
原创 GitHub上传大文件
最近需要把接近300M文件上传上去,找到了解决方法https://github.com/git-lfs/git-lfs,简单记录下。比如上传的文件是a.psd1.安装git lfs install2. 说明想对哪个文件用Git LFSgit lfs track "*.psd"git add .gitattributesgit commit -m "track ...
2020-01-06 17:29:07
1509
原创 R语言接受命令行参数
比如希望对try.R文件用如下命令行来运行Rscript try.R -a 1 -b astring其中参数a是整数,参数b是字符串,则在try.R文件中可以用library(getopt)spec <- matrix( c("aParameter", "a", 1, "integer", "bParameter", "b", 1, "characte...
2019-10-06 23:05:41
792
转载 latex subfigure跨页
转自:http://www.zeuux.com/blog/content/3671/宏包:\usepackage[centerlast]{caption2}\usepackage{subfigure}方案:使用两个图形环境,欺骗下LaTeX的计数器即可\begin{figure}\centering\subfigure[First Part...
2019-07-22 10:54:03
4781
原创 tensorflow学习记录
1.“Attempting to use uninitialized value” in variable initialization参考例子biases = tf.Variable(tf.zeros([1]))with tf.Session() as sess: print(sess.run(biases.initialized_value())) #注意:如果直...
2019-07-11 21:56:15
168
原创 seaborn画热力图坐标轴怎么显示中文和英文
热力图中横坐标/纵坐标包括中文,可用sns.set(font='LiSu')其中LiSu是字体。如何查看matplotlib包括哪些字体:from matplotlib.font_manager import fontManager import osfonts = [font.name for font in fontManager.ttflist if os...
2019-06-24 14:41:31
6354
1
转载 【R】删去data.frame中指定列名的列
比如df包含['a','b','c']列,想去掉'a'列subset(df, select = -a)https://stackoverflow.com/questions/6286313/remove-an-entire-column-from-a-data-frame-in-r
2019-06-19 14:10:35
15030
转载 【python画图】把图例放在图片外边
import matplotlib.pyplot as pltimport numpy as npx = np.arange(10)fig = plt.figure()ax = plt.subplot(111)for i in xrange(5): ax.plot(x, i * x, label='$y = %ix$' % i)plt.legend(bbox_...
2019-06-18 23:38:51
7276
转载 【python画图】画一条水平直线
import matplotlib.pyplot as pltplt.axhline(y=0.5, color='r', linestyle='-')plt.show()https://stackoverflow.com/questions/33382619/plot-a-horizontal-line-using-matplotlib
2019-06-18 23:34:55
39442
转载 python带有图例的散点图
rng = np.random.RandomState(0)for marker in ['o', '.', ',', 'x', '+', 'v', '^', '<', '>', 's', 'd']: plt.plot(rng.rand(5), rng.rand(5), marker, label="marker='{0}'".format(...
2019-06-17 23:44:34
4938
转载 Rstudio中显示循环的进度条
Rstudio中显示循环的进度条https://blog.youkuaiyun.com/wendaomudong_l2d4/article/details/78019514
2019-06-15 14:05:55
4029
转载 linux 把文件复制到另一台服务器上
复制文件scp file_name user_name@remote_ip:file_path复制文件夹scp -r file_name user_name@remote_ip:file_path转自:https://zhangxing119.iteye.com/blog/2149274
2019-06-03 14:44:10
4632
转载 linux查看该目录下文件夹大小
du -h --max-depth=1如果当前目录下文件和文件夹很多,使用不带参数du的命令,可以循环列出所有文件和文件夹所使用的空间。这对查看究竟是那个地方过大是不利的,所以得指定深入目录的层数,参数:--max-depth=,这是个极为有用的参数参考:https://www.cnblogs.com/benio/archive/2010/10/13/1849946.html...
2019-06-03 14:28:55
11591
转载 kill掉某用户名下所有进程(Kill all processes for a given user)
pkill -9 -u `id -u username`把这里的username替换成某用户名即可参考:https://stackoverflow.com/questions/15452081/kill-all-processes-for-a-given-user
2019-05-06 16:41:41
1122
1
原创 seaborn画热力图时行名中包括中文显示成方框
df该dataframe的行名是中文,可以加上下面代码中红色这句,就可以显示出中文import matplotlib.pyplot as pltimport seaborn as snssns.set(font="simhei")#遇到标签需要汉字的可以在绘图前加上这句f, ax = plt.subplots(figsize=(10,10))sns.heatmap(df, ...
2019-04-14 16:15:23
9789
原创 linux中后台运行R代码
以try.R为例,在此代码首行增加#! /usr/bin/env Rscript然后在命令行Rscript try.R &>nohup.out&ref:https://www.cnblogs.com/hunttown/p/5802082.html
2019-04-03 12:57:52
5212
转载 python 打开和阅读urls
importurllib #要伪装成的浏览器(我这个是用的chrome)headers=('User-Agent','Mozilla/5.0(WindowsNT6.1;WOW64)AppleWebKit/537.36(KHTML,likeGecko)Chrome/46.0.2490.86Safari/537.36')url='http://hotels.ctr...
2019-04-01 19:32:56
390
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人