From a52226cd70b58e686f3d48d360956602458ef38e Mon Sep 17 00:00:00 2001 From: rasbt Date: Wed, 16 Jul 2014 17:41:08 -0400 Subject: [PATCH 1/4] small wording change in closure-section --- tutorials/not_so_obvious_python_stuff.ipynb | 55 +++++++++++++++++++-- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/tutorials/not_so_obvious_python_stuff.ipynb b/tutorials/not_so_obvious_python_stuff.ipynb index c2e2948..a3188b0 100644 --- a/tutorials/not_so_obvious_python_stuff.ipynb +++ b/tutorials/not_so_obvious_python_stuff.ipynb @@ -1,7 +1,7 @@ { "metadata": { "name": "", - "signature": "sha256:d87105a74c8f25016f90bdec495a890a988277a3f51e0589febbbac87720b033" + "signature": "sha256:5dd675ee714d0dbd00f7be378f1379f4dceaa728c56476124c1bf493d70c569e" }, "nbformat": 3, "nbformat_minor": 0, @@ -13,18 +13,60 @@ "metadata": {}, "source": [ "[Sebastian Raschka](http://sebastianraschka.com) \n", - "last updated: 05/24/2014 ([Changelog](#changelog))\n", "\n", "- [Link to this IPython Notebook on GitHub](https://github.com/rasbt/python_reference/blob/master/tutorials/not_so_obvious_python_stuff.ipynb) \n", "- [Link to the GitHub repository](https://github.com/rasbt/python_reference) \n", "\n" ] }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%load_ext watermark" + ], + "language": "python", + "metadata": {}, + "outputs": [], + "prompt_number": 1 + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "%watermark -d -u -v" + ], + "language": "python", + "metadata": {}, + "outputs": [ + { + "output_type": "stream", + "stream": "stdout", + "text": [ + "Last updated: 16/07/2014 \n", + "\n", + "CPython 3.4.1\n", + "IPython 2.0.0\n" + ] + } + ], + "prompt_number": 2 + }, { "cell_type": "markdown", "metadata": {}, "source": [ - "#### All code was executed in Python 3.4 (unless stated otherwise)" + "[More information](http://nbviewer.ipython.org/github/rasbt/python_reference/blob/master/ipython_magic/watermark.ipynb) about the `watermark` magic command extension.\n", + "\n", + "([Changelog](#changelog))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "
\n", + "
" ] }, { @@ -1013,7 +1055,7 @@ "\n", "(Original source: [http://openhome.cc/eGossip/Blog/UnderstandingLambdaClosure3.html](http://openhome.cc/eGossip/Blog/UnderstandingLambdaClosure3.html))\n", "\n", - "In the first example below, we call a `lambda` function in a list comprehension, and the value `i` will be dereferenced every time we call `lambda` within the scope of the list comprehension. Since the list is already constructed when we `for-loop` through the list, it will be set to the last value 4." + "In the first example below, we call a `lambda` function in a list comprehension, and the value `i` will be dereferenced every time we call `lambda` within the scope of the list comprehension. Since the list comprehension has already been constructed and evaluated when we for-loop through the list, the closure-variable will be set to the last value 4." ] }, { @@ -1045,7 +1087,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "This, however, does not apply to generators:" + "However, by using a generator expression, we can make use of its stepwise evaluation (note that the returned variable still stems from the same closure, but the value changes as we iterate over the generator)." ] }, { @@ -4281,6 +4323,9 @@ "cell_type": "markdown", "metadata": {}, "source": [ + "#### 07/16/2014\n", + "- slight change of wording in the [lambda-closure section](#lambda_closure)\n", + "\n", "#### 05/24/2014\n", "- new section: unorderable types in Python 2\n", "- table of contents for the Python 2 vs. Python 3 topic\n", From 0fd0ba5d01d82d68353f5dee7dfcf58cc855638e Mon Sep 17 00:00:00 2001 From: rasbt Date: Fri, 18 Jul 2014 14:13:22 -0400 Subject: [PATCH 2/4] cheatsheet upd --- tutorials/matrix_cheatsheet_only.html | 722 ++++++++++++++------------ 1 file changed, 390 insertions(+), 332 deletions(-) diff --git a/tutorials/matrix_cheatsheet_only.html b/tutorials/matrix_cheatsheet_only.html index 7624ea4..c0d1a18 100644 --- a/tutorials/matrix_cheatsheet_only.html +++ b/tutorials/matrix_cheatsheet_only.html @@ -3,9 +3,9 @@ - + - + - - - - - - - +
+ + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+

Task

-

MATLAB/Octave

+
+

MATLAB/Octave

-

Python +

+

Python NumPy

-

R

+
+

R

-

Julia

+
+

Julia

+

Task

+

CREATING MATRICES

+

Creating Matrices 
(here: 3x3 matrix)

-

M> +

+

M> A = [1 2 3; 4 5 6; 7 8 9]
A =
   1   2   3
   4   5   6
   7   8   9

-

P> +

+

P> A = np.array([ [1,2,3], [4,5,6], [7,8,9] ])

P> A
array([[1, 2, 3],
       [4, 5, 6],
       [7, 8, 9]])

-

R> +

+

R> A = matrix(c(1,2,3,4,5,6,7,8,9),nrow=3,byrow=T)


# equivalent to

# A = matrix(1:9,nrow=3,byrow=T)



R> A
[,1] [,2] [,3]
[1,] 1 2 3
[2,] 4 5 6
[3,] 7 8 9

-

J> +

+

J> A=[1 2 3; 4 5 6; 7 8 9]
3x3 Array{Int64,2}:
1 2 3
4 5 6
7 8 9

+

Creating Matrices 
(here: 3x3 matrix)

+

Creating an 1D column vector

-

M> +

+

M> a = [1; 2; 3]
a =
   1
   2
   3

-

P> - a - = +

+

P> + a + = np.array([1,2,3]).reshape(1,3)

-


P> - b.shape
(1, +


P> + b.shape
(1, 3)


-

R> +

+

R> a = matrix(c(1,2,3), nrow=3, byrow=T)

R> a
[,1]
[1,] 1
[2,] 2
[3,] 3

-

J> +

+

J> a=[1; 2; 3]
3-element Array{Int64,1}:
1
2
3

+

Creating an 1D column vector

+

Creating an
1D row vector

-

M> +

+

M> b = [1 2 3]
b =
   1   2   3

-

P> +

+

P> b = np.array([1,2,3])

P> b
array([1, 2, 3])

-

# +

# note that numpy doesn't have
# explicit “row-vectors”, but 1-D
# arrays

-

P> - b.shape

-

(3,)

+

P> + b.shape

+

(3,)


-

R> +

+

R> b = matrix(c(1,2,3), ncol=3)

R> b
[,1] [,2] [,3]
[1,] 1 2 3

-

J> +

+

J> b=[1 2 3]
1x3 Array{Int64,2}:
1 2 3

# note that this is a 2D array.
# vectors in Julia are columns

+

Creating an
1D row vector

+

Creating a
random m x n matrix

-

M> +

+

M> rand(3,2)
ans =
   0.21977   0.10220
   0.38959   0.69911
   0.15624   0.65637

-

P> +

+

P> np.random.rand(3,2)
array([[ 0.29347865,  0.17920462],
       [ 0.51615758,  0.64593471],
       [ 0.01067605,  0.09692771]])

-

R> +

+

R> matrix(runif(3*2), ncol=2)
[,1] [,2]
[1,] 0.5675127 0.7751204
[2,] 0.3439412 0.5261893
[3,] 0.2273177 0.223438

-

J> +

+

J> rand(3,2)
3x2 Array{Float64,2}:
0.36882 0.267725
0.571856 0.601524
0.848084 0.858935

+

Creating a
random m x n matrix

+

Creating a
zero m x n matrix 

-

M> +

+

M> zeros(3,2)
ans =
   0   0
   0   0
   0   0

-

P> +

+

P> np.zeros((3,2))
array([[ 0.,  0.],
       [ 0.,  0.],
       [ 0.,  0.]])

-

R> +

+

R> mat.or.vec(3, 2)
[,1] [,2]
[1,] 0 0
[2,] 0 0
[3,] 0 0

-

J> +

+

J> zeros(3,2)
3x2 Array{Float64,2}:
0.0 0.0
0.0 0.0
0.0 0.0

+

Creating a
zero m x n matrix 

+

Creating an
m x n matrix of ones

-

M> +

+

M> ones(3,2)
ans =
   1   1
   1   1
   1   1

-

P> +

+

P> np.ones((3,2))
array([[ 1.,  1.],
       [ 1.,  1.],
       [ 1.,  1.]])

-

R> - mat.or.vec(3, 2) + 1
[,1] [,2]
[1,] 1 1
[2,] 1 1
[3,] - 1 1

+
+

R> + matrix(1L, + 3, 2)

[,1] + [,2]
[1,] 1 1
[2,] 1 1
[3,] 1 1

-

J> +

+

J> ones(3,2)
3x2 Array{Float64,2}:
1.0 1.0
1.0 1.0
1.0 1.0

+

Creating an
m x n matrix of ones

+

Creating an
identity matrix

-

M> +

+

M> eye(3)
ans =
Diagonal Matrix
   1   0   0
   0   1   0
   0   0   1

-

P> +

+

P> np.eye(3)
array([[ 1.,  0.,  0.],
       [ 0.,  1.,  0.],
       [ 0.,  0.,  1.]])

-

R> +

+

R> diag(3)
[,1] [,2] [,3]
[1,] 1 0 0
[2,] 0 1 0
[3,] 0 0 1

-

J> +

+

J> eye(3)
3x3 Array{Float64,2}:
1.0 0.0 0.0
0.0 1.0 0.0
0.0 0.0 1.0

+

Creating an
identity matrix

+

Creating a
diagonal matrix

-

M> +

+

M> a = [1 2 3]

M> diag(a)
ans =
Diagonal Matrix
   1   0   0
   0   2   0
   0   0   3

-

P> +

+

P> a = np.array([1,2,3])

P> np.diag(a)
array([[1, 0, 0],
       [0, 2, 0],
       [0, 0, 3]])

-

R> +

+

R> diag(1:3)
[,1] [,2] [,3]
[1,] 1 0 0
[2,] 0 2 0
[3,] 0 0 3

-

J> +

+

J> a=[1, 2, 3]

# added commas because julia
# vectors are columnar

J> diagm(a)
3x3 Array{Int64,2}:
1 0 0
0 2 0
0 0 3

+

Creating a
diagonal matrix

+

ACCESSING MATRIX ELEMENTS

+

Getting the dimension
of a matrix
(here: 2D, rows x cols)

-

M> +

+

M> A = [1 2 3; 4 5 6]
A =
   1   2   3
   4   5   6

M> size(A)
ans =
   2   3

-

P> +

+

P> A = np.array([ [1,2,3], [4,5,6] ])

P> A
array([[1, 2, 3],
       [4, 5, 6]])

P> A.shape
(2, 3)

-

R> +

+

R> A = matrix(1:6,nrow=2,byrow=T)

R> A
[,1] [,2] [,3]
[1,] 1 2 3
[2,] 4 5 6


-

R> +

R> dim(A)
[1] 2 3

-

J> +

+

J> A=[1 2 3; 4 5 6]
2x3 Array{Int64,2}:
1 2 3
4 5 6

J> size(A)
(2,3)

+

Getting the dimension
of a matrix
(here: 2D, rows x cols)

+

Selecting rows 

-

M> +

+

M> A = [1 2 3; 4 5 6; 7 8 9]

% 1st row
M> A(1,:)
ans =
   1   2   3

% 1st 2 rows
M> A(1:2,:)
ans =
   1   2   3
   4   5   6

-

P> +

+

P> A = np.array([ [1,2,3], [4,5,6], [7,8,9] ])

# 1st row
P> A[0,:]
array([1, 2, 3])

# 1st 2 rows
P> A[0:2,:]
array([[1, 2, 3], [4, 5, 6]])

-

R> +

+

R> A = matrix(1:9,nrow=3,byrow=T)



# 1st row


R> A[1,]
[1] 1 2 3



# 1st 2 rows


R> A[1:2,]
[,1] [,2] [,3]
[1,] 1 2 3
[2,] 4 5 6

-

J> +

+

J> A=[1 2 3; 4 5 6; 7 8 9];
#semicolon suppresses output

#1st row
J> A[1,:]
1x3 Array{Int64,2}:
1 2 3

#1st 2 rows
J> A[1:2,:]
2x3 Array{Int64,2}:
1 2 3
4 5 6

+

Selecting rows 

+

Selecting columns

-

M> +

+

M> A = [1 2 3; 4 5 6; 7 8 9]

% 1st column
M> A(:,1)
ans =
   1
   4
   7

% 1st 2 columns
M> A(:,1:2)
ans =
   1   2
   4   5
   7   8

-

P> +

+

P> A = np.array([ [1,2,3], [4,5,6], [7,8,9] ])

# 1st column (as row vector)
P> A[:,0]
array([1, 4, 7])

# 1st column (as column @@ -412,8 +413,8 @@ A[:,0:2]
array([[1, 2], 
       [4, 5], 
       [7, 8]])

-

R> +

+

R> A = matrix(1:9,nrow=3,byrow=T)




# 1st column as row vector

R> t(A[,1])
[,1] [,2] [,3]
[1,] 1 4 7



# 1st column @@ -421,136 +422,193 @@ A[,1]
[1] 1 4 7



# 1st 2 columns

R> A[,1:2]
[,1] [,2]
[1,] 1 2
[2,] 4 5
[3,] 7 8

-

J> +

+

J> A=[1 2 3; 4 5 6; 7 8 9];

#1st column
J> A[:,1]
3-element Array{Int64,1}:
1
4
7

#1st 2 columns
J> A[:,1:2]
3x2 Array{Int64,2}:
1 2
4 5
7 8

+

Selecting columns

+

Extracting rows and columns by criteria

(here: get rows that have value 9 in column 3)

-

M> +

+

M> A = [1 2 3; 4 5 9; 7 8 9]
A =
   1   2   3
   4   5   9
   7   8   9

M> A(A(:,3) == 9,:)
ans =
   4   5   9
   7   8   9

-

P> +

+

P> A = np.array([ [1,2,3], [4,5,9], [7,8,9]])

P> A
array([[1, 2, 3],
       [4, 5, 9],
       [7, 8, 9]])

P> A[A[:,2] == 9]
array([[4, 5, 9],
       [7, 8, 9]])

-

R> - A = matrix(1:9,nrow=3,byrow=T)



R> +

+

R> + A = matrix(1:9,nrow=3,byrow=T)



R> A
[,1] [,2] [,3]
[1,] 1 2 3
[2,] 4 5 9
[3,] 7 8 - 9



R> - matrix(A[A[,3]==9], ncol=3)
[,1] [,2] [,3]
[1,] 4 5 9
[2,] + 9



R> + A[A[,3]==9,]

+

[1] 7 8 9

+


+

-

J> +

+

J> A=[1 2 3; 4 5 9; 7 8 9]
3x3 Array{Int64,2}:
1 2 3
4 5 9
7 8 9

# use '.==' for
# element-wise check
J> A[ A[:,3] .==9, :]
2x3 Array{Int64,2}:
4 5 9
7 8 9

+

Extracting rows and columns by criteria

(here: get rows that have value 9 in column 3)

+

Accessing elements
(here: 1st element)

-

M> +

+

M> A = [1 2 3; 4 5 6; 7 8 9]

M> A(1,1)
ans =  1

-

P> +

+

P> A = np.array([ [1,2,3], [4,5,6], [7,8,9] ])

P> A[0,0]
1

-

R> +

+

R> A = matrix(c(1,2,3,4,5,9,7,8,9),nrow=3,byrow=T)


R> A[1,1]
[1] 1

-

J> +

+

J> A=[1 2 3; 4 5 6; 7 8 9];

J> A[1,1]
1

+

Accessing elements
(here: 1st element)

+

MANIPULATING SHAPE AND DIMENSIONS

+ +

Converting 
a + matrix into a row vector (by column)

+
+

M> + A = [1 2 3; 4 5 6; 7 8 9]

+

M> + A(:)

+

ans + = +

+

1 +
4
7
2
5
8
3
6
9

+
+

P> + A = np.array([[1,2,3],[4,5,6],[7,8,9]])

+

P> + A.flatten(1)

+

array([1, + 4, 7, 2, 5, 8, 3, 6, 9])

+


+

+
+

R> + A = matrix(1:9,nrow=3,byrow=T)

+


+

+

R> + as.vector(A)

+


+

+

[1] + 1 4 7 2 5 8 3 6 9

+


+

+
+

J> + A=[1 2 3; 4 5 6; 7 8 9]

+

J> + vec(A)

+

9-element + Array{Int64,1}:

+

1
4
7
2
5
8
3
6
9

+
+

Converting 
a + matrix into a row vector (by column)

+

Converting 
row to column vectors

-

M> +

+

M> b = [1 2 3]


M> b = b'
b =
   1
   2
   3

-

P> +

+

P> b = np.array([1, 2, 3])

P> b = b[np.newaxis].T
# alternatively
# b = b[:,np.newaxis]

P> b
array([[1],
       [2],
       [3]])

-

R> +

+

R> b = matrix(c(1,2,3), ncol=3)

R> t(b)
[,1]
[1,] 1
[2,] 2
[3,] 3

-

J> +

+

J> b=vec([1 2 3])
3-element Array{Int64,1}:
1
2
3

+

Converting 
row to column vectors

+

Reshaping Matrices

(here: 3x3 matrix to row vector)

-

M> +

+

M> A = [1 2 3; 4 5 6; 7 8 9]
A =
   1   2   3
   4   5   6
   7   8   9

M> @@ -559,19 +617,19 @@ =
   1   4   7   2   5   8   3   6   9

-

P> +

+

P> A = np.array([[1,2,3],[4,5,6],[7,8,9]])

P> A
array([[1, 2, 3],
       [4, 5, 9],
       [7, 8, 9]])

P> total_elements = np.prod(A.shape)

-

P> +

P> B = A.reshape(1, total_elements) 

# alternative shortcut:
# A.reshape(1,-1)

P> B
array([[1, 2, 3, 4, 5, 6, 7, 8, 9]])

-

R> +

+

R> A = matrix(1:9,nrow=3,byrow=T)



R> A
[,1] [,2] [,3]
[1,] 1 2 3
[2,] 4 5 6
[3,] 7 8 9


R> total_elements = dim(A)[1] * dim(A)[2]

R> @@ -579,33 +637,33 @@ B
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
[1,] 1 4 7 2 5 8 3 6 9

-

J> +

+

J> A=[1 2 3; 4 5 6; 7 8 9]
3x3 Array{Int64,2}:
1 2 3
4 5 6
7 8 9

J> total_elements=length(A)
9

J>B=reshape(A,1,total_elements)
1x9 Array{Int64,2}:
1 4 7 2 5 8 3 6 9

+

Reshaping Matrices

(here: 3x3 matrix to row vector)

+

Concatenating matrices

-

M> +

+

M> A = [1 2 3; 4 5 6]

M> B = [7 8 9; 10 11 12]

M> C = [A; B]
    1    2    3
    4    5    6
    7    8    9
   10   11   12

-

P> +

+

P> A = np.array([[1, 2, 3], [4, 5, 6]])

P> B = np.array([[7, 8, 9],[10,11,12]])

P> C = np.concatenate((A, B), axis=0)

P> @@ -613,33 +671,33 @@ 5, 6], 
       [ 7, 8, 9], 
       [10, 11, 12]])

-

R> +

+

R> A = matrix(1:6,nrow=2,byrow=T)

R> B = matrix(7:12,nrow=2,byrow=T)

R> C = rbind(A,B)

R> C
[,1] [,2] [,3]
[1,] 1 2 3
[2,] 4 5 6
[3,] 7 8 9
[4,] 10 11 12

-

J> +

+

J> A=[1 2 3; 4 5 6];

J> B=[7 8 9; 10 11 12];

J> C=[A; B]
4x3 Array{Int64,2}:
1 2 3
4 5 6
7 8 9
10 11 12

+

Concatenating matrices

+

Stacking 
vectors and matrices

-

M> +

+

M> a = [1 2 3]

M> b = [4 5 6]

M> c = [a' b']
c =
   1   4
   2   @@ -647,8 +705,8 @@ c = [a; b]
c =
   1   2   3
   4   5   6

-

P> +

+

P> a = np.array([1,2,3])
P> b = np.array([4,5,6])

P> np.c_[a,b]
array([[1, 4],
       [2, @@ -656,38 +714,38 @@ np.r_[a,b]
array([[1, 2, 3],
       [4, 5, 6]])

-

R> +

+

R> a = matrix(1:3, ncol=3)

R> b = matrix(4:6, ncol=3)

R> matrix(rbind(A, B), ncol=2)
[,1] [,2]
[1,] 1 5
[2,] 4 3


R> rbind(A,B)
[,1] [,2] [,3]
[1,] 1 2 3
[2,] 4 5 6

-

J> +

+

J> a=[1 2 3];

J> b=[4 5 6];

J> c=[a' b']
3x2 Array{Int64,2}:
1 4
2 5
3 6

J> c=[a; b]
2x3 Array{Int64,2}:
1 2 3
4 5 6

+

Stacking 
vectors and matrices

+

BASIC MATRIX OPERATIONS

+

Matrix-scalar
operations

-

M> A +

+

M> A = [1 2 3; 4 5 6; 7 8 9]

M> A * 2
ans =
    2    4    6
    8   10   12
   14   16   @@ -696,30 +754,30 @@ A - 2

M> A / 2

-

P> +

+

P> A = np.array([ [1,2,3], [4,5,6], [7,8,9] ])

P> A * 2
array([[ 2,  4,  6],
       [ 8, 10, 12],
       [14, 16, 18]])

P> A + 2

P> A - 2

P> A / 2

-

# +

# Note that NumPy was optimized for
# in-place assignments
# e.g., A += A instead of
# A = A + A

-

R> +

+

R> A = matrix(1:9, nrow=3, byrow=T)

R> A * 2
[,1] [,2] [,3]
[1,] 2 4 6
[2,] 8 10 12
[3,] 14 16 18


-

R> +

R> A + 2

R> A - 2

R> A / 2

-

J> +

+

J> A=[1 2 3; 4 5 6; 7 8 9];

# elementwise operator

J> A .* 2
3x3 Array{Int64,2}:
2 4 6
8 10 12
14 16 18

J> @@ -727,83 +785,83 @@ A .- 2;

J> A ./ 2;

+

Matrix-scalar
operations

+

Matrix-matrix
multiplication

-

M> A +

+

M> A = [1 2 3; 4 5 6; 7 8 9]

M> A * A
ans =
    30    36    42
    66    81    96
   102   126   150

-

P> +

+

P> A = np.array([ [1,2,3], [4,5,6], [7,8,9] ])

P> np.dot(A,A) # or A.dot(A)
array([[ 30,  36,  42],
       [ 66,  81,  96],
       [102, 126, 150]])

-

R> +

+

R> A = matrix(1:9, nrow=3, byrow=T)

R> A %*% A
[,1] [,2] [,3]
[1,] 30 36 42
[2,] 66 81 96
[3,] 102 126 150

-

J> +

+

J> A=[1 2 3; 4 5 6; 7 8 9];

J> A * A
3x3 Array{Int64,2}:
30 36 42
66 81 96
102 126 150

+

Matrix-matrix
multiplication

+

Matrix-vector
multiplication

-

M> +

+

M> A = [1 2 3; 4 5 6; 7 8 9]

M> b = [ 1; 2; 3 ]

M> A * b
ans =
   14
   32
   50

-

P> +

+

P> A = np.array([ [1,2,3], [4,5,6], [7,8,9] ])

P> b = np.array([ [1], [2], [3] ])

P> np.dot(A,b) # or A.dot(b)

array([[14], [32], [50]])

-

R> +

+

R> A = matrix(1:9, ncol=3)

R> b = matrix(1:3, nrow=3)



R> t(b %*% A)
[,1]
[1,] 14
[2,] 32
[3,] 50

-

J> +

+

J> A=[1 2 3; 4 5 6; 7 8 9];

J> b=[1; 2; 3];

J> A*b
3-element Array{Int64,1}:
14
32
50

+

Matrix-vector
multiplication

+

Element-wise 
matrix-matrix operations

-

M> A +

+

M> A = [1 2 3; 4 5 6; 7 8 9]

M> A .* A
ans =
    1    4    9
   16   25   36
   49   @@ -812,20 +870,20 @@ A .- A

M> A ./ A

-

P> +

+

P> A = np.array([ [1,2,3], [4,5,6], [7,8,9] ])

P> A * A
array([[ 1,  4,  9],
       [16, 25, 36],
       [49, 64, 81]])

P> A + A

P> A - A

P> A / A

-

# +

# Note that NumPy was optimized for
# in-place assignments
# e.g., A += A instead of
# A = A + A

-

R> +

+

R> A = matrix(1:9, nrow=3, byrow=T)


R> A * A
[,1] [,2] [,3]
[1,] 1 4 9
[2,] 16 25 36
[3,] 49 64 81



R> @@ -833,8 +891,8 @@ A - A

R> A / A

-

J> +

+

J> A=[1 2 3; 4 5 6; 7 8 9];

J> A .* A
3x3 Array{Int64,2}:
1 4 9
16 25 36
49 64 81

J> @@ -842,67 +900,67 @@ A .- A;

J> A ./ A;

+

Element-wise 
matrix-matrix operations

+

Matrix elements to power n

(here: individual elements squared)

-

M> A +

+

M> A = [1 2 3; 4 5 6; 7 8 9]

M> A.^2
ans =
    1    4    9
   16   25   36
   49   64   81

-

P> +

+

P> A = np.array([ [1,2,3], [4,5,6], [7,8,9] ])

P> np.power(A,2)
array([[ 1,  4,  9],
       [16, 25, 36],
       [49, 64, 81]])

-

R> +

+

R> A = matrix(1:9, nrow=3, byrow=T)

R> A ^ 2
[,1] [,2] [,3]
[1,] 1 4 9
[2,] 16 25 36
[3,] 49 64 81

-

J> +

+

J> A=[1 2 3; 4 5 6; 7 8 9];

J> A .^ 2
3x3 Array{Int64,2}:
1 4 9
16 25 36
49 64 81

+

Matrix elements to power n

(here: individual elements squared)

+

Matrix to power n

(here: matrix-matrix multiplication with itself)

-

M> A +

+

M> A = [1 2 3; 4 5 6; 7 8 9]

M> A ^ 2
ans =
    30    36    42
    66    81    96
   102   126   150

-

P> +

+

P> A = np.array([ [1,2,3], [4,5,6], [7,8,9] ])

P> np.linalg.matrix_power(A,2)
array([[ 30,  36,  42],
       [ 66,  81,  96],
       [102, 126, 150]])

-

R> +

+

R> A = matrix(1:9, ncol=3)


# requires the ‘expm’ package


R> install.packages('expm')


R> @@ -910,102 +968,102 @@ A %^% 2
[,1] [,2] [,3]
[1,] 30 66 102
[2,] 36 81 126
[3,] 42 96 150

-

J> +

+

J> A=[1 2 3; 4 5 6; 7 8 9];

J> A ^ 2
3x3 Array{Int64,2}:
30 36 42
66 81 96
102 126 150

+

Matrix to power n

(here: matrix-matrix multiplication with itself)

+

Matrix transpose

-

M> A +

+

M> A = [1 2 3; 4 5 6; 7 8 9]

M> A'
ans =
   1   4   7
   2   5   8
   3   6   9

-

P> +

+

P> A = np.array([ [1,2,3], [4,5,6], [7,8,9] ])

P> A.T
array([[1, 4, 7],
       [2, 5, 8],
       [3, 6, 9]])

-

R> +

+

R> A = matrix(1:9, nrow=3, byrow=T)


R> t(A)
[,1] [,2] [,3]
[1,] 1 4 7
[2,] 2 5 8
[3,] 3 6 9

-

J> +

+

J> A=[1 2 3; 4 5 6; 7 8 9]
3x3 Array{Int64,2}:
1 2 3
4 5 6
7 8 9

J> A'
3x3 Array{Int64,2}:
1 4 7
2 5 8
3 6 9

+

Matrix transpose

+

Determinant of a matrix:
 A -> |A|

-

M> +

+

M> A = [6 1 1; 4 -2 5; 2 8 7]
A =
   6   1   1
   4  -2   5
   2   8   7

M> det(A)
ans = -306

-

P> A +

+

P> A = np.array([[6,1,1],[4,-2,5],[2,8,7]])

P> A
array([[ 6,  1,  1],
       [ 4, -2,  5],
       [ 2,  8,  7]])

P> np.linalg.det(A)
-306.0

-

R> +

+

R> A = matrix(c(6,1,1,4,-2,5,2,8,7), nrow=3, byrow=T)

R> A
[,1] [,2] [,3]
[1,] 6 1 1
[2,] 4 -2 5
[3,] 2 8 7

R> det(A)
[1] -306

-

J> +

+

J> A=[6 1 1; 4 -2 5; 2 8 7]
3x3 Array{Int64,2}:
6 1 1
4 -2 5
2 8 7

J> det(A)
-306.0

+

Determinant of a matrix:
 A -> |A|

+

Inverse of a matrix

-

M> +

+

M> A = [4 7; 2 6]
A =
   4   7
   2   6

M> A_inv = inv(A)
A_inv =
   0.60000  -0.70000
  -0.20000   0.40000

-

P> +

+

P> A = np.array([[4, 7], [2, 6]])

P> A
array([[4, 7], 
       [2, 6]])

P> @@ -1013,36 +1071,36 @@ A_inverse
array([[ 0.6, -0.7], 
       [-0.2, 0.4]])

-

R> +

+

R> A = matrix(c(4,7,2,6), nrow=2, byrow=T)

R> A
[,1] [,2]
[1,] 4 7
[2,] 2 6

R> solve(A)
[,1] [,2]
[1,] 0.6 -0.7
[2,] -0.2 0.4

-

J> +

+

J> A=[4 7; 2 6]
2x2 Array{Int64,2}:
4 7
2 6

J> A_inv=inv(A)
2x2 Array{Float64,2}:
0.6 -0.7
-0.2 0.4

+

Inverse of a matrix

+

ADVANCED MATRIX OPERATIONS

+

Calculating the covariance matrix 
of 3 random variables

(here: covariances of the means 
of x1, x2, and x3)

-

M> +

+

M> x1 = [4.0000 4.2000 3.9000 4.3000 4.1000]’

M> x2 = [2.0000 2.1000 2.0000 2.1000 2.2000]'

M> x3 = [0.60000 0.59000 0.58000 0.62000 0.63000]’

M> @@ -1051,8 +1109,8 @@ 7.0000e-03   1.3500e-03
   1.7500e-03   1.3500e-03   4.3000e-04

-

P> +

+

P> x1 = np.array([ 4, 4.2, 3.9, 4.3, 4.1])

P> x2 = np.array([ 2, 2.1, 2, 2.1, 2.2])

P> x3 = np.array([ 0.6, 0.59, 0.58, 0.62, 0.63])

P> @@ -1061,8 +1119,8 @@  ,  0.00135],
       [ 0.00175,  0.00135,  0.00043]])

-

R> +

+

R> x1 = matrix(c(4, 4.2, 3.9, 4.3, 4.1), ncol=5)

R> x2 = matrix(c(2, 2.1, 2, 2.1, 2.2), ncol=5)

R> x3 = matrix(c(0.6, 0.59, 0.58, 0.62, 0.63), ncol=5)



R> @@ -1070,27 +1128,27 @@ 0.02500 0.00750 0.00175
[2,] 0.00750 0.00700 0.00135
[3,] 0.00175 0.00135 0.00043

-

J> +

+

J> x1=[4.0 4.2 3.9 4.3 4.1]';

J> x2=[2. 2.1 2. 2.1 2.2]';

J> x3=[0.6 .59 .58 .62 .63]';

J> cov([x1 x2 x3])
3x3 Array{Float64,2}:
0.025 0.0075 0.00175
0.0075 0.007 0.00135
0.00175 0.00135 0.00043

+

Calculating the covariance matrix 
of 3 random variables

(here: covariances of the means 
of x1, x2, and x3)

+

Calculating 
eigenvectors and eigenvalues

-

M> +

+

M> A = [3 1; 1 3]
A =
   3   1
   1   3

M> [eig_vec,eig_val] = eig(A)
eig_vec =
  -0.70711   @@ -1098,8 +1156,8 @@ =
Diagonal Matrix
   2   0
   0   4

-

P> +

+

P> A = np.array([[3, 1], [1, 3]])

P> A
array([[3, 1],
       [1, 3]])

P> eig_val, eig_vec = np.linalg.eig(A)

P> @@ -1107,34 +1165,34 @@ eig_vec
Array([[ 0.70710678, -0.70710678],
       [ 0.70710678,  0.70710678]])

-

R> +

+

R> A = matrix(c(3,1,1,3), ncol=2)

R> A
[,1] [,2]
[1,] 3 1
[2,] 1 3

R> eigen(A)
$values
[1] 4 2

$vectors
[,1] [,2]
[1,] 0.7071068 -0.7071068
[2,] 0.7071068 0.7071068

-

J> +

+

J> A=[3 1; 1 3]
2x2 Array{Int64,2}:
3 1
1 3

J> (eig_vec,eig_val)=eig(a)
([2.0,4.0],
2x2 Array{Float64,2}:
-0.707107 0.707107
0.707107 0.707107)

+

Calculating 
eigenvectors and eigenvalues

+

Generating a Gaussian dataset:

creating random vectors from the multivariate normal
distribution given mean and covariance matrix

(here: 5 random vectors with
mean 0, covariance = 0, variance = 2)

-

% +

+

% requires statistics toolbox package
% how to install and load it in Octave:

% download the package from: 
% http://octave.sourceforge.net/packages.php
% pkg install 
% @@ -1149,8 +1207,8 @@ 3.055316
  -0.985215  -0.990936
   1.122528   0.686977
    

-

P> +

+

P> mean = np.array([0,0])

P> cov = np.array([[2,0],[0,2]])

P> np.random.multivariate_normal(mean, cov, 5)

Array([[ @@ -1160,8 +1218,8 @@  [-2.93207591, -0.07369322], 
       [-1.37031244, -1.18408792]])

-

# +

+

# requires the ‘mass’ package

R> install.packages('MASS')

R> library(MASS)


R> @@ -1172,8 +1230,8 @@ -0.4161082
[8,] -1.3236339 0.7755572
[9,] 0.2771013 1.4900494
[10,] -1.3536268 0.2338913

-

# +

+

# requires the Distributions package from https://github.com/JuliaStats/Distributions.jl

J> using Distributions

J> @@ -1184,7 +1242,7 @@ 0.370725 -0.761928 -3.91747 1.47516
-0.448821 2.21904 2.24561 0.692063 0.390495

+

Generating a Gaussian dataset:

creating random vectors from the multivariate normal
distribution given mean and covariance From 261c359168412055bc67f57fe302c32f8b03939b Mon Sep 17 00:00:00 2001 From: Jon Goodnow Date: Sat, 19 Jul 2014 16:05:12 -0400 Subject: [PATCH 3/4] fixed a typo and a broken link --- tutorials/sqlite3_howto/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tutorials/sqlite3_howto/README.md b/tutorials/sqlite3_howto/README.md index 7ef88e9..e5cccec 100644 --- a/tutorials/sqlite3_howto/README.md +++ b/tutorials/sqlite3_howto/README.md @@ -29,7 +29,7 @@ _\-- written by Sebastian Raschka_ on March 7, 2014 • Conclusion The complete Python code that I am using in this tutorial can be downloaded -from my GitHub repository: [https://github.com/rasbt/python_reference/tutorials/sqlite3_howto](https://github.com/rasbt/python_reference/tutorials/sqlite3_howto) +from my GitHub repository: [https://github.com/rasbt/python_reference/tree/master/tutorials/sqlite3_howto](https://github.com/rasbt/python_reference/tree/master/tutorials/sqlite3_howto) * * * @@ -97,7 +97,7 @@ there is more information about PRIMARY KEYs further down in this section). - mport sqlite3 + import sqlite3 sqlite_file = 'my_first_db.sqlite' # name of the sqlite database file table_name1 = 'my_table_1' # name of the table to be created From 4beb09cac11d4423ad67f01fc958af257d61369f Mon Sep 17 00:00:00 2001 From: rasbt Date: Tue, 29 Jul 2014 17:34:53 -0400 Subject: [PATCH 4/4] new workaround for internal links --- Images/ipython_links_remedy2.png | Bin 0 -> 10520 bytes tutorials/table_of_contents_ipython.ipynb | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 Images/ipython_links_remedy2.png diff --git a/Images/ipython_links_remedy2.png b/Images/ipython_links_remedy2.png new file mode 100644 index 0000000000000000000000000000000000000000..ae3abeaa0288d32051ff622506f5866db3653196 GIT binary patch literal 10520 zcmZX3V|blGx9E;-HI38Qwr$(?P8yqy*|@Q7Ta9hAanjgnba(rmd(L_8oge#oXJ&cU zEXlf==W zmcd7KP!VY8f{CUM6{2Z#}o$oR6k5)0`Oq`}Wmh3Gk|5 zQW%yp{cn6}2&Q{KT89BJYyc>x0PNIMl51E51n>`?t!=QGg&p}QYQqnkhaQ-uryxW^ zfYK+H%--ppA`%~y@*A=_Ie?Og*s@_fb=odz@QDhUQ1GLo;~e6bhk$IRe$8SaX@3`L zMi^jcRIi#14loCs&)VQ29ZtkTXiUp&NG9un zM^hf?ynrv3!l8--mDyA`2NO=QOe_{D4Pvt-4Vm%iByl8?$K=aJ^;j>jU&$)Ju&`aQZ4 zQ1-$DWE@3I%z?Xt79fUw{y_}C0?;*zX?!QD#F%cCke3(g|2NfK;D2o+)BN|O`WFAW?e0i8(pn~vGUWF2o3(DtUi9F63%TG{= z#ypi!czw4<*k@ocKjW{^x!??tk9s|?uv;;!Ls9xCuRL23x{*+N8Fw5ph2oVElNiRp z2Sq&dM3fy%#gZ_au+;--gw+c^D+5av7UUNIr{t#?pQDQN(yR~~5!Q$ZLJsp%3zqYv zX3USj9b4Rq-^t$*dm+9diS}8UOfXMOFt#@hWxlM_qJyxF zb{+U*YFanCqP{|UW?+ZWOt2nC@H2MrE0=2~_Y@XR7K)(6qAr&+k`yjo=b&PYt?qBuCSJG-rrBCe``aS?}=b5Oac?%D{2-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)vIKQ?5#V%#z& zvm;-_3sHGIKXLr+IVk|bt8eR&aC@GepTM1uhM^5dDij+~1k42K>-!}Lf6D5ofiZPU-0cHM{ ze3h?SM5$Upk=|mt8j@DB$4N$7_j^M^u3_4s$ty%@s*m9g>;zyQsZUPp$$HC&d%%}$ zJxa*%5D`I4w5QG8^mFsDmxubs+Utr6S5x+r%|G^LZwG{a{oB;1%Hm<-EyK>{hl^LL9gSGUt5`416%`FNLQVJPT7DsEfa`j0Nt;Cc8+I zOoWF|p-LGQyrZX2cErZ7jiF)6<@Y?^>|gMD|{o6 zAANY=2tC3or!ZQ5y4{rL3t=CP?b0~SO1_lvsxkq=f}RzIUt-DTN$XFl*(dS(3~7 z@6v8b0%Xat>Q7C`}a0>T9@Q*ZMC@4+!D}CenC*B7PieOoyEx?o$ P02\n", "
\n", + "\n", + "### Solution 2: line break between the id-anchor and text:\n", + "\n", + "![img of format problem](https://raw.githubusercontent.com/rasbt/python_reference/master/Images/ipython_links_remedy2.png)\n", + "\n", + "(this alternative workaround was kindly submitted by [Ryan Morshead](https://github.com/rmorshea))\n", + "\n", + "
\n", + "
\n", "
\n", "


" ] @@ -223,7 +229,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### Solution 2: using header cells" + "### Solution 3: using header cells" ] }, {