General update of several files with to do list

This commit is contained in:
mhjensen
2018-05-22 16:49:43 -04:00
parent 7a39d02fd6
commit 4e5fa98fe8
225 changed files with 13485 additions and 6123 deletions
+2 -2
View File
@@ -44,10 +44,10 @@ system doconce split_html $html.html --method=space10
# Bootstrap style
html=${name}-bs
system doconce format html $name --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=$html $opt
system doconce split_html $html.html --method=split --pagination --nav_button=bottom
#system doconce split_html $html.html --method=split --pagination --nav_button=bottom
# IPython notebook
#system doconce format ipynb $name $opt
system doconce format ipynb $name $opt
# LaTeX Beamer slides
beamertheme=red_plain
+15
View File
@@ -155,3 +155,18 @@ o Support vector machines and finally various variants of
o Artifical neural networks and deep learning
!split
===== Why this text? =====
!split
===== Choice of programming language =====
!split
===== Data handling, machine learning and ethical aspects =====
!split
===== Acknowledgements =====
+7
View File
@@ -3,6 +3,13 @@ AUTHOR: Morten Hjorth-Jensen {copyright, 1999-present|CC BY-NC} at Department of
DATE: today
!split
===== To do =====
* add material on python handling of matrices and vectors
* keep c++ material?
!split
===== Important Matrix and vector handling packages =====
+31
View File
@@ -592,6 +592,37 @@ print(sgdreg.intercept_, sgdreg.coef_)
!split
===== Polynomial Regression =====
!bc pycod
# Importing various packages
from math import exp, sqrt
from random import random, seed
import numpy as np
import matplotlib.pyplot as plt
m = 100
x = 2*np.random.rand(m,1)+4.
y = 4+3*x*x+ +x-np.random.randn(m,1)
xb = np.c_[np.ones((m,1)), x]
theta = np.linalg.inv(xb.T.dot(xb)).dot(xb.T).dot(y)
xnew = np.array([[0],[2]])
xbnew = np.c_[np.ones((2,1)), xnew]
ypredict = xbnew.dot(theta)
plt.plot(xnew, ypredict, "r-")
plt.plot(x, y ,'ro')
plt.axis([0,2.0,0, 15.0])
plt.xlabel(r'$x$')
plt.ylabel(r'$y$')
plt.title(r'Random numbers ')
plt.show()
!ec
!split
+56 -1
View File
@@ -1,7 +1,11 @@
TITLE: Data Analysis and Machine Learning: Elements of Probability Theory
TITLE: Data Analysis and Machine Learning: Elements of Probability Theory and Statistical Data Analysis
AUTHOR: Morten Hjorth-Jensen {copyright, 1999-present|CC BY-NC} at Department of Physics, University of Oslo & Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University
DATE: today
!split
===== Things to add =====
Add general statistic elements (probability theory mainly), assumed knowledge
!split
===== Domains and probabilities =====
@@ -568,6 +572,14 @@ the binomial distribution we can show that
!et
!eblock
!split
===== Additions to make =====
* discuss more sample mean and variance
* sample covariance and Bessel's theorem on 1/(n-1) versus 1/n
* add more text to covariance matrix and results of codes
!split
===== Meet the covariance! =====
!bblock
@@ -949,6 +961,49 @@ more practically oriented methods like the blocking technique.
#add ref here to flybjerg
!eblock
!split
===== Code to compute the Covariance matrix and the Covariance =====
!bc pycod
# Importing various packages
from math import exp, sqrt
from random import random, seed
import numpy as np
import matplotlib.pyplot as plt
# Sample covariance, note the factor 1/(n-1)
def covariance(x, y, n):
sum = 0.0
mean_x = np.mean(x)
mean_y = np.mean(y)
for i in range(0, n):
sum += (x[(i)]-mean_x)*(y[i]-mean_y)
return sum/(n-1.)
n = 100
x = np.random.normal(size=n)
print(np.mean(x))
y = 4+3*x+np.random.normal(size=n)
print(np.mean(y))
z = x**3+np.random.normal(size=n)
print(np.mean(z))
covxx = covariance(x,x,n)
covyy = covariance(y,y,n)
covzz = covariance(z,z,n)
covxy = covariance(x,y,n)
covxz = covariance(x,z,n)
covyz = covariance(y,z,n)
print(covxx,covyy, covzz)
print(covxy,covxz, covyz)
w = np.vstack((x, y, z))
#print(w)
c = np.cov(w)
print(c)
#eigen = np.zeros(n)
Eigvals, Eigvecs = np.linalg.eig(c)
print(Eigvals)
!ec
!split
======= Random Numbers =======
!bblock
@@ -0,0 +1,12 @@
\mode<presentation>
\usecolortheme[rgb={0.8, 0.2, 0}]{structure}
\usefonttheme[onlysmall]{structurebold}
\setbeamertemplate{navigation symbols}{}
%\setbeamertemplate{footline}[frame number]
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,backgrounds,decorations,mindmap}
\mode
<all>
@@ -0,0 +1,15 @@
\mode<presentation>
\useoutertheme{smoothbars}
\useinnertheme[shadow=true]{rounded}
\usecolortheme{orchid}
\usecolortheme{whale}
\usecolortheme[rgb={0.7, 0.2, 0}]{structure} % (darker red)
\useoutertheme{shadow}
\usefonttheme[onlysmall]{structurebold}
\setbeamercolor{title}{use=structure,fg=white,bg=structure.fg}
\setbeamerfont{block title}{size={}}
\mode
<all>
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
doconce clean
rm -rf *.pdf *.tex ipynb*.tar.gz *.html ._*.html *~ reveal.js Trash README.txt
+118
View File
@@ -0,0 +1,118 @@
#!/bin/sh
set -x
function system {
"$@"
if [ $? -ne 0 ]; then
echo "make.sh: unsuccessful command $@"
echo "abort!"
exit 1
fi
}
if [ $# -eq 0 ]; then
echo 'bash make.sh slides1|slides2'
exit 1
fi
name=$1
rm -f *.tar.gz
opt="--encoding=utf-8"
# Note: Makefile examples contain constructions like ${PROG} which
# looks like Mako constructions, but they are not. Use --no_mako
# to turn off Mako processing.
opt="--no_mako"
rm -f *.aux
html=${name}-reveal
system doconce format html $name --pygments_html_style=perldoc --keep_pygments_html_bg --html_links_in_new_window --html_output=$html $opt
system doconce slides_html $html reveal --html_slide_theme=beige
# Plain HTML documents
html=${name}-solarized
system doconce format html $name --pygments_html_style=perldoc --html_style=solarized3 --html_links_in_new_window --html_output=$html $opt
system doconce split_html $html.html --method=space10
html=${name}
system doconce format html $name --pygments_html_style=default --html_style=bloodish --html_links_in_new_window --html_output=$html $opt
system doconce split_html $html.html --method=space10
# Bootstrap style
html=${name}-bs
system doconce format html $name --html_style=bootstrap --pygments_html_style=default --html_admon=bootstrap_panel --html_output=$html $opt
#system doconce split_html $html.html --method=split --pagination --nav_button=bottom
# IPython notebook
system doconce format ipynb $name $opt
# LaTeX Beamer slides
beamertheme=red_plain
system doconce format pdflatex $name --latex_title_layout=beamer --latex_table_format=footnotesize $opt
system doconce ptex2tex $name envir=minted
# Add special packages
doconce subst "% Add user's preamble" "\g<1>\n\\usepackage{simplewick}" $name.tex
system doconce slides_beamer $name --beamer_slide_theme=$beamertheme
system pdflatex -shell-escape ${name}
system pdflatex -shell-escape ${name}
cp $name.pdf ${name}-beamer.pdf
cp $name.tex ${name}-beamer.tex
# Handouts
system doconce format pdflatex $name --latex_title_layout=beamer --latex_table_format=footnotesize $opt
system doconce ptex2tex $name envir=minted
# Add special packages
doconce subst "% Add user's preamble" "\g<1>\n\\usepackage{simplewick}" $name.tex
system doconce slides_beamer $name --beamer_slide_theme=red_shadow --handout
system pdflatex -shell-escape $name
pdflatex -shell-escape $name
pdflatex -shell-escape $name
pdfnup --nup 2x3 --frame true --delta "1cm 1cm" --scale 0.9 --outfile ${name}-beamer-handouts2x3.pdf ${name}.pdf
rm -f ${name}.pdf
# Ordinary plain LaTeX document
rm -f *.aux # important after beamer
system doconce format pdflatex $name --minted_latex_style=trac --latex_admon=paragraph $opt
system doconce ptex2tex $name envir=minted
# Add special packages
doconce subst "% Add user's preamble" "\g<1>\n\\usepackage{simplewick}" $name.tex
doconce replace 'section{' 'section*{' $name.tex
pdflatex -shell-escape $name
pdflatex -shell-escape $name
mv -f $name.pdf ${name}-minted.pdf
cp $name.tex ${name}-plain-minted.tex
# Publish
dest=../../pub
if [ ! -d $dest/$name ]; then
mkdir $dest/$name
mkdir $dest/$name/pdf
mkdir $dest/$name/html
mkdir $dest/$name/ipynb
fi
cp ${name}*.pdf $dest/$name/pdf
cp -r ${name}*.html ._${name}*.html reveal.js $dest/$name/html
# Figures: cannot just copy link, need to physically copy the files
if [ -d fig-${name} ]; then
if [ ! -d $dest/$name/html/fig-$name ]; then
mkdir $dest/$name/html/fig-$name
fi
cp -r fig-${name}/* $dest/$name/html/fig-$name
fi
cp ${name}.ipynb $dest/$name/ipynb
ipynb_tarfile=ipynb-${name}-src.tar.gz
if [ ! -f ${ipynb_tarfile} ]; then
cat > README.txt <<EOF
This IPython notebook ${name}.ipynb does not require any additional
programs.
EOF
tar czf ${ipynb_tarfile} README.txt
fi
cp ${ipynb_tarfile} $dest/$name/ipynb
+11
View File
@@ -0,0 +1,11 @@
TITLE: Data Analysis and Machine Learning: Support Vector Machines
AUTHOR: Morten Hjorth-Jensen {copyright, 1999-present|CC BY-NC} at Department of Physics, University of Oslo & Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University
DATE: today
!split
===== Support Vector Machines, overarching aims =====
!bblock
!eblock
-15
View File
@@ -1,15 +0,0 @@
cwd=$(pwd)
cd Bayesian && bash make.sh Bayesian
cd ${cwd}
cd DecisionTrees && bash make.sh DecisionTrees
cd ${cwd}
cd How2ReadData && bash make.sh How2ReadData
cd ${cwd}
cd NeuralNet && bash make.sh NeuralNet
cd ${cwd}
cd Regression && bash make.sh Regression
cd ${cwd}
cd Statistics && bash make.sh Statistics
cd ${cwd}
cd Projects/2017/Project && bash make.sh Project
cd ${cwd}