Skip to main content


Showing posts from November, 2020

Notes on building site with Jekyll locally

One can follow Ref. [1] to build up site with Jekyll - it contains quite a few steps concerning the set-up of sites through GitHub pages. However, this is not necessary if one just wants to set up site locally and test. Therefore, after installing Ruby and Bundle, one can directly create a local folder and go into it. From there, one needs to follow the steps given below, Run bundle init  - this will create the Gemfile . According to Ref. [1], GitHub pages depends on certain version of packages (a link can be found there in Ref. [1] about details) and therefore one may need to install certain version of Jekyll with Bundle (though, again this may not be necessary if one only wants to do it locally). To install a certain version of Jekyll with Bundle, one need to put in the following line into Gemfile , gem 'jekyll', '3.9.0'  Then one needs to execute bundle install  to install the required version of Jekyll. At this stage if one continues, as instructed in Ref. [1], to e

Notes on kernel density estimation (KDE)

With a collection of data, we may want to extract or estimate the underlying distribution model. For example, we have the collection of house price in a certain area, we want to have an idea about how the house price in that area is distributed. However, without a priori knowledge about what the model that distribution should follow, we cannot follow the so-called parameterized way for estimating the distribution. In that way, we know beforehand about what the distribution model should be and it's just some parameters yet need to be determined. Then we can do the commonly used least-square fitting to obtain those unknown parameters. However, it is usually the case where we have no knowledge about what the distribution model should look like, in which case we need a non-parameterized approach to estimate the underlying distribution, e.g. the histogram method and the one we are going to focus here: kernel density estimation (KDE). Here is the formulation of KDE, \[\hat{f}(x_0) = \fra

Notes on setting up web host with Python Flask

☝Introduction We follow the tutorial given in Ref. [1, 2] for setting up the web host using Python Flask module. Details will not be reproduced in current blog step by step. Instead, we will focus on 1) some key aspects to make step description clearer and 2) steps where error can easily occur. First, we give all the necessary recipes, as follows, Flask - Python web server uWSGI - Sitting in the middle between Flask and Nginx for connection purpose. Nginx - Facing outwards to receive request. and we will configure the web host on CentOS 7. Traditionally, we have the web server hosts files in specific location on the server (e.g. /var/www) and then we will have, e.g. the Apache HTTP server to listen to user request (through a certain port, e.g. 80) and fetch certain files stored in specific location on the server and then send back to users' browser. When using Python to set up web host, we have one more layer for the connection between files on the server to be visited and users. T