👋 Welcome to Scott’s Tech Doc

Hi, this is Scott. I’m documenting my learning notes in this blog. Currently, I’m a PhD student at Purdue, see my research homepage for more information.

Loss functioin in neural network

Kullback-Leibler divergence Information theory Quantify information of intuition1 Likely events should have low information content Less likely events should have higher information content Independent events should have additive information. For example, finding out that a tossed coin has come up as heads twice should convey twice as much information as finding out that a tossed coin has come up as heads once. Self-information $I(x)=-\log P(x)$ Deals only with a single outcome Shannon entropy $H(\mathrm{x})=\mathbb{E}_{\mathrm{x} \sim P}[I(x)]=-\mathbb{E}_{\mathrm{x} \sim P}[\log P(x)]$ Quantify the amount of uncertainty in an entire probability distribution KL divergence and cross-entropy Measure how different two distributions over the same random variable $x$ $D_{\mathrm{KL}}(P | Q)=\mathbb{E}_{\mathrm{x} \sim P}\left[\log \frac{P(x)}{Q(x)}\right]=\mathbb{E}_{\mathrm{x} \sim P}[\log P(x)-\log Q(x)]$ Properities Non-negative....

October 13, 2020 · 2 min · Scott Du

在服务器上部署 Jupyter Notebook

安装 Ananconda 使用命令行安装 1 wget wget https://repo.continuum.io/archive/Anaconda3-5.2.0-Linux-x86_64.sh 注意,选择安装路径时,如果想要所有用户都能使用,则安装在usr/local/ananconda3目录下 注意修改/etc/profile.d下的conda.sh,指定环境变量(在登入另外的用户时会提醒) 更改源。创建~/.condarc文件,输入 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 channels: - defaults show_channel_urls: true channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda default_channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2 custom_channels: conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud 至此,已经完成 python、conda 及 jupyter-notebook 的安装。 部署远程云服务 生成Jupyter Notebook配置文件 1 jupyter notebook --generate-config 生成的配置文件,后来用来设置服务器的配置...

April 22, 2020 · 1 min · Scott Du

使用 Hugo 进行持续集成写作及同步

我们通常会在本地计算机上写 Markdown 文件,然后使用 Hugo 建立静态博客网站。因此需要一种方法将本地文件同步到服务器上,同时实现 GitHub 集成,确保网站的可维护性。我使用了 Git hook 的方法进行同步与集成。 服务器上 更新 1 2 3 yum update yum install nginx yum install git 新建 hugo 用户: 1 2 adduser hugo passwd hugo 安装 hugo 安装 go 1 2 yum -y install golang go version 源码安装 1 2 3 4 5 mkdir $HOME/src cd $HOME/src git clone https://github.com/gohugoio/hugo.git cd hugo go install --tags extended yum 安装 有些主题需要支持sass/scss功能,如果使用 yum 安装 hugo,则没办法安装extend版本,会导致编译失败。...

January 22, 2020 · 2 min · Scott Du

Go Hugo!

在 2020 年的春节前夕,我终于完成了博客从 Hexo 到 Hugo 的迁移。期间踩过不少坑,也有不少小朋友来问我如何开始进行个人博客写作,因此觉着是时候写点东西记录记录。 Why Hugo 正式开始写个人博客,是两年前的春节。最开始使用了当时最流行的 Hexo 框架,选择了 Next 主题。最开始一切都很好,虽然 Hexo 框架是简单了点,但耐不住有很多热心的开发者开发了很多插件,所以基本上都能满足自己的需求。而随着博客数量越来越多,我发现 Hexo 的问题越来越让我难以忍受,那就是:速度太慢。 举个例子,当我有 200 多篇博客的时候,用 Hexo 渲染静态网页需要将近 20 秒,这样的速度简直是不可接受的。更不要说我还有大量的静态图片、资料等等。同时,由于自己偷懒,博客中使用的图片都来自于图床,这些外链不受我控制,很多时候有打不开、加载慢的问题,让我这个强迫症觉得很不爽。 因此2019年底,我萌发了重构个人博客的想法,一眼就看中了用 Go 语言写的 Hugo,其Slogan The world’s fastest framework for building websites也是非常吸引我。更难能可贵的是,Hugo 虽然还处于快速迭代开发的阶段,但并不是一个半成品,很多在 Hexo 上需要插件实现的功能,Hugo 上都内置了。 Hugo vs Hexo 为了方便 Hexo 用户快速上手 Hugo,我总结了 Hugo 与 Hexo 的异同点(大部分来源于官网及这篇博文)。 结构组织 1 2 3 4 5 6 7 8 9 10 11 12 ~/blog $ tree -L 1 ....

January 21, 2020 · 2 min · Scott Du

Laravel Homestead 安装小记

环境配置 在Laravel官网上,推荐使用Laravel Homestead虚拟机部署安装环境。Homestead是Laravel官方提供的基于Vargrant的Box,也就是虚拟机原型系统,预装了一切 Laravel 需要的东西。 这里使用VirtualBox虚拟机,而Vagrant是一个虚拟机管理工具。 配置Laravel环境的主要步骤有: 安装VirtualBox和Vagrant 安装Homestead Vagrant Box 安装Homestead(Clone 项目) 修改配置文件(Homestead.yaml和/etc/hosts) 启动虚拟机,SSH登陆虚拟机 下载Laravel 安装VirtualBox和Vagrant 直接官网安装dmg即可: VirtualBox 下载地址 Vagrant下载地址 验证是否安装成功在终端使用以下命令行,显示版本信息就 OK 了。 1 vagrant -v 安装 Homestead Vagrant Box 在线安装 直接输入以下命令行: 1 vagrant box add laravel/homestead 这个步骤相当于下载虚拟机的预装系统,下载文件超过1个G,实测非常慢,及时是挂VPN,也太慢。 离线导入 下载Box 最后我选择了首先下载.box文件,然后导入的方式。 在Vagrant官网进入Homestead box,选择最新的版本,例如8.2.1,然后进入该版本页面,如https://app.vagrantup.com/laravel/boxes/homestead/versions/8.2.1,直接在后面添加/providers/virtualbox.box组成完整的URL,即可使用迅雷等下载工具进行下载,完整的URL为: https://app.vagrantup.com/laravel/boxes/homestead/versions/8.2.1/providers/virtualbox.box 下载完成后得到virtualbox.box的文件,在命令行中进入该文件的目录,然后输入以下命令即可成功导入。 vagrant box add laravel/homestead ./virtualbox.box 导入 注意,这里导入时vagrant并不知道版本信息。因此,我们需要进入box的文件夹,手动增加版本信息。...

October 11, 2019 · 1 min · Scott Du