首先, R似乎默认所有的变量都为向量vector, 即使一个单独的数字也是长度为1的, 所以1等价于c(1).

> a <- 1
> a
[1] 1
> length(a)
[1] 1
> a[1]
[1] 1
> typeof(a)
[1] "double" # means "double vector" (I think)
> 1 == c(1)
[1] TRUE

fancy indexing

R的vector/list/matrix支持类似numpy(稍有不同)的fancy indexing, 以下是例子:

> v <- 1:10
> v[1:3 ...

这个"从入门到放弃"系列是为了应付eth的computational statistics这门课... 对R无爱...

terminology

首先在stat里面有一些叫法和以前不太一样:

  • predictor variable: 就是机器学习里面说的feature (Xi)
  • design points: 是机器学习里的训练数据(X1...Xn)
  • response variable: 要预测的变量(y)

Rstudio

这个是用R编程的标配, 确实很方便, 不用可惜. 另外R markdown也不错, 可以边写markdown边运行代码, 建议编辑器窗口里新建rmd文件.

  • 默认有四个窗口: 编辑器, 变量, 命令行, 画图/帮助.

快捷键

一些常用的快捷键:

  • alt+-: 用于输入赋值符号<-
  • (编辑器窗口中) ctrl+enter: (在console里)执行光标所在的行, 等同于按钮"run"
  • (r markdown编辑器窗口中) ctrl ...

问题: 现在本地ssh连接eth的daint服务器, 连接需要进行两次ssh: 第一次本地连接到ela服务器, 第二次从ela再次ssh到daint. 现在配置本地的ssh代理使之可以一次完成.

第一步: 生成sshkey

ssh-keygen
cat ~/.ssh/id_rsa.pub | ssh your_username@ela.cscs.ch 'cat >> ~/.ssh/authorized_keys'
ssh your_username@ela.cscs.ch

第二步: 修改.ssh/config文件内容

用文本编辑器打开.ssh/config文件, 添加如下内容:

Host daint
    Hostname daint101
    User your_username
    ForwardAgent yes
    ForwardX11 yes
    Port 22
    IdentityFile ~/.ssh/id_rsa ...

4.1 - Objects Everywhere

scala is pure OO: every value is an obj, every operation is a method of obj.

scala.Int scala.Boolean maps to JVM standard primitive types.

Implement Boolean withous primitive type in scala:

Then defin false and true as objects, give implementation for ifThenElse() funciton:

object ...

This week, we'll cover traits, and we'll learn how to organize classes into hierarchies. We'll cover the hierarchy of standard Scala types, and see how to organize classes and traits into packages. Finally, we'll touch upon the different sorts of polymorphism in Scala.

3.1 - Class ...

This week, we'll learn about functions as first-class values, and higher order functions. We'll also learn about Scala's syntax and how it's formally defined. Finally, we'll learn about methods, classes, and data abstraction through the design of a data structure for rational numbers.

2.1 ...

In this week, we'll learn the difference between functional imperative programming. We step through the basics of Scala; covering expressions, evaluation, conditionals, functions, and recursion

1.1 - Programming Paradigms

imperative programming:

  • modify mutable variables
  • using assignments
  • control structures: if-else, loops, break, continue, return, etc.

~~~> Von Neumann computer:

conceptualize data ...

Get up and running with Scala on your computer. Complete an example assignment to familiarize yourself with our unique way of submitting assignments.

Tool setup

IntelliJ

use worksheet as a better REPL

SBT

navigate to the directory of the assignment you are working on, then start sbt. (when first running ...

problems with text:

  1. often very rare word is important, e.g. retinopathy
  2. ambiguity: e.g. cat and kitty

→ need a lot of labeled data ⇒ not realistic.
unsupervised learning

similar words appear in similar context.
embedding: map words to small vectors

measure the closeness by cosine distance:

word2vec

initial: random vector ...

statistical invariance → weight sharing
e.g. image colors, translation invariance...

convnet

is NNs that share their weights across space.

convolution: slide a small patch of NN over the image to produce a new "image"

convnet forms a pyramid, each "stack of pincake" get larger depth and smaller area.

convolutional lingo ...