day1/session3.tex
author Madhusudan.C.S <madhusudancs@gmail.com>
Tue, 27 Oct 2009 19:34:26 +0530
changeset 208 c663c8daa109
parent 205 bba40c856f68
child 212 298cd56f4d5a
permissions -rw-r--r--
Reorganized slides of session 3 day 1.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
115
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
142
57e0f0fd3317 Made usage of FOSSEE consistent, in comments also.
Puneeth Chaganti <punchagan@fossee.in>
parents: 137
diff changeset
     2
%Tutorial slides on Python.
115
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     3
%
142
57e0f0fd3317 Made usage of FOSSEE consistent, in comments also.
Puneeth Chaganti <punchagan@fossee.in>
parents: 137
diff changeset
     4
% Author: FOSSEE
57e0f0fd3317 Made usage of FOSSEE consistent, in comments also.
Puneeth Chaganti <punchagan@fossee.in>
parents: 137
diff changeset
     5
% Copyright (c) 2009, FOSSEE, IIT Bombay
115
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     6
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     7
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     8
\documentclass[14pt,compress]{beamer}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     9
%\documentclass[draft]{beamer}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    10
%\documentclass[compress,handout]{beamer}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    11
%\usepackage{pgfpages} 
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    12
%\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    13
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    14
% Modified from: generic-ornate-15min-45min.de.tex
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    15
\mode<presentation>
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    16
{
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    17
  \usetheme{Warsaw}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    18
  \useoutertheme{split}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    19
  \setbeamercovered{transparent}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    20
}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    21
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    22
\usepackage[english]{babel}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    23
\usepackage[latin1]{inputenc}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    24
%\usepackage{times}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    25
\usepackage[T1]{fontenc}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    26
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    27
% Taken from Fernando's slides.
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    28
\usepackage{ae,aecompl}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    29
\usepackage{mathpazo,courier,euler}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    30
\usepackage[scaled=.95]{helvet}
116
cb91f43d2cbb Added Least Square Fitting to Session3.
Puneeth Chaganti <punchagan@fossee.in>
parents: 115
diff changeset
    31
\usepackage{amsmath}
115
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    32
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    33
\definecolor{darkgreen}{rgb}{0,0.5,0}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    34
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    35
\usepackage{listings}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    36
\lstset{language=Python,
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    37
    basicstyle=\ttfamily\bfseries,
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    38
    commentstyle=\color{red}\itshape,
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    39
  stringstyle=\color{darkgreen},
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    40
  showstringspaces=false,
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    41
  keywordstyle=\color{blue}\bfseries}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    42
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    43
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    44
% Macros
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    45
\setbeamercolor{emphbar}{bg=blue!20, fg=black}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    46
\newcommand{\emphbar}[1]
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    47
{\begin{beamercolorbox}[rounded=true]{emphbar} 
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    48
      {#1}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    49
 \end{beamercolorbox}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    50
}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    51
\newcounter{time}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    52
\setcounter{time}{0}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    53
\newcommand{\inctime}[1]{\addtocounter{time}{#1}{\tiny \thetime\ m}}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    54
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    55
\newcommand{\typ}[1]{\lstinline{#1}}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    56
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    57
\newcommand{\kwrd}[1]{ \texttt{\textbf{\color{blue}{#1}}}  }
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    58
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    59
%%% This is from Fernando's setup.
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    60
% \usepackage{color}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    61
% \definecolor{orange}{cmyk}{0,0.4,0.8,0.2}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    62
% % Use and configure listings package for nicely formatted code
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    63
% \usepackage{listings}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    64
% \lstset{
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    65
%    language=Python,
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    66
%    basicstyle=\small\ttfamily,
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    67
%    commentstyle=\ttfamily\color{blue},
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    68
%    stringstyle=\ttfamily\color{orange},
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    69
%    showstringspaces=false,
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    70
%    breaklines=true,
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    71
%    postbreak = \space\dots
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    72
% }
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    73
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    74
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    75
% Title page
192
1574b3bc6be7 Changed the focus of the statistics
rivermaker@RivermakerMBP.local
parents: 185
diff changeset
    76
\title[Statistics]{Python for Science and Engg. Statistics}
115
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    77
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    78
\author[FOSSEE] {FOSSEE}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    79
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    80
\institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay}
131
b3a78754c4a9 Minor edits to day1 session4.
Puneeth Chaganti <punchagan@fossee.in>
parents: 125
diff changeset
    81
\date[] {31, October 2009\\Day 1, Session 3}
115
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    82
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    83
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    84
%\pgfdeclareimage[height=0.75cm]{iitmlogo}{iitmlogo}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    85
%\logo{\pgfuseimage{iitmlogo}}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    86
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    87
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    88
%% Delete this, if you do not want the table of contents to pop up at
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    89
%% the beginning of each subsection:
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    90
\AtBeginSubsection[]
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    91
{
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    92
  \begin{frame}<beamer>
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    93
    \frametitle{Outline}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    94
    \tableofcontents[currentsection,currentsubsection]
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    95
  \end{frame}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    96
}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    97
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    98
\AtBeginSection[]
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    99
{
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   100
  \begin{frame}<beamer>
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   101
    \frametitle{Outline}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   102
    \tableofcontents[currentsection,currentsubsection]
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   103
  \end{frame}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   104
}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   105
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   106
\newcommand{\num}{\texttt{numpy}}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   107
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   108
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   109
% If you wish to uncover everything in a step-wise fashion, uncomment
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   110
% the following command: 
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   111
%\beamerdefaultoverlayspecification{<+->}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   112
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   113
%\includeonlyframes{current,current1,current2,current3,current4,current5,current6}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   114
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   115
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   116
% DOCUMENT STARTS
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   117
\begin{document}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   118
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   119
\begin{frame}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   120
  \maketitle
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   121
\end{frame}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   122
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   123
%% \begin{frame}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   124
%%   \frametitle{Outline}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   125
%%   \tableofcontents
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   126
%%   % You might wish to add the option [pausesections]
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   127
%% \end{frame}
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   128
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   129
\begin{frame}
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   130
  \frametitle{More on data processing}
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   131
  \begin{block}{}
192
1574b3bc6be7 Changed the focus of the statistics
rivermaker@RivermakerMBP.local
parents: 185
diff changeset
   132
    We have a huge--1m records--data file.\\How do we do \emph{efficient} statistical computations, that is find mean, median, mode, standard deveiation etc; draw pie charts?
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   133
  \end{block}
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   134
\end{frame}
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   135
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   136
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   137
\begin{frame}
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   138
  \frametitle{Statistical Analysis and Parsing}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   139
  Read the data supplied in \emph{sslc1.txt} and obtain the following statistics:
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   140
  \begin{itemize}
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   141
    \item Draw a pie chart representing the number of students who scored more than 90\% in Science per region.
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   142
    \item Draw a pie chart representing the number of students who scored more than 90\% per subject(All regions combined).
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   143
    \item Print mean, median, mode and standard deviation of math scores for all regions combined.
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   144
  \end{itemize}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   145
\end{frame}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   146
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   147
\begin{frame}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   148
  \frametitle{Statistical Analysis and Parsing \ldots}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   149
  Machinery Required -
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   150
  \begin{itemize}
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   151
    \item File reading
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   152
    \item Parsing
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   153
    \item Dictionaries
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   154
    \item NumPy arrays
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   155
    \item Statistical operations
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   156
  \end{itemize}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   157
\end{frame}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   158
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   159
\begin{frame}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   160
  \frametitle{File reading and parsing}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   161
  Understanding the structure of sslc1.txt
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   162
  \begin{itemize}
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   163
    \item Each line in the file corresponds to one student's details
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   164
    \item aka record
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   165
    \item Each record consists of several fields separated by a ';'
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   166
  \end{itemize}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   167
\end{frame}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   168
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   169
\begin{frame}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   170
  \frametitle{File reading and parsing \ldots}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   171
  Each record consists of:
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   172
  \begin{itemize}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   173
    \item Region Code
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   174
    \item Roll Number
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   175
    \item Name
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   176
    \item Marks of 5 subjects: English, Hindi, Maths, Science, Social
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   177
    \item Total marks
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   178
    \item Pass/Fail (P/F)
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   179
    \item Withdrawn (W)
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   180
  \end{itemize}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   181
\end{frame}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   182
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   183
\begin{frame}[fragile]
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   184
  \frametitle{File reading and parsing \ldots}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   185
  \begin{lstlisting}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   186
for record in open('sslc1.txt'):
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   187
    fields = record.split(';')
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   188
  \end{lstlisting}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   189
\end{frame}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   190
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   191
\begin{frame}[fragile]
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   192
  \frametitle{Dictionary: Introduction}
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   193
  \begin{itemize}
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   194
    \item lists index: 0 \ldots n
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   195
    \item dictionaries index using strings
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   196
  \end{itemize}
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   197
\begin{block}{Example}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   198
d = \{ ``Hitchhiker's guide'' : 42,
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   199
     ``Terminator'' : ``I'll be back''\}\\
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   200
d[``Terminator''] => ``I'll be back''
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   201
\end{block}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   202
\end{frame}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   203
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   204
\begin{frame}[fragile]
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   205
  \frametitle{Dictionary: Introduction}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   206
\begin{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   207
In [1]: d = {"Hitchhiker's guide" : 42,
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   208
      "Terminator" : "I'll be back"}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   209
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   210
In [2]: d["Hitchhiker's guide"]
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   211
Out[2]: 42
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   212
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   213
In [3]: "Hitchhiker's guide" in d
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   214
Out[3]: True
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   215
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   216
In [4]: "Guido" in d
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   217
Out[4]: False
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   218
\end{lstlisting}
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   219
\end{frame}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   220
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   221
\begin{frame}[fragile]
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   222
  \frametitle{Dictionary: Introduction}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   223
\begin{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   224
In [5]: d.keys()
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   225
Out[5]: ['Terminator', "Hitchhiker's 
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   226
                              guide"]
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   227
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   228
In [6]: d.values()
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   229
Out[6]: ["I'll be back", 42]
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   230
\end{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   231
\end{frame}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   232
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   233
\begin{frame}[fragile]
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   234
  \frametitle{enumerate: Iterating through list indices}
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   235
\begin{lstlisting}
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   236
In [1]: names = ["Guido","Alex", "Tim"]
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   237
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   238
In [2]: for i, name in enumerate(names):
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   239
   ...:     print i, name
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   240
   ...: 
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   241
0 Guido
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   242
1 Alex
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   243
2 Tim
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   244
\end{lstlisting}
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   245
\end{frame}
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   246
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   247
\begin{frame}[fragile]
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   248
  \frametitle{Dictionary: Building parsed data}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   249
    Let our dictionary be:
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   250
    \begin{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   251
science = {} # is an empty dictionary
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   252
    \end{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   253
\end{frame}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   254
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   255
\begin{frame}[fragile]
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   256
  \frametitle{Dictionary - Building parsed data}
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   257
  \begin{itemize}
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   258
    \item \emph{Keys} of \emph{science} will be region codes
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   259
    \item Value of a \emph{science} will be the number students who scored more than 90\% in that region
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   260
  \end{itemize}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   261
\end{frame}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   262
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   263
\begin{frame}[fragile]
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   264
  \frametitle{Building parsed data \ldots}
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   265
  \begin{lstlisting}
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   266
from pylab import pie
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   267
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   268
science = {}
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   269
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   270
for record in open('sslc1.txt'):
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   271
    record = record.strip()
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   272
    fields = record.split(';')
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   273
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   274
    region_code = fields[0].strip()
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   275
  \end{lstlisting}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   276
\end{frame}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   277
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   278
\begin{frame}[fragile]
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   279
  \frametitle{Building parsed data \ldots}
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   280
  \begin{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   281
if region_code not in science:
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   282
    science[region_code] = 0
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   283
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   284
score_str = fields[4].strip()
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   285
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   286
score = int(score_str) if
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   287
    score_str != 'AA' else 0
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   288
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   289
if score > 90:
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   290
    science[region_code] += 1
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   291
  \end{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   292
\end{frame}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   293
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   294
\begin{frame}[fragile]
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   295
  \frametitle{Pie charts}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   296
  \small
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   297
  \begin{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   298
figure(1)
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   299
pie(science.values(), 
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   300
    labels=science.keys())
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   301
title('Students scoring 90% and above 
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   302
      in science by region')
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   303
savefig('/tmp/science.png')
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   304
  \end{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   305
\begin{columns}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   306
    \column{5.25\textwidth}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   307
    \hspace*{1.1in}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   308
\includegraphics[height=2in, interpolate=true]{data/science}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   309
    \column{0.8\textwidth}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   310
\end{columns}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   311
\end{frame}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   312
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   313
\begin{frame}[fragile]
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   314
  \frametitle{Building data for all subjects \ldots}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   315
  \begin{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   316
from pylab import pie
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   317
from scipy import mean, median, std
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   318
from scipy import stats
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   319
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   320
scores = [[]] * 5
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   321
ninety_percents = [{}] * 5
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   322
  \end{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   323
\end{frame}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   324
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   325
\begin{frame}[fragile]
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   326
  \frametitle{Building data for all subjects \ldots}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   327
  \begin{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   328
from pylab import pie
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   329
from scipy import mean, median, std
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   330
from scipy import stats
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   331
  \end{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   332
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   333
  \begin{block}{Repeating list items}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   334
    \begin{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   335
scores = [[]] * 5
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   336
ninety_percents = [{}] * 5
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   337
    \end{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   338
  \end{block}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   339
\end{frame}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   340
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   341
\begin{frame}[fragile]
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   342
  \frametitle{Building data for all subjects \ldots}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   343
  \begin{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   344
for record in open('sslc1.txt'):
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   345
    record = record.strip()
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   346
    fields = record.split(';')
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   347
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   348
    region_code = fields[0].strip()
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   349
  \end{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   350
\end{frame}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   351
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   352
\begin{frame}[fragile]
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   353
  \frametitle{Building data for all subjects \ldots}
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   354
  \small
125
99ca3cb18fd2 Session 3 Day 1, sslc data parsing obtaining statistics.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 120
diff changeset
   355
  \begin{lstlisting}
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   356
for i, field in enumerate(fields[3:8]):
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   357
    if region_code not in ninety_percents[i]:
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   358
        ninety_percents[i][region_code] = 0
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   359
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   360
    score_str = field.strip()
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   361
    score = int(score_str) if
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   362
      score_str != 'AA' else 0
125
99ca3cb18fd2 Session 3 Day 1, sslc data parsing obtaining statistics.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 120
diff changeset
   363
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   364
    scores[i].append(score)
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   365
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   366
    if score > 90:
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   367
        ninety_percents[i][region_code] += 1
125
99ca3cb18fd2 Session 3 Day 1, sslc data parsing obtaining statistics.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 120
diff changeset
   368
  \end{lstlisting}
99ca3cb18fd2 Session 3 Day 1, sslc data parsing obtaining statistics.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 120
diff changeset
   369
\end{frame}
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   370
125
99ca3cb18fd2 Session 3 Day 1, sslc data parsing obtaining statistics.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 120
diff changeset
   371
\begin{frame}[fragile]
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   372
  \frametitle{Consolidating data}
125
99ca3cb18fd2 Session 3 Day 1, sslc data parsing obtaining statistics.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 120
diff changeset
   373
  \begin{lstlisting}
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   374
subj_total = []
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   375
for subject in ninety_percents:
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   376
    subj_total.append(sum(
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   377
         subject.values()))
170
36ed5cdf5fde Reorganized the slides for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 167
diff changeset
   378
  \end{lstlisting}
36ed5cdf5fde Reorganized the slides for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 167
diff changeset
   379
\end{frame}
36ed5cdf5fde Reorganized the slides for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 167
diff changeset
   380
36ed5cdf5fde Reorganized the slides for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 167
diff changeset
   381
\begin{frame}[fragile]
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   382
  \frametitle{Pie charts}
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   383
  \begin{lstlisting}
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   384
figure(2)
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   385
pie(subj_total, labels=['English',
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   386
    'Hindi', 'Maths', 'Science',
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   387
    'Social'])
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   388
title('Students scoring more than
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   389
      90% by subject(All regions
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   390
      combined).')
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   391
savefig('/tmp/all_regions.png')
120
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   392
  \end{lstlisting}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   393
\end{frame}
055b199c46c2 Added NumPy array operations to session3 day1 for sslc1.txt.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 117
diff changeset
   394
166
ddfd95133adc Taken task based approach for Session 3, day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 161
diff changeset
   395
\begin{frame}[fragile]
184
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   396
  \frametitle{Pie charts}
9efa777af2e2 Reworked on Session 3 day 1 slides.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 178
diff changeset
   397
  \includegraphics[height=3in, interpolate=true]{data/all_regions}
166
ddfd95133adc Taken task based approach for Session 3, day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 161
diff changeset
   398
\end{frame}
ddfd95133adc Taken task based approach for Session 3, day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 161
diff changeset
   399
174
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   400
\begin{frame}[fragile]
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   401
  \frametitle{Obtaining statistics}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   402
  \begin{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   403
math_scores = array(scores[2])
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   404
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   405
print "Mean: ", mean(math_scores)
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   406
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   407
print "Median: ", median(math_scores)
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   408
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   409
print "Mode: ", stats.mode(math_scores)
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   410
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   411
print "Standard Deviation: ",
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   412
              std(math_scores)
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   413
  \end{lstlisting}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   414
\end{frame}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   415
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   416
\begin{frame}[fragile]
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   417
  \frametitle{What tools did we use?}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   418
  \begin{itemize}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   419
   \item Dictionaries for storing data
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   420
   \item Facilities for drawing pie charts
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   421
   \item NumPy arrays for efficient array manipulations
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   422
   \item Functions for statistical computations - mean, median, mode, standard deviation
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   423
  \end{itemize}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   424
\end{frame}
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   425
208
c663c8daa109 Reorganized slides of session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 205
diff changeset
   426
\begin{frame}
c663c8daa109 Reorganized slides of session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 205
diff changeset
   427
\frametitle{L vs $T^2$ \ldots}
c663c8daa109 Reorganized slides of session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 205
diff changeset
   428
Let's go back to the L vs $T^2$ plot
c663c8daa109 Reorganized slides of session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 205
diff changeset
   429
\begin{itemize}
c663c8daa109 Reorganized slides of session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 205
diff changeset
   430
\item We first look at obtaining $T^2$ from T
c663c8daa109 Reorganized slides of session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 205
diff changeset
   431
\item Then, we look at plotting a Least Squares fit
c663c8daa109 Reorganized slides of session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 205
diff changeset
   432
\end{itemize}
c663c8daa109 Reorganized slides of session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 205
diff changeset
   433
\end{frame}
c663c8daa109 Reorganized slides of session 3 day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 205
diff changeset
   434
204
87f914f38ba1 Session 3 day 1, Statistical operations finalized.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 192
diff changeset
   435
\begin{frame}[fragile]
178
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 174
diff changeset
   436
\frametitle{Dealing with data whole-sale}
174
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   437
\begin{lstlisting}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   438
In []: for t in T:
185
e59ab9ab1a89 Manual Merge with Mainline.
Puneeth Chaganti <punchagan@fossee.in>
parents: 184
diff changeset
   439
 ....:     TSq.append(t*t)
174
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   440
\end{lstlisting}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   441
\begin{itemize}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   442
\item This is not very efficient
178
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 174
diff changeset
   443
\item We are squaring element after element
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 174
diff changeset
   444
\item We use arrays to make this efficient
174
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   445
\end{itemize}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   446
\begin{lstlisting}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   447
In []: L = array(L)
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   448
In []: T = array(T)
185
e59ab9ab1a89 Manual Merge with Mainline.
Puneeth Chaganti <punchagan@fossee.in>
parents: 184
diff changeset
   449
In []: TSq = T*T
174
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   450
\end{lstlisting}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   451
\end{frame}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   452
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   453
\begin{frame}[fragile]
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   454
\frametitle{Arrays}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   455
\begin{itemize}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   456
\item \typ{T} and \typ{L} are now arrays
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   457
\item arrays are very efficient and powerful 
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   458
\item Very easy to perform element-wise operations
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   459
\item \typ{+, -, *, /, \%}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   460
\item More about arrays later
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   461
\end{itemize}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   462
\end{frame}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   463
178
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 174
diff changeset
   464
\begin{frame}[fragile]
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 174
diff changeset
   465
\frametitle{Least Squares Fit}
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 174
diff changeset
   466
\vspace{-0.15in}
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 174
diff changeset
   467
\begin{figure}
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 174
diff changeset
   468
\includegraphics[width=4in]{data/L-Tsq-Line.png}
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 174
diff changeset
   469
\end{figure}
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 174
diff changeset
   470
\end{frame}
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 174
diff changeset
   471
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 174
diff changeset
   472
\begin{frame}[fragile]
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 174
diff changeset
   473
\frametitle{Least Squares Fit}
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 174
diff changeset
   474
\vspace{-0.15in}
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 174
diff changeset
   475
\begin{figure}
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 174
diff changeset
   476
\includegraphics[width=4in]{data/least-sq-fit.png}
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 174
diff changeset
   477
\end{figure}
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 174
diff changeset
   478
\end{frame}
8a3a9d98fa84 Changed functions section and some minor edits.
Puneeth Chaganti <punchagan@fossee.in>
parents: 174
diff changeset
   479
174
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   480
\begin{frame}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   481
\frametitle{Least Square Fit Curve}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   482
\begin{itemize}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   483
\item $T^2$ and $L$ have a linear relationship
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   484
\item Hence, Least Square Fit Curve is a line
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   485
\item we shall use the \typ{lstsq} function
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   486
\end{itemize}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   487
\end{frame}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   488
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   489
\begin{frame}[fragile]
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   490
\frametitle{\typ{lstsq}}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   491
\begin{itemize}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   492
\item We need to fit a line through points for the equation $T^2 = m \cdot L+c$
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   493
\item The equation can be re-written as $T^2 = A \cdot p$
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   494
\item where A is   
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   495
  $\begin{bmatrix}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   496
  L_1 & 1 \\
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   497
  L_2 & 1 \\
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   498
  \vdots & \vdots\\
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   499
  L_N & 1 \\
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   500
  \end{bmatrix}$
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   501
  and p is 
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   502
  $\begin{bmatrix}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   503
  m\\
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   504
  c\\
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   505
  \end{bmatrix}$
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   506
\item We need to find $p$ to plot the line
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   507
\end{itemize}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   508
\end{frame}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   509
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   510
\begin{frame}[fragile]
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   511
\frametitle{Van der Monde Matrix}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   512
\begin{itemize}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   513
\item A is also called a Van der Monde matrix
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   514
\item It can be generated using \typ{vander}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   515
\end{itemize}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   516
Van der Monde matrix of order M
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   517
\begin{equation*}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   518
  \begin{bmatrix}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   519
  l_1^{M-1} & \ldots & l_1 & 1 \\
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   520
  l_2^{M-1} & \ldots &l_2 & 1 \\
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   521
  \vdots & \ldots & \vdots & \vdots\\
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   522
  l_N^{M-1} & \ldots & l_N & 1 \\
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   523
  \end{bmatrix}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   524
\end{equation*}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   525
\begin{lstlisting}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   526
In []: A = vander(L,2)
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   527
\end{lstlisting}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   528
\end{frame}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   529
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   530
\begin{frame}[fragile]
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   531
\frametitle{\typ{lstsq} \ldots}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   532
\begin{itemize}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   533
\item Now use the \typ{lstsq} function
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   534
\item Along with a lot of things, it returns the least squares solution
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   535
\end{itemize}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   536
\begin{lstlisting}
185
e59ab9ab1a89 Manual Merge with Mainline.
Puneeth Chaganti <punchagan@fossee.in>
parents: 184
diff changeset
   537
In []: coef, res, r, s = lstsq(A,TSq)
174
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   538
\end{lstlisting}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   539
\end{frame}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   540
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   541
\begin{frame}[fragile]
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   542
\frametitle{Least Square Fit Line \ldots}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   543
We get the points of the line from \typ{coef}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   544
\begin{lstlisting}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   545
In []: Tline = coef[0]*L + coef[1]
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   546
\end{lstlisting}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   547
\begin{itemize}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   548
\item Now plot Tline vs. L, to get the Least squares fit line. 
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   549
\end{itemize}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   550
\begin{lstlisting}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   551
In []: plot(L, Tline)
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   552
\end{lstlisting}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   553
\end{frame}
a43832c1edc2 Reordered Session 3 Day 1.
Madhusudan.C.S <madhusudancs@gmail.com>
parents: 170
diff changeset
   554
115
66709e58f765 Added session3.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   555
\end{document}