{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Why I say Chinese are so bad for learning programming?\n",
    "\n",
    "因为作为一门语言，它的侧重点不是简单直白，而是拐弯抹角、含蓄隐晦"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "___"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Why you should always use English? (讲英语的几个好处)\n",
    "\n",
    "1. **提升自信** (学英语会花费大量的时间和精力，如果你连这都能坚持下来，还有什么脑力活动是你不能做到的？\n",
    "\n",
    "2. **帮助理解** (对同一个事物用不同的方式去阐释，充分地理解事物间的差异，这是认识事物最有效的方法\n",
    "\n",
    "3. **获得更多资源** (你不会想要被垄断知识，你不会想要生活在一个封闭的圈子，你不会想做一只井底之蛙"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "___"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### So？\n",
    "\n",
    "> 我不仅仅是在教你技术，还在教你如何学英语，怎样使用英语"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "___"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### The benifits you can get from Video Tutorials (视频教学的缺优点)\n",
    "\n",
    "缺点：效率不够高、吸收速度较慢、受制于讲述者的口语表达能力\n",
    "\n",
    "优点：形象化、易于模仿，同时能清晰的表达人的思维过程(书写能力强的人也可以用文字表达清楚他们的想法)\n",
    "\n",
    "不管怎么说，都是看表达能力（但要和学校的语言教育区分开来，学校并不 care about what you can say actually)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "___"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### What's the mission today? (今天的任务）\n",
    "\n",
    "Setting up the Machine Learning environment for Lubuntu:\n",
    "\n",
    "* Install python3, python3-pip, git, jupyter\n",
    "\n",
    "* Install scikit-learn, Tensorflow, Keras, GPU, ..."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "___"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 安装前要介绍我们的神器 (Before we get started, let me introduce you `apt`)\n",
    "\n",
    "`apt` is the abbreviation of `Advanced Package Tool`\n",
    "\n",
    "Basic usage is: `sudo apt install <package_name>`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "___"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Let's do this, section 1! (开始了1）\n",
    "\n",
    "```\n",
    "sudo apt -y install python3\n",
    "sudo apt -y install python3-pip\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "___"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Let's do this, section 2! (开始了2）\n",
    "\n",
    "```\n",
    "sudo apt -y install git\n",
    "```\n",
    "\n",
    "1. https://github.com/yingshaoxo/How-to-do-sentiment-analysis-for-comments\n",
    "\n",
    "2. https://github.com/yingshaoxo/How-to-do-sentiment-analysis-for-comments.git\n",
    "\n",
    "3. `git clone https://github.com/yingshaoxo/How-to-do-sentiment-analysis-for-comments.git`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "___"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Let's do this, section 3! (开始了3）\n",
    "\n",
    "```\n",
    "sudo apt -y install jupyter\n",
    "jupyter notebook\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "___"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Let's do this, section 4! (开始了4）\n",
    "\n",
    "```\n",
    "sudo pip3 install scikit-learn Tensorflow Keras\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "___"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 熟悉下编程环境\n",
    "\n",
    "上节课我们只是配置好了硬件环境，这节课才是真正开始教大家如何 getting familiar with coding env."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "___"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['.gitignore',\n",
       " '.git',\n",
       " 'LICENSE',\n",
       " '.ipynb_checkpoints',\n",
       " '0.ipynb',\n",
       " 'Tools.sh',\n",
       " '1.ipynb',\n",
       " 'README.md']"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import os\n",
    "os.listdir('.')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.ipynb\n",
      "1.ipynb\n",
      "LICENSE\n",
      "README.md\n",
      "Tools.sh\n"
     ]
    }
   ],
   "source": [
    "from auto_everything.base import Terminal\n",
    "t = Terminal()\n",
    "\n",
    "text = t.run_command('ls')\n",
    "print(text)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "WARNING: apt does not have a stable CLI interface. Use with caution in scripts.\n",
      "\n",
      "Reading package lists...\n",
      "Building dependency tree...\n",
      "Reading state information...\n",
      "python3 is already the newest version (3.6.5-3).\n",
      "0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "t.run(\"sudo apt install python3\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "___"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### GPU (graphics processing unit) ?\n",
    "\n",
    "装 GPU 是浪费生命\n",
    "\n",
    "1. hard to download\n",
    "\n",
    "2. hard to install"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://developer.nvidia.com/cuda-90-download-archive\n",
    "\n",
    "`sudo sh cuda_9.0*`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://developer.nvidia.com/rdp/cudnn-download\n",
    "\n",
    "```\n",
    "# install cudnn libraries\n",
    "tar -zxf cudnn*.tgz\n",
    "cd cuda\n",
    "sudo cp lib64/* /usr/local/cuda/lib64/\n",
    "sudo cp include/* /usr/local/cuda/include/\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "添加下列文本到 `~/.profile`:\n",
    "\n",
    "```\n",
    "export PATH=${PATH}:/usr/local/cuda-9.0/bin\n",
    "export CUDA_HOME=${CUDA_HOME}:/usr/local/cuda:/usr/local/cuda-9.0\n",
    "export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda-9.0/lib64\n",
    "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/extras/CUPTI/lib64\n",
    "\n",
    "export PATH=/usr/local/cuda/bin:$PATH\n",
    "export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "`nvidia-smi`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "___"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### In the end (在最后)\n",
    "\n",
    "I hope you enjoy this video"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
