diff --git a/doc/src/week34/week34.tex b/doc/src/week34/beamerweek34.do.txt similarity index 57% rename from doc/src/week34/week34.tex rename to doc/src/week34/beamerweek34.do.txt index 9ffdd8ea0..92726eb13 100644 --- a/doc/src/week34/week34.tex +++ b/doc/src/week34/beamerweek34.do.txt @@ -1,369 +1,145 @@ - -% LaTeX Beamer file automatically generated from DocOnce -% https://github.com/doconce/doconce - -%-------------------- begin beamer-specific preamble ---------------------- - -\documentclass{beamer} - -\usetheme{red_plain} -\usecolortheme{default} - -% turn off the almost invisible, yet disturbing, navigation symbols: -\setbeamertemplate{navigation symbols}{} - -% Examples on customization: -%\usecolortheme[named=RawSienna]{structure} -%\usetheme[height=7mm]{Rochester} -%\setbeamerfont{frametitle}{family=\rmfamily,shape=\itshape} -%\setbeamertemplate{items}[ball] -%\setbeamertemplate{blocks}[rounded][shadow=true] -%\useoutertheme{infolines} -% -%\usefonttheme{} -%\useinntertheme{} -% -%\setbeameroption{show notes} -%\setbeameroption{show notes on second screen=right} - -% fine for B/W printing: -%\usecolortheme{seahorse} - -\usepackage{pgf} -\usepackage{graphicx} -\usepackage{epsfig} -\usepackage{relsize} - -\usepackage{fancybox} % make sure fancybox is loaded before fancyvrb - -\usepackage{fancyvrb} -\usepackage{minted} % requires pygments and latex -shell-escape filename -%\usepackage{anslistings} -%\usepackage{listingsutf8} - -\usepackage{amsmath,amssymb,bm} -%\usepackage[latin1]{inputenc} -\usepackage[T1]{fontenc} -\usepackage[utf8]{inputenc} -\usepackage{colortbl} -\usepackage[english]{babel} -\usepackage{tikz} -\usepackage{framed} -% Use some nice templates -\beamertemplatetransparentcovereddynamic - -% --- begin table of contents based on sections --- -% Delete this, if you do not want the table of contents to pop up at -% the beginning of each section: -% (Only section headings can enter the table of contents in Beamer -% slides generated from DocOnce source, while subsections are used -% for the title in ordinary slides.) -\AtBeginSection[] -{ - \begin{frame}[plain] - \frametitle{} - %\frametitle{Outline} - \tableofcontents[currentsection] - \end{frame} -} -% --- end table of contents based on sections --- - -% If you wish to uncover everything in a step-wise fashion, uncomment -% the following command: - -%\beamerdefaultoverlayspecification{<+->} - -\newcommand{\shortinlinecomment}[3]{\note{\textbf{#1}: #2}} -\newcommand{\longinlinecomment}[3]{\shortinlinecomment{#1}{#2}{#3}} - -\definecolor{linkcolor}{rgb}{0,0,0.4} -\hypersetup{ - colorlinks=true, - linkcolor=linkcolor, - urlcolor=linkcolor, - pdfmenubar=true, - pdftoolbar=true, - bookmarksdepth=3 - } -\setlength{\parskip}{0pt} % {1em} - -\newenvironment{doconceexercise}{}{} -\newcounter{doconceexercisecounter} -\newenvironment{doconce:movie}{}{} -\newcounter{doconce:movie:counter} - -\newcommand{\subex}[1]{\noindent\textbf{#1}} % for subexercises: a), b), etc - -\logo{{\tiny \copyright\ 1999-2023, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license}} - -%-------------------- end beamer-specific preamble ---------------------- - -% Add user's preamble +TITLE: Week 34: Introduction to the course, Logistics and Practicalities +AUTHOR: Morten Hjorth-Jensen {copyright, 1999-present|CC BY-NC} at Department of Physics and Center for Computing in Science Education, University of Oslo, Norway & Department of Physics and Astronomy and Facility for Rare Isotope Beams, Michigan State University, USA +DATE: Week 34, August 21-25, 2021 +!split +===== Overview of first week ===== -% insert custom LaTeX commands... - -\raggedbottom -\makeindex - -%-------------------- end preamble ---------------------- - -\begin{document} - -% matching end for #ifdef PREAMBLE - -\newcommand{\exercisesection}[1]{\subsection*{#1}} - - - -% ------------------- main content ---------------------- - - - -% ----------------- title ------------------------- - -\title{Week 34: Introduction to the course, Logistics and Practicalities} - -% ----------------- author(s) ------------------------- - -\author{Morten Hjorth-Jensen\inst{1,2}} -\institute{Department of Physics and Center for Computing in Science Education, University of Oslo, Norway\inst{1} -\and -Department of Physics and Astronomy and Facility for Rare Isotope Beams, Michigan State University, USA\inst{2}} -% ----------------- end author(s) ------------------------- - -\date{Week 34, August 21-25, 2021 -% -\ \\ -{\tiny \copyright\ 1999-2023, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license} -} - -\begin{frame}[plain,fragile] -\titlepage -\end{frame} - -\begin{frame}[plain,fragile] -\frametitle{Overview of first week} - -\begin{enumerate} -\item The sessions on Tuesdays and Wednesdays last four hours for each group (four groups in total) and will include lectures in a flipped mode (promoting active learning) and work on exercices and projects. - -\item The sessions will begin with lectures, discussions, questions and answers about the material to be covered every week. - -\item There are four groups: -\begin{itemize} - - \item Tuesdays 815am-12pm and 1215pm-4pm - - \item Wednesdays 815am-12pm and 1215pm-4pm. -\end{itemize} - -\noindent -\end{enumerate} - -\noindent +o The sessions on Tuesdays and Wednesdays last four hours for each group (four groups in total) and will include lectures in a flipped mode (promoting active learning) and work on exercices and projects. +o The sessions will begin with lectures, discussions, questions and answers about the material to be covered every week. +o There are four groups: + * Tuesdays 815am-12pm and 1215pm-4pm + * Wednesdays 815am-12pm and 1215pm-4pm. Please sign up as soon as possible for one of the groups. Max capacity per group is 30-40 participants. The labs are also available till 6pm Tuesdays and Wednesdays. Videos and learning material with reading suggestions will be made available before each week starts. -\begin{enumerate} -\item On Thursdays we have a regular lecture. These lectures start at 1215pm and end at 2pm and serve the aims of giving an overview over various topics. -\end{enumerate} +o On Thursdays we have a regular lecture. These lectures start at 1215pm and end at 2pm and serve the aims of giving an overview over various topics. + -\noindent The first week we start with simple linear regression, a repetition of linear algebra and elements of statistics needed for the course. -\end{frame} -\begin{frame}[plain,fragile] -\frametitle{Schedule first week} -\begin{block}{} -\begin{itemize} - \item August 22: Presentation of the course, aims and content. Introduction to software and repetition of Python Programming, linear algebra and basic elements of statistics. Please select group. +!split +===== Schedule first week ===== - \item August 23: Presentation of the course, aims and content. Introduction to software and repetition of Python Programming, linear algebra and basic elements of statistics. Please select group. +!bblock + * August 22: Presentation of the course, aims and content. Introduction to software and repetition of Python Programming, linear algebra and basic elements of statistics. Please select group. + * August 23: Presentation of the course, aims and content. Introduction to software and repetition of Python Programming, linear algebra and basic elements of statistics. Please select group. + * August 24: Lecture: Linear regression, examples and theory +!eblock - \item August 24: Lecture: Linear regression, examples and theory -\end{itemize} +!split +===== Reading Recommendations ===== -\noindent -\end{block} -\end{frame} - -\begin{frame}[plain,fragile] -\frametitle{Reading Recommendations} - -\begin{block}{} +!bblock For the reading assignments we use the following abbreviations: -\begin{itemize} -\item GBC: \href{{https://www.deeplearningbook.org/}}{Goodfellow, Bengio, and Courville, Deep Learning} +* GBC: "Goodfellow, Bengio, and Courville, Deep Learning":"https://www.deeplearningbook.org/" +* CMB: Christopher M. Bishop, Pattern Recognition and Machine Learning +* HTF: Hastie, Tibshirani, and Friedman, The Elements of Statistical Learning +* AG: Aurelien Geron, Hands‑On Machine Learning with Scikit‑Learn and TensorFlow +* KM: "Kevin Murphy, Probabilistic Machine Learning":"https://probml.github.io/pml-book/book1.html" -\item CMB: Christopher M. Bishop, Pattern Recognition and Machine Learning +Reading recommendations this week: Refresh linear algebra, GBC chapters 1 and 2. CMB sections 1.1 and 3.1. HTF chapters 2 and 3. Install scikit-learn. See lecture notes for week 34 at https://compphysics.github.io/MachineLearning/doc/web/course.html (these notes). +!eblock -\item HTF: Hastie, Tibshirani, and Friedman, The Elements of Statistical Learning -\item AG: Aurelien Geron, Hands‑On Machine Learning with Scikit‑Learn and TensorFlow -\item KM: \href{{https://probml.github.io/pml-book/book1.html}}{Kevin Murphy, Probabilistic Machine Learning} -\end{itemize} +!split +===== Lectures and ComputerLab ===== -\noindent -Reading recommendations this week: Refresh linear algebra, GBC chapters 1 and 2. CMB sections 1.1 and 3.1. HTF chapters 2 and 3. Install scikit-learn. See lecture notes for week 34 at \href{{https://compphysics.github.io/MachineLearning/doc/web/course.html}}{\nolinkurl{https://compphysics.github.io/MachineLearning/doc/web/course.html}} (these notes). -\end{block} -\end{frame} +!bblock + * The sessions on Tuesdays and Wednesdays last four hours and will include partly lectures in a flipped mode (promoting active learning) and work on exercices and projects. + * Thursdays: regular lectures (12.15pm-2pm) + * Weekly reading assignments and videos needed to solve projects and exercises. + * Weekly exercises when not working on projects. You can hand in exercises if you want. + * Detailed lecture notes, exercises, all programs presented, projects etc can be found at the homepage of the course. + * Weekly plans and all other information are on the official webpage. + * No final exam, three projects that are graded and have to be approved. +!eblock -\begin{frame}[plain,fragile] -\frametitle{Lectures and ComputerLab} -\begin{block}{} -\begin{itemize} - \item The sessions on Tuesdays and Wednesdays last four hours and will include partly lectures in a flipped mode (promoting active learning) and work on exercices and projects. +!split +===== Communication channels ===== - \item Thursdays: regular lectures (12.15pm-2pm) +* Chat and communications via URL:"canvas.uio.no" +* _Slack_ channel: machinelearninguio.slack.com - \item Weekly reading assignments and videos needed to solve projects and exercises. - \item Weekly exercises when not working on projects. You can hand in exercises if you want. +!split +===== Course Format ===== - \item Detailed lecture notes, exercises, all programs presented, projects etc can be found at the homepage of the course. +!bblock + * Three compulsory projects. Electronic reports only using "Canvas":"https://www.uio.no/english/services/it/education/canvas/" to hand in projects and "git":"https://git-scm.com/" as version control software and "GitHub":"https://github.com/" for repository (or "GitLab":"https://about.gitlab.com/") of all your material. + * Evaluation and grading: The three projects are graded and each counts 1/3 of the final mark. No final written or oral exam. + o For the last project each group/participant submits a proposal or works with suggested (by us) proposals for the project. + o If possible, we would like to organize the last project as a workshop where each group makes a poster and presents this to all other participants of the course + o Poster session where all participants can study and discuss the other proposals. + o Based on feedback etc, each group finalizes the report and submits for grading. + * Python is the default programming language, but feel free to use C/C++ and/or Fortran or other programming languages. All source codes discussed during the lectures can be found at the webpage and "github address":"https://github.com/CompPhysics/MachineLearning/tree/master/doc/Programs" of the course. +!eblock - \item Weekly plans and all other information are on the official webpage. - \item No final exam, three projects that are graded and have to be approved. -\end{itemize} -\noindent -\end{block} -\end{frame} -\begin{frame}[plain,fragile] -\frametitle{Communication channels} +!split +===== Teachers ===== -\begin{itemize} -\item Chat and communications via \href{{canvas.uio.no}}{\nolinkurl{canvas.uio.no}} +!bblock -\item \textbf{Slack} channel: machinelearninguio.slack.com -\end{itemize} +_Teachers :_ +* Morten Hjorth-Jensen, morten.hjorth-jensen@fys.uio.no + * _Phone_: +47-48257387 + * _Office_: Department of Physics, University of Oslo, Eastern wing, room FØ470 + * _Office hours_: *Anytime*! Individual or group office hours can be arranged either in person or via zoom. Feel free to send an email for planning. +* Ida Torkjellsdatter Storehaug, i.t.storehaug@fys.uio.no +* Fahimeh Najafi, fahim.n.20@gmail.com +* Mia-Katrin Ose Kvalsund, m.k.o.kvalsund@fys.uio.no +* Karl Henrik Fredly, k.h.fredly@fys.uio.no +* Adam Jakobsen, adam.jakobsen@fys.uio.no +* Daniel Haas Beccatini Lima, d.h.b.lima@fys.uio.no -\noindent -\end{frame} +!eblock -\begin{frame}[plain,fragile] -\frametitle{Course Format} +!split +===== Deadlines for projects (tentative) ===== -\begin{block}{} -\begin{itemize} - \item Three compulsory projects. Electronic reports only using \href{{https://www.uio.no/english/services/it/education/canvas/}}{Canvas} to hand in projects and \href{{https://git-scm.com/}}{git} as version control software and \href{{https://github.com/}}{GitHub} for repository (or \href{{https://about.gitlab.com/}}{GitLab}) of all your material. +!bblock - \item Evaluation and grading: The three projects are graded and each counts 1/3 of the final mark. No final written or oral exam. -\begin{enumerate} +o Project 1: October 9 (available September 4) graded with feedback) +o Project 2: November 6 (available October 6, graded with feedback) +o Project 3: December 11 (available November 10, graded with feedback) - \item For the last project each group/participant submits a proposal or works with suggested (by us) proposals for the project. +Projects are handed in using _Canvas_. We use Github as repository for codes, benchmark calculations etc. Comments and feedback on projects only via _Canvas_. - \item If possible, we would like to organize the last project as a workshop where each group makes a poster and presents this to all other participants of the course +!eblock - \item Poster session where all participants can study and discuss the other proposals. - \item Based on feedback etc, each group finalizes the report and submits for grading. +!split +===== Recommended textbooks ===== -\end{enumerate} -\noindent - \item Python is the default programming language, but feel free to use C/C++ and/or Fortran or other programming languages. All source codes discussed during the lectures can be found at the webpage and \href{{https://github.com/CompPhysics/MachineLearning/tree/master/doc/Programs}}{github address} of the course. -\end{itemize} +o The lecture notes are collected as a jupyter-book at URL:"https://compphysics.github.io/MachineLearning/doc/LectureNotes/_build/html/intro.html". -\noindent -\end{block} -\end{frame} +In addition to the lecture notes, we recommend the books of Bishop and Goodfellow et al. We will follow these texts closely and the weekly reading assignments refer to these two texts. The text by Hastie et al is also widely used in the Machine Learning community. Finally, we also recommend the hands-on text by Geron, see below. -\begin{frame}[plain,fragile] -\frametitle{Teachers} +o Christopher M. Bishop, Pattern Recognition and Machine Learning, Springer, URL:"https://www.springer.com/gp/book/9780387310732". -\begin{block}{} +o Ian Goodfellow, Yoshua Bengio, and Aaron Courville. The different chapters are available for free at URL:"https://www.deeplearningbook.org/". Chapters 2-14 are highly recommended. The lectures follow to a larg extent this text. The weekly plans will include reading suggestions from these two textbooks. -\textbf{Teachers :} -\begin{itemize} -\item Morten Hjorth-Jensen, morten.hjorth-jensen@fys.uio.no -\begin{itemize} - - \item \textbf{Phone}: +47-48257387 - - \item \textbf{Office}: Department of Physics, University of Oslo, Eastern wing, room FØ470 - - \item \textbf{Office hours}: \emph{Anytime}! Individual or group office hours can be arranged either in person or via zoom. Feel free to send an email for planning. - -\end{itemize} - -\noindent -\item Ida Torkjellsdatter Storehaug, i.t.storehaug@fys.uio.no - -\item Fahimeh Najafi, fahim.n.20@gmail.com - -\item Mia-Katrin Ose Kvalsund, m.k.o.kvalsund@fys.uio.no - -\item Karl Henrik Fredly, k.h.fredly@fys.uio.no - -\item Adam Jakobsen, adam.jakobsen@fys.uio.no - -\item Daniel Haas Beccatini Lima, d.h.b.lima@fys.uio.no -\end{itemize} - -\noindent -\end{block} -\end{frame} - -\begin{frame}[plain,fragile] -\frametitle{Deadlines for projects (tentative)} - -\begin{block}{} - -\begin{enumerate} -\item Project 1: October 9 (available September 4) graded with feedback) - -\item Project 2: November 6 (available October 6, graded with feedback) - -\item Project 3: December 11 (available November 10, graded with feedback) -\end{enumerate} - -\noindent -Projects are handed in using \textbf{Canvas}. We use Github as repository for codes, benchmark calculations etc. Comments and feedback on projects only via \textbf{Canvas}. - -\end{block} -\end{frame} - -\begin{frame}[plain,fragile] -\frametitle{Recommended textbooks} - -\begin{enumerate} -\item The lecture notes are collected as a jupyter-book at \href{{https://compphysics.github.io/MachineLearning/doc/LectureNotes/_build/html/intro.html}}{\nolinkurl{https://compphysics.github.io/MachineLearning/doc/LectureNotes/_build/html/intro.html}}. -\end{enumerate} - -\noindent -In addition to the lecture notes, we recommend the books of Bishop and Goodfellow et al.~We will follow these texts closely and the weekly reading assignments refer to these two texts. The text by Hastie et al is also widely used in the Machine Learning community. Finally, we also recommend the hands-on text by Geron, see below. - -\begin{enumerate} -\item Christopher M. Bishop, Pattern Recognition and Machine Learning, Springer, \href{{https://www.springer.com/gp/book/9780387310732}}{\nolinkurl{https://www.springer.com/gp/book/9780387310732}}. - -\item Ian Goodfellow, Yoshua Bengio, and Aaron Courville. The different chapters are available for free at \href{{https://www.deeplearningbook.org/}}{\nolinkurl{https://www.deeplearningbook.org/}}. Chapters 2-14 are highly recommended. The lectures follow to a larg extent this text. The weekly plans will include reading suggestions from these two textbooks. -\end{enumerate} - -\noindent Additional textbooks: -\begin{enumerate} -\item Trevor Hastie, Robert Tibshirani, Jerome H. Friedman, The Elements of Statistical Learning, Springer, \href{{https://www.springer.com/gp/book/9780387848570}}{\nolinkurl{https://www.springer.com/gp/book/9780387848570}}. This is a well-known text and serves as additional literature. +o Trevor Hastie, Robert Tibshirani, Jerome H. Friedman, The Elements of Statistical Learning, Springer, URL:"https://www.springer.com/gp/book/9780387848570". This is a well-known text and serves as additional literature. -\item Aurelien Geron, Hands‑On Machine Learning with Scikit‑Learn and TensorFlow, O'Reilly, \href{{https://www.oreilly.com/library/view/hands-on-machine-learning/9781492032632/.}}{\nolinkurl{https://www.oreilly.com/library/view/hands-on-machine-learning/9781492032632/.}} This text is very useful since it contains many code examples and hands-on applications of all algorithms discussed in this course. -\end{enumerate} +o Aurelien Geron, Hands‑On Machine Learning with Scikit‑Learn and TensorFlow, O'Reilly, https://www.oreilly.com/library/view/hands-on-machine-learning/9781492032632/. This text is very useful since it contains many code examples and hands-on applications of all algorithms discussed in this course. -\noindent -\end{frame} -\begin{frame}[plain,fragile] -\frametitle{Prerequisites} + +!split +===== Prerequisites ===== Basic knowledge in programming and mathematics, with an emphasis on linear algebra. Knowledge of Python or/and C++ as programming @@ -374,12 +150,14 @@ of the corresponding computing and programming courses INF1000/INF1110 or MAT-INF1100/MAT-INF1100L/BIOS1100/KJM-INF1100. Most universities offer nowadays a basic programming course (often compulsory) where Python is the recurring programming language. -\end{frame} -\begin{frame}[plain,fragile] -\frametitle{Learning outcomes} -\begin{block}{} + +!split +===== Learning outcomes ===== + +!bblock + This course aims at giving you insights and knowledge about many of the central algorithms used in Data Analysis and Machine Learning. @@ -395,160 +173,98 @@ learn to handle large scientific projects. A good scientific and ethical conduct is emphasized throughout the course. More specifically, after this course you will -\begin{itemize} -\item Learn about basic data analysis, statistical analysis, Bayesian statistics, Monte Carlo sampling, data optimization and machine learning; +* Learn about basic data analysis, statistical analysis, Bayesian statistics, Monte Carlo sampling, data optimization and machine learning; +* Be capable of extending the acquired knowledge to other systems and cases; +* Have an understanding of central algorithms used in data analysis and machine learning; +* Understand linear methods for regression and classification, from ordinary least squares, via Lasso and Ridge to Logistic regression; +* Learn about neural networks and deep learning methods for supervised and unsupervised learning. Emphasis on feed forward neural networks, convolutional and recurrent neural networks; +* Learn about about decision trees, random forests, bagging and boosting methods; +* Learn about support vector machines and kernel transformations; +* Reduction of data sets, from PCA to clustering; +* Autoencoders and Reinforcement Learning; +* Work on numerical projects to illustrate the theory. The projects play a central role and you are expected to know modern programming languages like Python or C++ and/or Fortran (Fortran2003 or later) or Julia or other. -\item Be capable of extending the acquired knowledge to other systems and cases; +!eblock -\item Have an understanding of central algorithms used in data analysis and machine learning; - -\item Understand linear methods for regression and classification, from ordinary least squares, via Lasso and Ridge to Logistic regression; - -\item Learn about neural networks and deep learning methods for supervised and unsupervised learning. Emphasis on feed forward neural networks, convolutional and recurrent neural networks; - -\item Learn about about decision trees, random forests, bagging and boosting methods; - -\item Learn about support vector machines and kernel transformations; - -\item Reduction of data sets, from PCA to clustering; - -\item Autoencoders and Reinforcement Learning; - -\item Work on numerical projects to illustrate the theory. The projects play a central role and you are expected to know modern programming languages like Python or C++ and/or Fortran (Fortran2003 or later) or Julia or other. -\end{itemize} - -\noindent -\end{block} -\end{frame} - -\begin{frame}[plain,fragile] -\frametitle{Topics covered in this course: Statistical analysis and optimization of data} +!split +===== Topics covered in this course: Statistical analysis and optimization of data ===== The course has two central parts -\begin{enumerate} -\item Statistical analysis and optimization of data +o Statistical analysis and optimization of data +o Machine learning -\item Machine learning -\end{enumerate} - -\noindent These topics will be scattered thorughout the course and may not necessarily be taught separately. Rather, we will often take an approach (during the lectures and project/exercise sessions) where say elements from statistical data analysis are mixed with specific Machine Learning algorithms -\begin{block}{Statistical analysis and optimization of data } +!bblock Statistical analysis and optimization of data We plan to cover the following topics: -\begin{itemize} -\item Basic concepts, expectation values, variance, covariance, correlation functions and errors; +* Basic concepts, expectation values, variance, covariance, correlation functions and errors; +* Simpler models, binomial distribution, the Poisson distribution, simple and multivariate normal distributions; +* Central elements of Bayesian statistics and modeling; +* Gradient methods for data optimization; +* Monte Carlo methods, Markov chains, Gibbs sampling and Metropolis-Hastings sampling (tentative); +* Estimation of errors and resampling techniques such as the cross-validation, blocking, bootstrapping and jackknife methods; +* Principal Component Analysis (PCA) and its mathematical foundation; -\item Simpler models, binomial distribution, the Poisson distribution, simple and multivariate normal distributions; +!eblock -\item Central elements of Bayesian statistics and modeling; -\item Gradient methods for data optimization; +!split +===== Topics covered in this course ===== -\item Monte Carlo methods, Markov chains, Gibbs sampling and Metropolis-Hastings sampling (tentative); - -\item Estimation of errors and resampling techniques such as the cross-validation, blocking, bootstrapping and jackknife methods; - -\item Principal Component Analysis (PCA) and its mathematical foundation; -\end{itemize} - -\noindent -\end{block} -\end{frame} - -\begin{frame}[plain,fragile] -\frametitle{Topics covered in this course} - -\begin{block}{} +!bblock The following topics will be covered -\begin{itemize} -\item Pre deep-learning revolution (2008 approx) -\begin{itemize} +* Pre deep-learning revolution (2008 approx) + * Linear Regression and Logistic Regression, classification and regression problems; + * Bayesian linear and logistic regression, kernel regression; + * Decisions trees, Random Forests, Bagging and Boosting methods; + * Support vector machines (only survey); + * Unsupervised learning and dimensionality reduction, from PCA to clustering; +* Deep learning + * Neural networks and deep learning; + * Convolutional neural networks; + * Recurrent neural networks; + * Autoencoders + * Generative methods with an emphasis on Boltzmann Machines, Variational Autoencoders and Generalized Adversarial Networks; - \item Linear Regression and Logistic Regression, classification and regression problems; - \item Bayesian linear and logistic regression, kernel regression; - - \item Decisions trees, Random Forests, Bagging and Boosting methods; - - \item Support vector machines (only survey); - - \item Unsupervised learning and dimensionality reduction, from PCA to clustering; - -\end{itemize} - -\noindent -\item Deep learning -\begin{itemize} - - \item Neural networks and deep learning; - - \item Convolutional neural networks; - - \item Recurrent neural networks; - - \item Autoencoders - - \item Generative methods with an emphasis on Boltzmann Machines, Variational Autoencoders and Generalized Adversarial Networks; -\end{itemize} - -\noindent -\end{itemize} - -\noindent Hands-on demonstrations, exercises and projects aim at deepening your understanding of these topics. -\end{block} -\end{frame} +!eblock -\begin{frame}[plain,fragile] -\frametitle{Extremely useful tools, strongly recommended} -\begin{block}{and discussed at the lab sessions } -\begin{itemize} - \item GIT for version control, and GitHub or GitLab as repositories, highly recommended. This will be discussed during the first exercise session +!split +===== Extremely useful tools, strongly recommended ===== - \item Anaconda and other Python environments, see intro slides and links to programming resources at \href{{https://computationalscienceuio.github.io/RefreshProgrammingSkills/intro.html}}{\nolinkurl{https://computationalscienceuio.github.io/RefreshProgrammingSkills/intro.html}} -\end{itemize} +!bblock and discussed at the lab sessions + * GIT for version control, and GitHub or GitLab as repositories, highly recommended. This will be discussed during the first exercise session + * Anaconda and other Python environments, see intro slides and links to programming resources at URL:"https://computationalscienceuio.github.io/RefreshProgrammingSkills/intro.html" +!eblock -\noindent -\end{block} -\end{frame} -\begin{frame}[plain,fragile] -\frametitle{Other courses on Data science and Machine Learning at UiO} -The link here \href{{https://www.mn.uio.no/english/research/about/centre-focus/innovation/data-science/studies/}}{\nolinkurl{https://www.mn.uio.no/english/research/about/centre-focus/innovation/data-science/studies/}} gives an excellent overview of courses on Machine learning at UiO. -\begin{enumerate} -\item \href{{https://www.uio.no/studier/emner/matnat/fys/FYS5419/index-eng.html}}{FYS5419 Quantum Computing and Quantum Machine Learning} -\item \href{{https://www.uio.no/studier/emner/matnat/fys/FYS5429/index-eng.html}}{FYS5429 Advanced Machine Learning for the Physical Sciences} -\item \href{{http://www.uio.no/studier/emner/matnat/math/STK2100/index-eng.html}}{STK2100 Machine learning and statistical methods for prediction and classification}. +!split +===== Other courses on Data science and Machine Learning at UiO ===== -\item \href{{https://www.uio.no/studier/emner/matnat/ifi/IN3050/index-eng.html}}{IN3050/4050 Introduction to Artificial Intelligence and Machine Learning}. Introductory course in machine learning and AI with an algorithmic approach. +The link here URL:"https://www.mn.uio.no/english/research/about/centre-focus/innovation/data-science/studies/" gives an excellent overview of courses on Machine learning at UiO. +o "FYS5419 Quantum Computing and Quantum Machine Learning":"https://www.uio.no/studier/emner/matnat/fys/FYS5419/index-eng.html" +o "FYS5429 Advanced Machine Learning for the Physical Sciences":"https://www.uio.no/studier/emner/matnat/fys/FYS5429/index-eng.html" +o "STK2100 Machine learning and statistical methods for prediction and classification":"http://www.uio.no/studier/emner/matnat/math/STK2100/index-eng.html". +o "IN3050/4050 Introduction to Artificial Intelligence and Machine Learning":"https://www.uio.no/studier/emner/matnat/ifi/IN3050/index-eng.html". Introductory course in machine learning and AI with an algorithmic approach. +o "STK-INF3000/4000 Selected Topics in Data Science":"http://www.uio.no/studier/emner/matnat/math/STK-INF3000/index-eng.html". The course provides insight into selected contemporary relevant topics within Data Science. +o "IN4080 Natural Language Processing":"https://www.uio.no/studier/emner/matnat/ifi/IN4080/index.html". Probabilistic and machine learning techniques applied to natural language processing. +o "STK-IN4300 Statistical learning methods in Data Science":"https://www.uio.no/studier/emner/matnat/math/STK-IN4300/index-eng.html". An advanced introduction to statistical and machine learning. For students with a good mathematics and statistics background. +o "IN3310/4310 Deep Learnig for Image Analysis":"https://www.uio.no/studier/emner/matnat/ifi/IN4310/index.html" +o "STK4051 Computational Statistics":"https://www.uio.no/studier/emner/matnat/math/STK4051/index-eng.html" +o "STK4021 Applied Bayesian Analysis and Numerical Methods":"https://www.uio.no/studier/emner/matnat/math/STK4021/index-eng.html" -\item \href{{http://www.uio.no/studier/emner/matnat/math/STK-INF3000/index-eng.html}}{STK-INF3000/4000 Selected Topics in Data Science}. The course provides insight into selected contemporary relevant topics within Data Science. -\item \href{{https://www.uio.no/studier/emner/matnat/ifi/IN4080/index.html}}{IN4080 Natural Language Processing}. Probabilistic and machine learning techniques applied to natural language processing. - -\item \href{{https://www.uio.no/studier/emner/matnat/math/STK-IN4300/index-eng.html}}{STK-IN4300 Statistical learning methods in Data Science}. An advanced introduction to statistical and machine learning. For students with a good mathematics and statistics background. - -\item \href{{https://www.uio.no/studier/emner/matnat/ifi/IN4310/index.html}}{IN3310/4310 Deep Learnig for Image Analysis} - -\item \href{{https://www.uio.no/studier/emner/matnat/math/STK4051/index-eng.html}}{STK4051 Computational Statistics} - -\item \href{{https://www.uio.no/studier/emner/matnat/math/STK4021/index-eng.html}}{STK4021 Applied Bayesian Analysis and Numerical Methods} -\end{enumerate} - -\noindent -\end{frame} - -\begin{frame}[plain,fragile] -\frametitle{Introduction} +!split +===== Introduction ===== Our emphasis throughout this series of lectures is on understanding the mathematical aspects of @@ -562,13 +278,13 @@ and use these to introduce statistical data analysis concepts and machine learning algorithms before we delve into the algorithms themselves. The examples we will use in the beginning, start with simple polynomials with random noise added. We will use the Python -software package \href{{http://scikit-learn.org/stable/}}{Scikit-Learn} and +software package "Scikit-Learn":"http://scikit-learn.org/stable/" and introduce various machine learning algorithms to make fits of the data and predictions. We move thereafter to more interesting cases such as data from say experiments (below we will look at experimental nuclear binding energies as an example). These are examples where we can easily set up the data and then use machine learning algorithms included in for example -\textbf{Scikit-Learn}. +_Scikit-Learn_. These examples will serve us the purpose of getting started. Furthermore, they allow us to catch more than two birds with @@ -582,10 +298,10 @@ Tensorflow (see below for links etc). Moreover, the examples we introduce will serve as inputs to many of our discussions later, as well as allowing you to set up models and produce your own data and get started with programming. -\end{frame} -\begin{frame}[plain,fragile] -\frametitle{What is Machine Learning?} + +!split +===== What is Machine Learning? ===== Statistics, data science and machine learning form important fields of research in modern science. They describe how to learn and make @@ -636,9 +352,9 @@ methods and techniques for analyzing and handling large date sets, relying heavily on statistics, computer science and mathematics. The field is rather new and developing rapidly. Popular software packages written in Python for machine learning like -\href{{http://scikit-learn.org/stable/}}{Scikit-learn}, -\href{{https://www.tensorflow.org/}}{Tensorflow}, -\href{{http://pytorch.org/}}{PyTorch} and \href{{https://keras.io/}}{Keras}, all +"Scikit-learn":"http://scikit-learn.org/stable/", +"Tensorflow":"https://www.tensorflow.org/", +"PyTorch":"http://pytorch.org/" and "Keras":"https://keras.io/", all freely available at their respective GitHub sites, encompass communities of developers in the thousands or more. And the number of code developers and contributors keeps increasing. Not all the @@ -649,65 +365,58 @@ solid command of linear algebra, multivariate theory, probability theory, statistical data analysis, understanding errors and Monte Carlo methods are central elements in a proper understanding of many of algorithms and methods we will discuss. -\end{frame} -\begin{frame}[plain,fragile] -\frametitle{Types of Machine Learning} + +!split +===== Types of Machine Learning ===== + The approaches to machine learning are many, but are often split into -two main categories. In \emph{supervised learning} we know the answer to a +two main categories. In *supervised learning* we know the answer to a problem, and let the computer deduce the logic behind it. On the other -hand, \emph{unsupervised learning} is a method for finding patterns and +hand, *unsupervised learning* is a method for finding patterns and relationship in data sets without any prior knowledge of the system. Some authours also operate with a third category, namely -\emph{reinforcement learning}. This is a paradigm of learning inspired by +*reinforcement learning*. This is a paradigm of learning inspired by behavioral psychology, where learning is achieved by trial-and-error, solely from rewards and punishment. Another way to categorize machine learning tasks is to consider the desired output of a system. Some of the most common tasks are: -\begin{itemize} - \item Classification: Outputs are divided into two or more classes. The goal is to produce a model that assigns inputs into one of these classes. An example is to identify digits based on pictures of hand-written ones. Classification is typically supervised learning. + * Classification: Outputs are divided into two or more classes. The goal is to produce a model that assigns inputs into one of these classes. An example is to identify digits based on pictures of hand-written ones. Classification is typically supervised learning. - \item Regression: Finding a functional relationship between an input data set and a reference data set. The goal is to construct a function that maps input data to continuous output values. + * Regression: Finding a functional relationship between an input data set and a reference data set. The goal is to construct a function that maps input data to continuous output values. - \item Clustering: Data are divided into groups with certain common traits, without knowing the different groups beforehand. It is thus a form of unsupervised learning. -\end{itemize} + * Clustering: Data are divided into groups with certain common traits, without knowing the different groups beforehand. It is thus a form of unsupervised learning. -\noindent -\end{frame} -\begin{frame}[plain,fragile] -\frametitle{Essential elements of ML} +!split +===== Essential elements of ML ===== The methods we cover have three main topics in common, irrespective of whether we deal with supervised or unsupervised learning. -\begin{itemize} -\pause -\item The first ingredient is normally our data set (which can be subdivided into training, validation and test data). Many find the most difficult part of using Machine Learning to be the set up of your data in a meaningful way. +!bpop +* The first ingredient is normally our data set (which can be subdivided into training, validation and test data). Many find the most difficult part of using Machine Learning to be the set up of your data in a meaningful way. -\pause -\item The second item is a model which is normally a function of some parameters. The model reflects our knowledge of the system (or lack thereof). As an example, if we know that our data show a behavior similar to what would be predicted by a polynomial, fitting our data to a polynomial of some degree would then determin our model. +* The second item is a model which is normally a function of some parameters. The model reflects our knowledge of the system (or lack thereof). As an example, if we know that our data show a behavior similar to what would be predicted by a polynomial, fitting our data to a polynomial of some degree would then determin our model. -\pause -\item The last ingredient is a so-called \textbf{cost/loss} function (or error or risk function) which allows us to present an estimate on how good our model is in reproducing the data it is supposed to train. -\end{itemize} +* The last ingredient is a so-called _cost/loss_ function (or error or risk function) which allows us to present an estimate on how good our model is in reproducing the data it is supposed to train. +!epop -\noindent -\end{frame} -\begin{frame}[plain,fragile] -\frametitle{An optimization/minimization problem} -At the heart of basically all Machine Learning algorithms we will encounter so-called minimization or optimization algorithms. A large family of such methods are so-called \textbf{gradient methods}. -\end{frame} -\begin{frame}[plain,fragile] -\frametitle{A Frequentist approach to data analysis} +!split +===== An optimization/minimization problem ===== -When you hear phrases like \textbf{predictions and estimations} and -\textbf{correlations and causations}, what do you think of? May be you think +At the heart of basically all Machine Learning algorithms we will encounter so-called minimization or optimization algorithms. A large family of such methods are so-called _gradient methods_. + +!split +===== A Frequentist approach to data analysis ===== + +When you hear phrases like _predictions and estimations_ and +_correlations and causations_, what do you think of? May be you think of the difference between classifying new data points and generating new data points. Or perhaps you consider that correlations represent some kind of symmetric statements like @@ -725,15 +434,15 @@ is the quality of the predictions or assessments, and we are less concerned about the underlying patterns that were learned in order to make these predictions. -In machine learning we normally use \href{{https://en.wikipedia.org/wiki/Frequentist_inference}}{a so-called frequentist approach}, +In machine learning we normally use "a so-called frequentist approach":"https://en.wikipedia.org/wiki/Frequentist_inference", where the aim is to make predictions and find correlations. We focus less on for example extracting a probability distribution function (PDF). The PDF can be used in turn to make estimations and find causations such as given $A$ what is the likelihood of finding $B$. -\end{frame} -\begin{frame}[plain,fragile] -\frametitle{What is a good model?} + +!split +===== What is a good model? ===== In science and engineering we often end up in situations where we want to infer (or learn) a quantitative model $M$ for a given set of sample points $\bm{X} \in [x_1, x_2,\dots x_N]$. @@ -750,21 +459,22 @@ corelations that relate interesting physics interpretations. In addition, it can simplify the representation of the given data set and help us in making predictions about future data samples. -A first important consideration to keep in mind is that inferring the \emph{correct} model +A first important consideration to keep in mind is that inferring the *correct* model for a given data set is an elusive, if not impossible, task. The fundamental difficulty -is that if we are not specific about what we mean by a \emph{correct} model, there -could easily be many different models that fit the given data set \emph{equally well}. -\end{frame} +is that if we are not specific about what we mean by a *correct* model, there +could easily be many different models that fit the given data set *equally well*. + + +!split +===== What is a good model? Can we define it? ===== -\begin{frame}[plain,fragile] -\frametitle{What is a good model? Can we define it?} The central question is this: what leads us to say that a model is correct or optimal for a given data set? To make the model inference problem well posed, i.e., to guarantee that there is a unique optimal model for the given data, we need to impose additional assumptions or restrictions on the class of models considered. To this end, we should not be looking for just any model that can describe the data. -Instead, we should look for a \textbf{model} $M$ that is the best among a restricted class +Instead, we should look for a _model_ $M$ that is the best among a restricted class of models. In addition, to make the model inference problem computationally tractable, we need to specify how restricted the class of models needs to be. A common strategy is to start @@ -779,137 +489,113 @@ simpler models become inadequate. For instance, if we work with a regression pro may first try the simplest class of models, namely linear models, followed obviously by more complex models. How to evaluate which model fits best the data is something we will come back to over and over again in these sets of lectures. -\end{frame} -\begin{frame}[plain,fragile] -\frametitle{Software and needed installations} + + + + + + + +!split +===== Software and needed installations ===== We will make extensive use of Python as programming language and its myriad of available libraries. You will find -Jupyter notebooks invaluable in your work. You can run \textbf{R} +Jupyter notebooks invaluable in your work. You can run _R_ codes in the Jupyter/IPython notebooks, with the immediate benefit of visualizing your data. You can also use compiled languages like C++, Rust, Julia, Fortran etc if you prefer. The focus in these lectures will be on Python. + If you have Python installed (we strongly recommend Python3) and you feel pretty familiar with installing different packages, we recommend that -you install the following Python packages via \textbf{pip} as +you install the following Python packages via _pip_ as -\begin{enumerate} -\item pip install numpy scipy matplotlib ipython scikit-learn mglearn sympy pandas pillow -\end{enumerate} +o pip install numpy scipy matplotlib ipython scikit-learn mglearn sympy pandas pillow -\noindent -For Python3, replace \textbf{pip} with \textbf{pip3}. +For Python3, replace _pip_ with _pip3_. For OSX users we recommend, after having installed Xcode, to -install \textbf{brew}. Brew allows for a seamless installation of additional +install _brew_. Brew allows for a seamless installation of additional software via for example -\begin{enumerate} -\item brew install python3 -\end{enumerate} +o brew install python3 -\noindent For Linux users, with its variety of distributions like for example the widely popular Ubuntu distribution, -you can use \textbf{pip} as well and simply install Python as +you can use _pip_ as well and simply install Python as -\begin{enumerate} -\item sudo apt-get install python3 (or python for pyhton2.7) -\end{enumerate} +o sudo apt-get install python3 (or python for pyhton2.7) -\noindent -etc etc. -\end{frame} +etc etc. -\begin{frame}[plain,fragile] -\frametitle{Python installers} + +!split +===== Python installers ===== If you don't want to perform these operations separately and venture into the hassle of exploring how to set up dependencies and paths, we recommend two widely used distrubutions which set up all relevant dependencies for Python, namely -\begin{itemize} -\item \href{{https://docs.anaconda.com/}}{Anaconda}, -\end{itemize} +* "Anaconda":"https://docs.anaconda.com/", -\noindent which is an open source distribution of the Python and R programming languages for large-scale data processing, predictive analytics, and scientific computing, that aims to simplify package management and deployment. Package versions -are managed by the package management system \textbf{conda}. +are managed by the package management system _conda_. -\begin{itemize} -\item \href{{https://www.enthought.com/product/canopy/}}{Enthought canopy} -\end{itemize} +* "Enthought canopy":"https://www.enthought.com/product/canopy/" -\noindent is a Python distribution for scientific and analytic computing distribution and analysis environment, available for free and under a commercial license. -Furthermore, \href{{https://colab.research.google.com/notebooks/welcome.ipynb}}{Google's Colab} is a free Jupyter notebook environment that requires +Furthermore, "Google's Colab":"https://colab.research.google.com/notebooks/welcome.ipynb" is a free Jupyter notebook environment that requires no setup and runs entirely in the cloud. Try it out! -\end{frame} - -\begin{frame}[plain,fragile] -\frametitle{Useful Python libraries} +!split +===== Useful Python libraries ===== Here we list several useful Python libraries we strongly recommend (if you use anaconda many of these are already there) -\begin{itemize} -\item \href{{https://www.numpy.org/}}{NumPy} is a highly popular library for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays +* "NumPy":"https://www.numpy.org/" is a highly popular library for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays +* "The pandas":"https://pandas.pydata.org/" library provides high-performance, easy-to-use data structures and data analysis tools +* "Xarray":"http://xarray.pydata.org/en/stable/" is a Python package that makes working with labelled multi-dimensional arrays simple, efficient, and fun! +* "Scipy":"https://www.scipy.org/" (pronounced “Sigh Pie”) is a Python-based ecosystem of open-source software for mathematics, science, and engineering. +* "Matplotlib":"https://matplotlib.org/" is a Python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. +* "Autograd":"https://github.com/HIPS/autograd" can automatically differentiate native Python and Numpy code. It can handle a large subset of Python's features, including loops, ifs, recursion and closures, and it can even take derivatives of derivatives of derivatives +* "JAX":"https://jax.readthedocs.io/en/latest/index.html" has now more or less replaced _Autograd_. JAX is Autograd and XLA, brought together for high-performance numerical computing and machine learning research. It provides composable transformations of Python+NumPy programs: differentiate, vectorize, parallelize, Just-In-Time compile to GPU/TPU, and more. +* "SymPy":"https://www.sympy.org/en/index.html" is a Python library for symbolic mathematics. +* "scikit-learn":"https://scikit-learn.org/stable/" has simple and efficient tools for machine learning, data mining and data analysis +* "TensorFlow":"https://www.tensorflow.org/" is a Python library for fast numerical computing created and released by Google +* "Keras":"https://keras.io/" is a high-level neural networks API, written in Python and capable of running on top of TensorFlow, CNTK, or Theano +* And many more such as "pytorch":"https://pytorch.org/", "Theano":"https://pypi.org/project/Theano/" etc -\item \href{{https://pandas.pydata.org/}}{The pandas} library provides high-performance, easy-to-use data structures and data analysis tools +!split +===== Installing R, C++, cython or Julia ===== -\item \href{{http://xarray.pydata.org/en/stable/}}{Xarray} is a Python package that makes working with labelled multi-dimensional arrays simple, efficient, and fun! - -\item \href{{https://www.scipy.org/}}{Scipy} (pronounced “Sigh Pie”) is a Python-based ecosystem of open-source software for mathematics, science, and engineering. - -\item \href{{https://matplotlib.org/}}{Matplotlib} is a Python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms. - -\item \href{{https://github.com/HIPS/autograd}}{Autograd} can automatically differentiate native Python and Numpy code. It can handle a large subset of Python's features, including loops, ifs, recursion and closures, and it can even take derivatives of derivatives of derivatives - -\item \href{{https://jax.readthedocs.io/en/latest/index.html}}{JAX} has now more or less replaced \textbf{Autograd}. JAX is Autograd and XLA, brought together for high-performance numerical computing and machine learning research. It provides composable transformations of Python+NumPy programs: differentiate, vectorize, parallelize, Just-In-Time compile to GPU/TPU, and more. - -\item \href{{https://www.sympy.org/en/index.html}}{SymPy} is a Python library for symbolic mathematics. - -\item \href{{https://scikit-learn.org/stable/}}{scikit-learn} has simple and efficient tools for machine learning, data mining and data analysis - -\item \href{{https://www.tensorflow.org/}}{TensorFlow} is a Python library for fast numerical computing created and released by Google - -\item \href{{https://keras.io/}}{Keras} is a high-level neural networks API, written in Python and capable of running on top of TensorFlow, CNTK, or Theano - -\item And many more such as \href{{https://pytorch.org/}}{pytorch}, \href{{https://pypi.org/project/Theano/}}{Theano} etc -\end{itemize} - -\noindent -\end{frame} - -\begin{frame}[plain,fragile] -\frametitle{Installing R, C++, cython or Julia} - -You will also find it convenient to utilize \textbf{R}. We will mainly +You will also find it convenient to utilize _R_. We will mainly use Python during our lectures and in various projects and exercises. Those of you -already familiar with \textbf{R} should feel free to continue using \textbf{R}, keeping +already familiar with _R_ should feel free to continue using _R_, keeping however an eye on the parallel Python set ups. Similarly, if you are a -Python afecionado, feel free to explore \textbf{R} as well. Jupyter/Ipython -notebook allows you to run \textbf{R} codes interactively in your -browser. The software library \textbf{R} is really tailored for statistical data analysis +Python afecionado, feel free to explore _R_ as well. Jupyter/Ipython +notebook allows you to run _R_ codes interactively in your +browser. The software library _R_ is really tailored for statistical data analysis and allows for an easy usage of the tools and algorithms we will discuss in these lectures. -To install \textbf{R} with Jupyter notebook -\href{{https://mpacer.org/maths/r-kernel-for-ipython-notebook}}{follow the link here} -\end{frame} +To install _R_ with Jupyter notebook +"follow the link here":"https://mpacer.org/maths/r-kernel-for-ipython-notebook" + + + +!split +===== Installing R, C++, cython, Numba etc ===== -\begin{frame}[plain,fragile] -\frametitle{Installing R, C++, cython, Numba etc} For the C++ aficionados, Jupyter/IPython notebook allows you also to install C++ and run codes written in this language interactively in @@ -917,55 +603,45 @@ the browser. Since we will emphasize writing many of the algorithms yourself, you can thus opt for either Python or C++ (or Fortran or other compiled languages) as programming languages. -To add more entropy, \textbf{cython} can also be used when running your +To add more entropy, _cython_ can also be used when running your notebooks. It means that Python with the jupyter notebook setup allows you to integrate widely popular softwares and tools for scientific computing. Similarly, the -\href{{https://numba.pydata.org/}}{Numba Python package} delivers increased performance +"Numba Python package":"https://numba.pydata.org/" delivers increased performance capabilities with minimal rewrites of your codes. With its versatility, including symbolic operations, Python offers a unique computational environment. Your jupyter notebook can easily be -converted into a nicely rendered \textbf{PDF} file or a Latex file for +converted into a nicely rendered _PDF_ file or a Latex file for further processing. For example, convert to latex as - - -\begin{minted}[fontsize=\fontsize{9pt}{9pt},linenos=false,mathescape,baselinestretch=1.0,fontfamily=tt,xleftmargin=2mm]{text} +!bc pycod jupyter nbconvert filename.ipynb --to latex +!ec -\end{minted} - - -And to add more versatility, the Python package \href{{http://www.sympy.org/en/index.html}}{SymPy} is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) and is entirely written in Python. +And to add more versatility, the Python package "SymPy":"http://www.sympy.org/en/index.html" is a Python library for symbolic mathematics. It aims to become a full-featured computer algebra system (CAS) and is entirely written in Python. Finally, if you wish to use the light mark-up language -\href{{https://github.com/hplgit/doconce}}{doconce} you can convert a standard ascii text file into various HTML -formats, ipython notebooks, latex files, pdf files etc with minimal edits. These lectures were generated using \textbf{doconce}. -\end{frame} +"doconce":"https://github.com/hplgit/doconce" you can convert a standard ascii text file into various HTML +formats, ipython notebooks, latex files, pdf files etc with minimal edits. These lectures were generated using _doconce_. -\begin{frame}[plain,fragile] -\frametitle{Numpy examples and Important Matrix and vector handling packages} + +!split +===== Numpy examples and Important Matrix and vector handling packages ===== There are several central software libraries for linear algebra and eigenvalue problems. Several of the more -popular ones have been wrapped into ofter software packages like those from the widely used text \textbf{Numerical Recipes}. The original source codes in many of the available packages are often taken from the widely used +popular ones have been wrapped into ofter software packages like those from the widely used text _Numerical Recipes_. The original source codes in many of the available packages are often taken from the widely used software package LAPACK, which follows two other popular packages developed in the 1970s, namely EISPACK and LINPACK. We describe them shortly here. -\begin{itemize} - \item LINPACK: package for linear equations and least square problems. + * LINPACK: package for linear equations and least square problems. + * LAPACK:package for solving symmetric, unsymmetric and generalized eigenvalue problems. From LAPACK's website URL: "http://www.netlib.org" it is possible to download for free all source codes from this library. Both C/C++ and Fortran versions are available. + * BLAS (I, II and III): (Basic Linear Algebra Subprograms) are routines that provide standard building blocks for performing basic vector and matrix operations. Blas I is vector operations, II vector-matrix operations and III matrix-matrix operations. Highly parallelized and efficient codes, all available for download from URL: "http://www.netlib.org". - \item LAPACK:package for solving symmetric, unsymmetric and generalized eigenvalue problems. From LAPACK's website \href{{http://www.netlib.org}}{\nolinkurl{http://www.netlib.org}} it is possible to download for free all source codes from this library. Both C/C++ and Fortran versions are available. +!split +===== Basic Matrix Features ===== - \item BLAS (I, II and III): (Basic Linear Algebra Subprograms) are routines that provide standard building blocks for performing basic vector and matrix operations. Blas I is vector operations, II vector-matrix operations and III matrix-matrix operations. Highly parallelized and efficient codes, all available for download from \href{{http://www.netlib.org}}{\nolinkurl{http://www.netlib.org}}. -\end{itemize} - -\noindent -\end{frame} - -\begin{frame}[plain,fragile] -\frametitle{Basic Matrix Features} - -\begin{block}{Matrix properties reminder } +!bblock Matrix properties reminder +!bt \[ \mathbf{A} = \begin{bmatrix} a_{11} & a_{12} & a_{13} & a_{14} \\ @@ -980,338 +656,209 @@ developed in the 1970s, namely EISPACK and LINPACK. We describe them shortly he 0 & 0 & 0 & 1 \end{bmatrix} \] +!et + + The inverse of a matrix is defined by +!bt \[ \mathbf{A}^{-1} \cdot \mathbf{A} = I \] +!et -{\footnotesize -\begin{tabular}{ccc} -\hline -\multicolumn{1}{c}{ Relations } & \multicolumn{1}{c}{ Name } & \multicolumn{1}{c}{ matrix elements } \\ -\hline -$A=A^{T}$ & symmetric & $a_{ij}=a_{ji}$ \\ -$A=\left (A^{T}\right )^{-1}$ & real orthogonal & $\sum_k a_{ik}a_{jk}=\sum_k a_{ki} a_{kj}=\delta_{ij}$ \\ -$A=A^*$ & real matrix & $a_{ij}=a_{ij}^*$ \\ -$A=A^{\dagger}$ & hermitian & $a_{ij}=a_{ji}^*$ \\ -$A=\left(A^{\dagger}\right )^{-1}$ & unitary & $\sum_k a_{ik}a_{jk}^*=\sum_k a_{ki}^* a_{kj}=\delta_{ij}$ \\ -\hline -\end{tabular} -} +|----------------------------------------------------------------------| +| Relations | Name | matrix elements | +|----------------------------------------------------------------------| +| $A=A^{T}$ | symmetric | $a_{ij}=a_{ji}$ | +| $A=\left (A^{T}\right )^{-1}$ | real orthogonal | $\sum_k a_{ik}a_{jk}=\sum_k a_{ki} a_{kj}=\delta_{ij}$ | +| $A=A^*$ | real matrix | $a_{ij}=a_{ij}^*$ | +| $A=A^{\dagger}$ | hermitian | $a_{ij}=a_{ji}^*$ | +| $A=\left(A^{\dagger}\right )^{-1}$ | unitary | $\sum_k a_{ik}a_{jk}^*=\sum_k a_{ki}^* a_{kj}=\delta_{ij}$ | +|----------------------------------------------------------------------| -\noindent -\end{block} -\end{frame} +!eblock -\begin{frame}[plain,fragile] -% No title on this slide +!split +=== Some famous Matrices === -\noindent\textbf{Some famous Matrices.} -\begin{itemize} - \item Diagonal if $a_{ij}=0$ for $i\ne j$ + * Diagonal if $a_{ij}=0$ for $i\ne j$ + * Upper triangular if $a_{ij}=0$ for $i>j$ + * Lower triangular if $a_{ij}=0$ for $ij+1$ + * Lower Hessenberg if $a_{ij}=0$ for $i1$ + * Lower banded with bandwidth $p$: $a_{ij}=0$ for $i>j+p$ + * Upper banded with bandwidth $p$: $a_{ij}=0$ for $ij$ - \item Lower triangular if $a_{ij}=0$ for $ij+1$ - - \item Lower Hessenberg if $a_{ij}=0$ for $i1$ - - \item Lower banded with bandwidth $p$: $a_{ij}=0$ for $i>j+p$ - - \item Upper banded with bandwidth $p$: $a_{ij}=0$ for $i