1. word2vec train procedure explained

    Abstract

    This article gives a detailed explanation of the weight vector updates in word2vec C implementation.

    And find some not correct procedures that used train skip-gram model in the code.

    Introduction

    Word2vec is a famous word embeddings approch. See detailed at Word2vec

    Prerequisite

    some properties of sigmoid function

    (0)

    $$ \sigma' (y) = \sigma (y) \cdot [ 1 - \sigma (y) ] \cdot y' $$

    Read more...


  2. test render math

    Test render latex math using plugin render_math

    inline latex \( log'(x) = \frac{1} {x}\)

    div latex

    $$ \sigma'(x) = \sigma(x) \cdot [ 1 - \sigma(x) ] $$

    Read more...


  3. 使用tesseract-ocr和opencv识别视频中文字

    Abstract

    本文使用tesseract-ocr和opencv提取B站2015年舞蹈总排行榜视频中的Id号, 然后使用you-get工具下载提取到的视频。视频包下载地址见Result

    Introduction

    在B站看到有人出了2015年舞蹈区总排行榜TOP100视频(链接),看完视频感觉都还不错, 有些还没看过,想着既然能在这个排行榜上,那就应该不错,值得下载下来收藏。

    那怎么把里面的视频下载下来呢?

    我的思路是这样的: 1. 排行榜视频中提到的所有舞蹈区视频都贴上了Id号,就是av后面跟的六位数字。 2. 获取到Id号,通过you-get(官网)工具将相应视频下载下来。

    那怎么获取视频的Id呢?

    简单的做法是对着排行榜视频,一个一个的手动记录下来。 这种方法精确率应该能达到100%,但是伤害眼睛。

    程序猿可是要好好保护眼睛的。

    也学了4, 5年coding了,想着通过程序能不能提取出排行榜视频里的所有Id号。

    Implementation

    有了想法,当然也要有方法。

    想到之前在cloudera blog上看到的一篇文章 ...

    Read more...


  4. Spring Rest server and Apache Avro objects

    1. Error handle class

    @ControllerAdvice
    public class ErrorHandler {
        @ExceptionHandler(value = Exception.class)
        @ResponseStatus(HttpStatus.BAD_REQUEST)
        @ResponseBody
        public ErrorResponse errorResponse(Exception exception) {
            return exception.getMessage();
        }
    }
    

    then we can got clear error message

    Reference

    http://www.importnew.com/7903.html

    2. Change response's content-type

    @RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE ...

    Read more...


  5. C++ link and library usage

    When use a programming language produtively, We need use third parties libraries.

    If we install libraries and header files in /usr/lib, /usr/local/lib and /usr/include/, /usr/local/include, compilers will find them automatically. But when libraries and headers are not in system paths, How do you tell ...

    Read more...


  6. backslash in C++

    Use backslash to format long long lines. Oops, I nerver use it in C++.

    How to use backslash?

    This is an example:

    #include <iostream>
    #include <string>
    int main() {
        int a = 1, \
                b = 2;
        int c = 3,
            d = 4;
        std::string s = "fffff" \
                         "fffff\\n"; // right
        std::string s2 = "fffff"
            "fffff ...

    Read more...


  7. PEPS doc Kindle版本

    介绍

    Python上遇到的很多问题搜到最后经常链接到PEP, 觉得PEPS需要研读一下. 一时半会儿看不完的东西总想着放到Kindle里看(很有可能不会再看), 于是 就制作了这个mobi版本的Python Enhancement Proposals.

    下载地址

    过程

    hg clone下来, 然后转成html. 使用代码解析html, 用kindlegen生成 mobi文件.

    吐槽:

    1. Python官方积极推动代码移植到Python 3, 可peps中的转换代码都是 老版本的Python 2
    2. kindlegen的-c2选项很占用CPU, 且处理时间臭长, 但生成文件体积 变化并不大
    3. PEP的两种格式处理起来带来不少麻烦, 并且其生成的html文档结构 很简单, 没有程序处理需要的元信息.

    TODO

    本来应该按照分类做成类似期刊格式的文档, 但时间不够用, 没有制作 期刊的模板, 以后有时间再做.

    应该免去转成html那一步, 直接利用原生格式, 需要学习PEP文档的两种 格式.

    Python应该统一PEP格式, 把两种格式使用程序转成一种.

    Read more...


Page 1 / 3 »