Xiaofei Sun

In Knowledge We Trust

一些基本的习惯

或——程序员基本素养

1. 问题搜索 首先树立一个概念:我们日常碰到的问题,分为两类:第一类是常见但是只是我们自己不常用因此不知道具体方法的问题;第二类是当我们对一个领域熟知精深后发现的问题。第一类问题构成了大部分业务上的场景,因此请相信大多数的问题至少曾经有人碰到过,这时候要先充分搜索;第二类问题可能我们踩到了一个坑里,这时候可能没人遇到过,但是也需要先确认这一点,否则很容易走弯路。 其实上面的事情还...

Matplotlib字体设置

matplotlib字体机制、字体缓存、修改字体、中文字体设置

简单记录一下今天在matplotlib中尝试切换字体的过程 1. matplotlib 的字体机制 我们举一个简单地例子 假设我们写了这样一段代码: from matplotlib import pyplot as plt plt.plot(range(10)) plt.title("哈哈") plt.show() 如果在一台普通的电脑上运行,会有如下结果: 我们显然可以...

Query Large Table in Go

Use go routine to accelrate query mysql in go

Take home message1: Query DB by bucket and use go routine to parallel them. Take home message2: All code is on Adoni/golang-query-large-table · GitHub Sometimes we need to load data from ...

Plot on Remote Server

Plot on server, show locally

For lots of data scientist or ML researchers, matplotlib, the popular Python-based graphing library, is one of the most useful tool for visualization. For example, use the code below can draw a str...

Python Coding Practice

I didn't say it's the best practice, so you know ...

Concurrent and multi-process It’s common to use services to do something in a company. In this situation, we want to use multiple processing to handle traffic delay. from concurrent.futures import...

Understand SVM (1)

In last post we introdue SVM. Now we want to solve it. Lagrangian Theory This section is based on the content of book Convex Optimization. Generally speaking, Lagrangian Theory can be used t...

Understand SVM (1)

In this post I gonna write something to understand SVM. Thanks to Professor Francesco Orabona’s explain and most content of this post is learned from his course Convex Optimization. What’s SVM SV...

Word2vec with Pytorch

In this post, we implement the famous word embedding model: word2vec. Here are the paper and the original code by C. Word2vec is so classical ans widely used. However, it’s implemented with pure C...

Badminton: Warming-up and Stretching

Translated from [here](http://bbs.badmintoncn.com/forum.php?mod=viewthread&tid=759835)

Neck Before turning your neck around, please do the following action first: Shoulder-Arm-Wrist Leg-Ankle

Tricks for Jupyter Notebook

Some tricks or interesting aspects of Jupyter Notebook

Profiling Firstly, install line_profiler. pip install line_profiler You can find more information about line_profiler in its GitHub repo. Sencondly, run this command (which is called magic) in ...