↓ Skip to main content

Posts

2017

poj 2417 Discrete Logging (BSGS算法)

·528 words·2 mins
题目链接 题意: Given a prime P, 2 <= P < 231, an integer B, 2 <= B < P, and an integer N, 1 <= N < P, compute the discrete logarithm of N, base B, modulo P. That is, find an integer L such that BL == N (mod P) 思路:bsgs算法 详情见BSGS算法笔记 然后被map的count坑了一下? 我想判断map中某个key是否存在,用count会TLE,find也会TLE,[]可以通过….不太懂,复杂度不都是log吗,差常数?还是有人会退化?

stanford cs 231n:常用激活函数

·2596 words·6 mins
其实我觉得这部分可以直接黑箱。。。直接无脑上Leaky ReLU或者Maxout?不过对这些激活函数的特点有个high-level的了解应该总是没坏处的,只要别太纠结细节就好了吧。。 # 每个激活函数(或非线性函数)的输入都是一个数字,然后对其进行某种固定的数学操作。下面是在实践中可能遇到的几种激活函数:

Inception-v4,Inception-ResNet 和残差连接对学习的影响

·6449 words·13 mins
原始论文 翻译链接 **——前言:**作者认为残差连接在训练深度卷积模型时是很有必要的。至少在图像识别上,我们的研究似乎并不支持这一观点。 摘要: 近年来,深度卷积神经网络对图像识别性能的巨大提升发挥着关键作用。以Inception网络为例,其以相对较低的计算代价取得出色的表现。最近,与传统结构相结合的残差连接网络在2015ILSVRC挑战赛上取得非常优异的成绩;它的性能跟最新的Inception-v3 网络非常接近。因此也就引出了结合残差连接的Inception结构能否对性能进行提高的问题。本文给出实验证明,残差连接可以明显加速Inception网络的训练。同时实验也证明,相比没有残差连接的消耗相似的Inception网络,残差Inception网络在性能上具有微弱的优势。针对是否包含残差连接的Inception网络,本文同时提出了一些新的简化网络。这些网络的变体在ILSVRC2012分类任务上很明显的改善了单一框架的识别性能。本文进一步展示了适当的激活缩放如何使得很宽的残差Inception网络的训练更加稳定。本文通过对三个残差和一个Inception-v4进行组合,在top-5错误率上达到了 3.08%。

几种梯度下降(GD)法的比较(转载)

·1089 words·3 mins
参考资料 机器学习中梯度下降(Gradient Descent, GD)算法只需要计算损失函数的一阶导数,计算代价小,非常适合训练数据非常大的应用。 梯度下降法的物理意义很好理解,就是沿着当前点的梯度方向进行线搜索,找到下一个迭代点。但是,为什么会派生出 batch、mini-batch、online 这些 GD 算法呢?

archlinux/manjaro 下 安装 qq/tim

·580 words·2 mins
参考资料:install qq/tim on linux with wine wine运行qq不能输入账号 This tutorial introduces how to install QQ/TIM in Linux with Wine, which had been tested on ArchLinux with Wine 2.4. Prerequisites # Before start, you need to get the latest Wine. I’m not sure whether QQ/TIM can run on lower version of Wine. In ArchLinux, you can easily get the latest Wine using following command: 1pacman -S wine However, in Debian, you need to install Wine with some more steps. You can see this tutorial.

libgfortran.so.4 missing under archlinux

·919 words·2 mins
。。。哭了哦,终于解决了这个 bug 参考资料: libgfortran broken? libgfortran=3.0 should not be install with numpy <= 1.9 [SOLVED] libgfortran.so.3:cannot open shared object file: No such file [Replacing gcc-libs-libs with gcc-multilib arch conflict with gcc-libs and gcc-libs-multilib on latest update 一开始以为是 anaconda 相关,搞了半天。 然后又按照第一个资料里说的,试图把 libgfortran 用 libgcc 替代。

manjaro installation guide

·2918 words·6 mins
20180214 update: 第一个版本已经比较久了,于是更新一下,顺便写了个脚本orz 1pacman-mirrors -c China 2echo " [archlinuxcn] " >> /etc/pacman.conf 3echo " SigLevel = Optional TrustedOnly " >> /etc/pacman.conf 4echo " Server = https://mirrors.ustc.edu.cn/archlinuxcn/\$arch" >> /etc/pacman.conf 5 6 7echo "[arch4edu]" >> /etc/pacman.conf 8echo "SigLevel = Never" >> /etc/pacman.conf 9echo "Server = http://mirrors.tuna.tsinghua.edu.cn/arch4edu/\$arch " >> /etc/pacman.conf 10pacman -Syyu 11pacman -S archlinuxcn-keyring 12 13pacman -S yakuake fish gvim 14pacman -S google-chrome chromium 15pacman -S wget aria2 remarkable netease-cloud-music 16pacman -S fcitx fcitx-configtool fcitx-sogoupinyin fcitx-im kcm-fcitx 17pacman -S shadowsocks-qt5 18pacman -S wqy-microhei wqy-microhei-lite wqy-bitmapfont wqy-zenhei ttf-arphic-ukai ttf-arphic-uming adobe-source-han-sans-cn-fonts 19 20cat >> ~/.xprofile <<EOF 21export GTK_IM_MODULE=fcitx 22export QT_IM_MODULE=fcitx 23export XMODIFIERS="@im=fcitx" 24EOF 出于目前对manjaro的依赖,以及没有找到很简单易行的备份系统的方案的原因,决定详细记录一下系统安装的过程,以防哪天系统挂掉了,可以快速恢复。

conda升级anaconda ValueError的解决办法

·121 words·1 min
conda update anaconda 后提示 1ValueError: unsupported format character ')' (0x29) at index 49 查到了这个:anaconda update issue I have narrowed this down to the following packages: package build psutil-1.2.1 py27_0 hard-link pycparser-2.10 py27_0 hard-link pykit-0.1.0 np18py27_2 hard-link pyparsing-2.0.1 py27_0 hard-link by calling "conda install anaconda" and then successfully installing everything else one at a time. These four packages consistently exhibit the described behaviour. (note: pykit depends on pycparser so may itself be ok - can't tell) 我先把psutil卸载掉,重新update了一下,成功。

vim下python 的配置

·817 words·2 mins
由于最近要做数字图像处理的大作业,以及之后一段时间,估计写python多一些,所以打算花些时间配置下vim. # 1. 一键执行 # 其实之前一直有的。。不过没有效果,就没有管。发现问题是,python对应的filetype为"python",而不是"py" # 1func! CompileRunGcc() 2 exec "w" 3 if &filetype == 'c' 4 exec "!g++ % -o %<" 5 exec "! ./%<" 6 elseif &filetype == 'cpp' 7 exec "!g++ % -std=gnu++11 -Wall -o %<" 8 exec "! ./%<" 9 elseif &filetype == 'java' 10 exec "!javac %" 11 exec "!java %<" 12 elseif &filetype == 'sh' 13 :!./% 14 elseif &filetype == 'python' 15 " exec "!python %" 16 " exec "!python %<" 17 exec "!python2.7 %" 18 endif 19endfunc 2.代码补全 # 不想折腾了。。既然ycm也支持python,就先用用看好了。。不行再换别的。 # 放一段ycm for python的配置文件 # 1"默认配置文件路径" 2let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py' 3"打开vim时不再询问是否加载ycm_extra_conf.py配置" 4let g:ycm_confirm_extra_conf=0 5set completeopt=longest,menu 6"python解释器路径" 7let g:ycm_path_to_python_interpreter='/usr/bin/python' 8"是否开启语义补全" 9let g:ycm_seed_identifiers_with_syntax=1 10"是否在注释中也开启补全" 11let g:ycm_complete_in_comments=1 12let g:ycm_collect_identifiers_from_comments_and_strings = 0 13"开始补全的字符数" 14let g:ycm_min_num_of_chars_for_completion=2 15"补全后自动关机预览窗口" 16let g:ycm_autoclose_preview_window_after_completion=1 17" 禁止缓存匹配项,每次都重新生成匹配项" 18let g:ycm_cache_omnifunc=0 19"字符串中也开启补全" 20let g:ycm_complete_in_strings = 1 3. 语法检查 # Syntastic大家都知道了。。。。看到了异步检测插件ALE,打算试一下。 # ale_github # 需要注意的是,这个插件需要vim 8.0+的特性。。。 # 放一波配置文件 # 1""""""""""""""""""for ale begin """""""""""""""" 2let g:ale_sign_column_always = 1 "保持侧边栏可见: 3 4let g:ale_sign_error = '>>' "改变错误和警告标识符 5let g:ale_sign_warning = '--' 6let g:ale_statusline_format = ['⨉ %d', '⚠ %d', '⬥ ok'] "改变状态栏信息格式 7 8"自定义跳转错误行快捷键: 9nmap <silent> <C-k> <Plug>(ale_previous_wrap) 10nmap <silent> <C-j> <Plug>(ale_next_wrap) 11"消除某excption not caught的警告 12let g:ale_emit_conflict_warnings = 0 4. 编程提示(jedi-vim) # 据说是vim写python的神器。。。装来看看。。。 # 据说默认配置就够了,先不折腾了 # # #

vundle error detected while processing function

·302 words·1 min
好久没装新插件了,最新要配下python,发现安装时候满屏的错误。。。 # 最后发现是shell的锅,因为我用的是fish,在.vimrc文件中添加 # 1set shell=/bin/bash 即可。 # 以及说下可能的其他原因,虽然我没遇到 # * 对于arch系,可能从aur中安装的版本out ot data * 可能没有把.vimrc中vundle的配置从set rtp+=~/.vim/bundle/vundle更新成set rtp+=~/.vim/bundle/vundle.vim * 可能项目名称用了" 而不是' 以及顺手查了下bundle和Plugin的区别。。。 # 简单来说。。Plugin是新写法,bundle是正在被淘汰的写法,不过由于兼容性的原因,仍然在使用。。。 # 以后使用plugin的写法就好。 # 参考资料

边界的链码,归一化链码,差分玛,形状数

·1630 words·4 mins
复习一下数字图像处理。 # 按照我自己的理解简单来说: # 原链码:按照任意起点走边界一周,方向按照上图对应的表示,得到的数字序列就是原链码。 # 归一化链码:为了解决原链码中起点不唯一而产生的序列不唯一的问题,规定,对于所有起点得到的原链码中,字典序最小的即为归一化链码(由于序列都是自然数,因此字典序最小也可以理解成,把该序列看成有前导0的自然数之后的数值最小)。 # 差分码:为了解决图形旋转之后,原链码和归一化链码都会发生变化,引入差分码。n 位原链码(或归一化链码,由于归一化链码只是一种特殊的原链码,之后不再单独强调)可以得到 n-1 位差分码。具体来说,对于原链码 a[i](i 属于 1..n),可以得到差分码 b[i],b[i] = ((a[i+1] - a[i]) + mod) % mod(i 属于 1..n-1),mod 根据实际有几个方向决定,通常为 4 或者 8。 # 形状数:需要强调的是,形状数也是一个序列,而不是一个数。其实形状数就是把差分码按照字典序排序之后,最小的序列。形状数的阶数是该序列的长度。 # Freeman链码(弗雷曼链码)是指用曲线起始点的坐标和边界点方向代码来描述曲线或边界的方法,常被用来在图像处理、计算机图形学、模式识别等领域中表示曲线和区域边界。它是一种边界的编码表示法,用边界方向作为编码依据,为简化边界的描述,一般描述的是边界点集。

qt 5.x 初探 (5) 

·166 words·1 min
qt_5.9_ui_doc 还是比直接写代码方便点。。。所以不妨学习一个! 以及。。。qt在2017年6月1号发布了5.9。。。所以之前是5.8。。。现在变成5.9了。。。 遇到了修改了ui文件却没有生效的问题。。。

关于恋爱模式的一点思考

·790 words·2 mins
最近和妹子闹了一点小矛盾,不过已经problem solved. 大概是因为,我聊到了妹子很不喜欢的话题,导致妹子情绪变得负面而我还没意识到… 我是感觉…就像写代码一样,代码没有bug(初始时)是不太现实的,关键是要debug?