Update on machine learning

This commit is contained in:
mhjensen
2017-11-27 22:22:51 +00:00
parent e1cf880961
commit 2d8aefeb59
13 changed files with 1035 additions and 78 deletions
@@ -6,9 +6,9 @@ Automatically generated HTML file from DocOnce source
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
<meta name="description" content="Data Analysis and Machine Learning: Representing data">
<meta name="description" content="Data Analysis and Machine Learning: Introduction and Representing data">
<title>Data Analysis and Machine Learning: Representing data</title>
<title>Data Analysis and Machine Learning: Introduction and Representing data</title>
<!-- Bootstrap style: bootstrap -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
@@ -40,8 +40,18 @@ Automatically generated HTML file from DocOnce source
<!-- tocinfo
{'highest level': 2,
'sections': [('Representing data, overarching aims', 2, None, '___sec0'),
('Representing data, overarching aims', 2, None, '___sec1')]}
'sections': [('What is Machine Learning?', 2, None, '___sec0'),
('Types of Machine Learning', 2, None, '___sec1'),
('Different algorithms', 2, None, '___sec2'),
('Software and needed installations', 2, None, '___sec3'),
('Python installers', 2, None, '___sec4'),
('Installing R and C++', 2, None, '___sec5'),
('Introduction to Jupyter notebook and available tools',
2,
None,
'___sec6'),
('Representing data, overarching aims', 2, None, '___sec7'),
('Representing data, more examples', 2, None, '___sec8')]}
end of tocinfo -->
<body>
@@ -55,7 +65,7 @@ end of tocinfo -->
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="How2ReadData-bs.html">Data Analysis and Machine Learning: Representing data</a>
<a class="navbar-brand" href="How2ReadData-bs.html">Data Analysis and Machine Learning: Introduction and Representing data</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
@@ -63,8 +73,15 @@ end of tocinfo -->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._How2ReadData-bs001.html#___sec0" style="font-size: 80%;">Representing data, overarching aims</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs002.html#___sec1" style="font-size: 80%;">Representing data, overarching aims</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs001.html#___sec0" style="font-size: 80%;">What is Machine Learning?</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs002.html#___sec1" style="font-size: 80%;">Types of Machine Learning</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs003.html#___sec2" style="font-size: 80%;">Different algorithms</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs004.html#___sec3" style="font-size: 80%;">Software and needed installations</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs005.html#___sec4" style="font-size: 80%;">Python installers</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs006.html#___sec5" style="font-size: 80%;">Installing R and C++</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs007.html#___sec6" style="font-size: 80%;">Introduction to Jupyter notebook and available tools</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs008.html#___sec7" style="font-size: 80%;">Representing data, overarching aims</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs009.html#___sec8" style="font-size: 80%;">Representing data, more examples</a></li>
</ul>
</li>
@@ -83,7 +100,7 @@ end of tocinfo -->
<div class="jumbotron">
<center><h1>Data Analysis and Machine Learning: Representing data</h1></center> <!-- document title -->
<center><h1>Data Analysis and Machine Learning: Introduction and Representing data</h1></center> <!-- document title -->
<p>
<!-- author(s): Morten Hjorth-Jensen -->
@@ -99,7 +116,7 @@ end of tocinfo -->
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
<br>
<p>
<center><h4>Nov 26, 2017</h4></center> <!-- date -->
<center><h4>Nov 27, 2017</h4></center> <!-- date -->
<br>
<p>
@@ -115,6 +132,13 @@ end of tocinfo -->
<li class="active"><a href="._How2ReadData-bs000.html">1</a></li>
<li><a href="._How2ReadData-bs001.html">2</a></li>
<li><a href="._How2ReadData-bs002.html">3</a></li>
<li><a href="._How2ReadData-bs003.html">4</a></li>
<li><a href="._How2ReadData-bs004.html">5</a></li>
<li><a href="._How2ReadData-bs005.html">6</a></li>
<li><a href="._How2ReadData-bs006.html">7</a></li>
<li><a href="._How2ReadData-bs007.html">8</a></li>
<li><a href="._How2ReadData-bs008.html">9</a></li>
<li><a href="._How2ReadData-bs009.html">10</a></li>
<li><a href="._How2ReadData-bs001.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
@@ -6,9 +6,9 @@ Automatically generated HTML file from DocOnce source
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
<meta name="description" content="Data Analysis and Machine Learning: Representing data">
<meta name="description" content="Data Analysis and Machine Learning: Introduction and Representing data">
<title>Data Analysis and Machine Learning: Representing data</title>
<title>Data Analysis and Machine Learning: Introduction and Representing data</title>
<!-- Bootstrap style: bootstrap -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
@@ -40,8 +40,18 @@ Automatically generated HTML file from DocOnce source
<!-- tocinfo
{'highest level': 2,
'sections': [('Representing data, overarching aims', 2, None, '___sec0'),
('Representing data, overarching aims', 2, None, '___sec1')]}
'sections': [('What is Machine Learning?', 2, None, '___sec0'),
('Types of Machine Learning', 2, None, '___sec1'),
('Different algorithms', 2, None, '___sec2'),
('Software and needed installations', 2, None, '___sec3'),
('Python installers', 2, None, '___sec4'),
('Installing R and C++', 2, None, '___sec5'),
('Introduction to Jupyter notebook and available tools',
2,
None,
'___sec6'),
('Representing data, overarching aims', 2, None, '___sec7'),
('Representing data, more examples', 2, None, '___sec8')]}
end of tocinfo -->
<body>
@@ -55,7 +65,7 @@ end of tocinfo -->
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="How2ReadData-bs.html">Data Analysis and Machine Learning: Representing data</a>
<a class="navbar-brand" href="How2ReadData-bs.html">Data Analysis and Machine Learning: Introduction and Representing data</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
@@ -63,8 +73,15 @@ end of tocinfo -->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="#___sec0" style="font-size: 80%;">Representing data, overarching aims</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs002.html#___sec1" style="font-size: 80%;">Representing data, overarching aims</a></li>
<!-- navigation toc: --> <li><a href="#___sec0" style="font-size: 80%;">What is Machine Learning?</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs002.html#___sec1" style="font-size: 80%;">Types of Machine Learning</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs003.html#___sec2" style="font-size: 80%;">Different algorithms</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs004.html#___sec3" style="font-size: 80%;">Software and needed installations</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs005.html#___sec4" style="font-size: 80%;">Python installers</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs006.html#___sec5" style="font-size: 80%;">Installing R and C++</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs007.html#___sec6" style="font-size: 80%;">Introduction to Jupyter notebook and available tools</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs008.html#___sec7" style="font-size: 80%;">Representing data, overarching aims</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs009.html#___sec8" style="font-size: 80%;">Representing data, more examples</a></li>
</ul>
</li>
@@ -80,34 +97,23 @@ end of tocinfo -->
<a name="part0001"></a>
<!-- !split -->
<h2 id="___sec0" class="anchor">Representing data, overarching aims </h2>
<div class="panel panel-default">
<div class="panel-body">
<p> <!-- subsequent paragraphs come in larger fonts, so start with a paragraph -->
<p>
<h2 id="___sec0" class="anchor">What is Machine Learning? </h2>
<!-- code=python (!bc pycod) typeset with pygments style "default" -->
<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span></span><span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">numpy</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">np</span>
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">matplotlib.pyplot</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">plt</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">scipy</span> <span style="color: #008000; font-weight: bold">import</span> sparse
<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">pandas</span> <span style="color: #008000; font-weight: bold">as</span> <span style="color: #0000FF; font-weight: bold">pd</span>
<span style="color: #008000; font-weight: bold">from</span> <span style="color: #0000FF; font-weight: bold">IPython.display</span> <span style="color: #008000; font-weight: bold">import</span> display
eye <span style="color: #666666">=</span> np<span style="color: #666666">.</span>eye(<span style="color: #666666">4</span>)
<span style="color: #008000; font-weight: bold">print</span>(eye)
sparse_mtx <span style="color: #666666">=</span> sparse<span style="color: #666666">.</span>csr_matrix(eye)
<span style="color: #008000; font-weight: bold">print</span>(sparse_mtx)
x <span style="color: #666666">=</span> np<span style="color: #666666">.</span>linspace(<span style="color: #666666">-10</span>,<span style="color: #666666">10</span>,<span style="color: #666666">100</span>)
y <span style="color: #666666">=</span> np<span style="color: #666666">.</span>sin(x)
plt<span style="color: #666666">.</span>plot(x,y,marker<span style="color: #666666">=</span><span style="color: #BA2121">&#39;x&#39;</span>)
plt<span style="color: #666666">.</span>show()
data <span style="color: #666666">=</span> {<span style="color: #BA2121">&#39;Name&#39;</span>: [<span style="color: #BA2121">&quot;John&quot;</span>, <span style="color: #BA2121">&quot;Anna&quot;</span>, <span style="color: #BA2121">&quot;Peter&quot;</span>, <span style="color: #BA2121">&quot;Linda&quot;</span>], <span style="color: #BA2121">&#39;Location&#39;</span>: [<span style="color: #BA2121">&quot;Roma&quot;</span>, <span style="color: #BA2121">&quot;Napoli&quot;</span>, <span style="color: #BA2121">&quot;Torino&quot;</span>, <span style="color: #BA2121">&quot;Milano&quot;</span>], <span style="color: #BA2121">&#39;Age&#39;</span>:[<span style="color: #666666">51</span>, <span style="color: #666666">21</span>, <span style="color: #666666">34</span>, <span style="color: #666666">45</span>]}
data_pandas <span style="color: #666666">=</span> pd<span style="color: #666666">.</span>DataFrame(data)
display(data_pandas)
</pre></div>
<p>
</div>
</div>
Machine learning is the science of giving computers the ability to
learn without being explicitly programmed. The idea is that there
exist generic algorithms which can be used to find patterns in a broad
class of data sets without having to write code specifically for each
problem. The algorithm will build its own logic based on the data.
<p>
Machine learning is a subfield of computer science, and is closely
related to computational statistics. It evolved from the study of
pattern recognition in artificial intelligence (AI) research, and has
made contributions to AI tasks like computer vision, natural language
processing and speech recognition. It has also, especially in later
years, found applications in a wide variety of other areas, including
bioinformatics, economy, physics, finance and marketing.
<p>
<p>
@@ -117,6 +123,13 @@ display(data_pandas)
<li><a href="._How2ReadData-bs000.html">1</a></li>
<li class="active"><a href="._How2ReadData-bs001.html">2</a></li>
<li><a href="._How2ReadData-bs002.html">3</a></li>
<li><a href="._How2ReadData-bs003.html">4</a></li>
<li><a href="._How2ReadData-bs004.html">5</a></li>
<li><a href="._How2ReadData-bs005.html">6</a></li>
<li><a href="._How2ReadData-bs006.html">7</a></li>
<li><a href="._How2ReadData-bs007.html">8</a></li>
<li><a href="._How2ReadData-bs008.html">9</a></li>
<li><a href="._How2ReadData-bs009.html">10</a></li>
<li><a href="._How2ReadData-bs002.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
+33 -9
View File
@@ -6,9 +6,9 @@ Automatically generated HTML file from DocOnce source
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
<meta name="description" content="Data Analysis and Machine Learning: Representing data">
<meta name="description" content="Data Analysis and Machine Learning: Introduction and Representing data">
<title>Data Analysis and Machine Learning: Representing data</title>
<title>Data Analysis and Machine Learning: Introduction and Representing data</title>
<!-- Bootstrap style: bootstrap -->
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
@@ -40,8 +40,18 @@ Automatically generated HTML file from DocOnce source
<!-- tocinfo
{'highest level': 2,
'sections': [('Representing data, overarching aims', 2, None, '___sec0'),
('Representing data, overarching aims', 2, None, '___sec1')]}
'sections': [('What is Machine Learning?', 2, None, '___sec0'),
('Types of Machine Learning', 2, None, '___sec1'),
('Different algorithms', 2, None, '___sec2'),
('Software and needed installations', 2, None, '___sec3'),
('Python installers', 2, None, '___sec4'),
('Installing R and C++', 2, None, '___sec5'),
('Introduction to Jupyter notebook and available tools',
2,
None,
'___sec6'),
('Representing data, overarching aims', 2, None, '___sec7'),
('Representing data, more examples', 2, None, '___sec8')]}
end of tocinfo -->
<body>
@@ -55,7 +65,7 @@ end of tocinfo -->
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="How2ReadData-bs.html">Data Analysis and Machine Learning: Representing data</a>
<a class="navbar-brand" href="How2ReadData-bs.html">Data Analysis and Machine Learning: Introduction and Representing data</a>
</div>
<div class="navbar-collapse collapse navbar-responsive-collapse">
@@ -63,8 +73,15 @@ end of tocinfo -->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Contents <b class="caret"></b></a>
<ul class="dropdown-menu">
<!-- navigation toc: --> <li><a href="._How2ReadData-bs001.html#___sec0" style="font-size: 80%;">Representing data, overarching aims</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs002.html#___sec1" style="font-size: 80%;">Representing data, overarching aims</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs001.html#___sec0" style="font-size: 80%;">What is Machine Learning?</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs002.html#___sec1" style="font-size: 80%;">Types of Machine Learning</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs003.html#___sec2" style="font-size: 80%;">Different algorithms</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs004.html#___sec3" style="font-size: 80%;">Software and needed installations</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs005.html#___sec4" style="font-size: 80%;">Python installers</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs006.html#___sec5" style="font-size: 80%;">Installing R and C++</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs007.html#___sec6" style="font-size: 80%;">Introduction to Jupyter notebook and available tools</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs008.html#___sec7" style="font-size: 80%;">Representing data, overarching aims</a></li>
<!-- navigation toc: --> <li><a href="._How2ReadData-bs009.html#___sec8" style="font-size: 80%;">Representing data, more examples</a></li>
</ul>
</li>
@@ -83,7 +100,7 @@ end of tocinfo -->
<div class="jumbotron">
<center><h1>Data Analysis and Machine Learning: Representing data</h1></center> <!-- document title -->
<center><h1>Data Analysis and Machine Learning: Introduction and Representing data</h1></center> <!-- document title -->
<p>
<!-- author(s): Morten Hjorth-Jensen -->
@@ -99,7 +116,7 @@ end of tocinfo -->
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
<br>
<p>
<center><h4>Nov 26, 2017</h4></center> <!-- date -->
<center><h4>Nov 27, 2017</h4></center> <!-- date -->
<br>
<p>
@@ -115,6 +132,13 @@ end of tocinfo -->
<li class="active"><a href="._How2ReadData-bs000.html">1</a></li>
<li><a href="._How2ReadData-bs001.html">2</a></li>
<li><a href="._How2ReadData-bs002.html">3</a></li>
<li><a href="._How2ReadData-bs003.html">4</a></li>
<li><a href="._How2ReadData-bs004.html">5</a></li>
<li><a href="._How2ReadData-bs005.html">6</a></li>
<li><a href="._How2ReadData-bs006.html">7</a></li>
<li><a href="._How2ReadData-bs007.html">8</a></li>
<li><a href="._How2ReadData-bs008.html">9</a></li>
<li><a href="._How2ReadData-bs009.html">10</a></li>
<li><a href="._How2ReadData-bs001.html">&raquo;</a></li>
</ul>
<!-- ------------------- end of main content --------------- -->
@@ -3,9 +3,9 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
<meta name="description" content="Data Analysis and Machine Learning: Representing data">
<meta name="description" content="Data Analysis and Machine Learning: Introduction and Representing data">
<title>Data Analysis and Machine Learning: Representing data</title>
<title>Data Analysis and Machine Learning: Introduction and Representing data</title>
@@ -116,7 +116,7 @@ td.padding {
<center><h1 style="text-align: center;">Data Analysis and Machine Learning: Representing data</h1></center> <!-- document title -->
<center><h1 style="text-align: center;">Data Analysis and Machine Learning: Introduction and Representing data</h1></center> <!-- document title -->
<p>
<!-- author(s): Morten Hjorth-Jensen -->
@@ -132,7 +132,7 @@ td.padding {
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
<br>
<p>&nbsp;<br>
<center><h4>Nov 26, 2017</h4></center> <!-- date -->
<center><h4>Nov 27, 2017</h4></center> <!-- date -->
<br>
<p>
@@ -143,7 +143,155 @@ td.padding {
<section>
<h2 id="___sec0">Representing data, overarching aims </h2>
<h2 id="___sec0">What is Machine Learning? </h2>
<p>
Machine learning is the science of giving computers the ability to
learn without being explicitly programmed. The idea is that there
exist generic algorithms which can be used to find patterns in a broad
class of data sets without having to write code specifically for each
problem. The algorithm will build its own logic based on the data.
<p>
Machine learning is a subfield of computer science, and is closely
related to computational statistics. It evolved from the study of
pattern recognition in artificial intelligence (AI) research, and has
made contributions to AI tasks like computer vision, natural language
processing and speech recognition. It has also, especially in later
years, found applications in a wide variety of other areas, including
bioinformatics, economy, physics, finance and marketing.
</section>
<section>
<h2 id="___sec1">Types of Machine Learning </h2>
<p>
The approaches to machine learning are many, but are often split into two main categories.
In <em>supervised learning</em> we know the answer to a problem,
and let the computer deduce the logic behind it. On the other hand, <em>unsupervised learning</em>
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 <em>reinforcement learning</em>. This is a paradigm
of learning inspired by behavioural psychology, where learning is achieved by trial-and-error,
solely from rewards and punishment.
<p>
Another way to categorize machine learning tasks is to consider the desired output of a system.
Some of the most common tasks are:
<ul>
<p><li> 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.</li>
<p><li> 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.</li>
<p><li> Clustering: Data are divided into groups with certain common traits, without knowing the different groups beforehand. It is thus a form of unsupervised learning.</li>
</ul>
</section>
<section>
<h2 id="___sec2">Different algorithms </h2>
In this course we will build our machine learning approach on a statistical foundation, with elements
from data analysis, stochastic processes etc before we proceed with the following machine learning algorithms
<ol>
<p><li> Linear regression and its variants</li>
<p><li> Decision tree algorithms, from simpler to more complex ones</li>
<p><li> Nearest neighbors models</li>
<p><li> Bayesian statistics</li>
<p><li> Support vector machines and finally various variants of</li>
<p><li> Artifical neural networks</li>
</ol>
<p>
Before we proceed however, there are several practicalities with data analysis and software tools we would
like to present. These tools will help us in our understanding of various machine learning algorithms.
<p>
Our emphasis here is on understanding the mathematical aspects of different algorithms, however, where possible
we will emphasize the importance of using available software.
</section>
<section>
<h2 id="___sec3">Software and needed installations </h2>
We will make intensive use of python as programming language and the myriad of available libraries.
Furthermore, you will find IPython/Jupyter notebooks invaluable in your work.
You can run <b>R</b> codes in the Jupyter/IPython notebooks, with the immediate benefit of visualizing your data.
<p>
If you have Python installed (we recommend Python3) and you feel pretty familiar with installing different packages,
we recommend that you install the following Python packages via <b>pip</b> as
<ol>
<p><li> pip install numpy scipy matplotlib ipython scikit-learn mglearn sympy pandas pillow</li>
</ol>
<p>
For Python3, replace <b>pip</b> with <b>pip3</b>.
<p>
For OSX user we recommend also, after having installed Xcode, to install <b>brew</b>. Brew allows
for a seamless installation of additional software via for example
<ol>
<p><li> brew install python3</li>
</ol>
<p>
For Linux users, with its variety of distributions like for example the widely popular Ubuntu distribution
you can use <b>pip</b> as well and simply install Python as
<ol>
<p><li> sudo apt-get install python3 (or python for pyhton2.7)</li>
</ol>
<p>
etc etc.
</section>
<section>
<h2 id="___sec4">Python installers </h2>
If you don't want to perform these operations separately, we recommend two widely used distrubutions which set up
all relevant dependencies for Python, namely
<ol>
<p><li> anaconda</li>
<p><li> Enthought canopy</li>
</ol>
</section>
<section>
<h2 id="___sec5">Installing R and C++ </h2>
<p>
You will also find it convenient to utilize R. Say more about R.
Jupyter/Ipython notebook allows you run <b>R</b> code interactively in your browser. The software library <b>R</b> is
tuned to statistically analysis and allows for an easy usage of the tools we will discuss in these texts.
<p>
For the C++ affecianodas, Jupyter/IPython notebook allows you also to install C++ and run codes written in this language
interactively in the browser. Since we will emphasize writing many of the algorithms yourself, you can thus opt for
either Python or C++ as programming languages.
<p>
To add more entropy, <b>cython</b> can also be used when running your notebooks. It means that Python with the Jupyter/IPython notebook
setup allows you to integrate widely popular softwares and tools for scientific computing. With its versatility,
including symbolic operations, Python offers a unique computational environment. Your Jupyter/IPython notebook
can easily be converted into a nicely rendered <b>PDF</b> file or a Latex file for further processing.
</section>
<section>
<h2 id="___sec6">Introduction to Jupyter notebook and available tools </h2>
</section>
<section>
<h2 id="___sec7">Representing data, overarching aims </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
@@ -172,7 +320,7 @@ display(data_pandas)
<section>
<h2 id="___sec1">Representing data, overarching aims </h2>
<h2 id="___sec8">Representing data, more examples </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
@@ -6,9 +6,9 @@ Automatically generated HTML file from DocOnce source
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
<meta name="description" content="Data Analysis and Machine Learning: Representing data">
<meta name="description" content="Data Analysis and Machine Learning: Introduction and Representing data">
<title>Data Analysis and Machine Learning: Representing data</title>
<title>Data Analysis and Machine Learning: Introduction and Representing data</title>
<link href="https://cdn.rawgit.com/hplgit/doconce/master/bundled/html_styles/style_solarized_box/css/solarized_light_code.css" rel="stylesheet" type="text/css" title="light"/>
@@ -60,8 +60,18 @@ div { text-align: justify; text-justify: inter-word; }
<!-- tocinfo
{'highest level': 2,
'sections': [('Representing data, overarching aims', 2, None, '___sec0'),
('Representing data, overarching aims', 2, None, '___sec1')]}
'sections': [('What is Machine Learning?', 2, None, '___sec0'),
('Types of Machine Learning', 2, None, '___sec1'),
('Different algorithms', 2, None, '___sec2'),
('Software and needed installations', 2, None, '___sec3'),
('Python installers', 2, None, '___sec4'),
('Installing R and C++', 2, None, '___sec5'),
('Introduction to Jupyter notebook and available tools',
2,
None,
'___sec6'),
('Representing data, overarching aims', 2, None, '___sec7'),
('Representing data, more examples', 2, None, '___sec8')]}
end of tocinfo -->
<body>
@@ -71,7 +81,7 @@ end of tocinfo -->
<center><h1>Data Analysis and Machine Learning: Representing data</h1></center> <!-- document title -->
<center><h1>Data Analysis and Machine Learning: Introduction and Representing data</h1></center> <!-- document title -->
<p>
<!-- author(s): Morten Hjorth-Jensen -->
@@ -87,12 +97,151 @@ end of tocinfo -->
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
<br>
<p>
<center><h4>Nov 26, 2017</h4></center> <!-- date -->
<center><h4>Nov 27, 2017</h4></center> <!-- date -->
<br>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec0">Representing data, overarching aims </h2>
<h2 id="___sec0">What is Machine Learning? </h2>
<p>
Machine learning is the science of giving computers the ability to
learn without being explicitly programmed. The idea is that there
exist generic algorithms which can be used to find patterns in a broad
class of data sets without having to write code specifically for each
problem. The algorithm will build its own logic based on the data.
<p>
Machine learning is a subfield of computer science, and is closely
related to computational statistics. It evolved from the study of
pattern recognition in artificial intelligence (AI) research, and has
made contributions to AI tasks like computer vision, natural language
processing and speech recognition. It has also, especially in later
years, found applications in a wide variety of other areas, including
bioinformatics, economy, physics, finance and marketing.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec1">Types of Machine Learning </h2>
<p>
The approaches to machine learning are many, but are often split into two main categories.
In <em>supervised learning</em> we know the answer to a problem,
and let the computer deduce the logic behind it. On the other hand, <em>unsupervised learning</em>
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 <em>reinforcement learning</em>. This is a paradigm
of learning inspired by behavioural psychology, where learning is achieved by trial-and-error,
solely from rewards and punishment.
<p>
Another way to categorize machine learning tasks is to consider the desired output of a system.
Some of the most common tasks are:
<ul>
<li> 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.</li>
<li> 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.</li>
<li> Clustering: Data are divided into groups with certain common traits, without knowing the different groups beforehand. It is thus a form of unsupervised learning.</li>
</ul>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec2">Different algorithms </h2>
In this course we will build our machine learning approach on a statistical foundation, with elements
from data analysis, stochastic processes etc before we proceed with the following machine learning algorithms
<ol>
<li> Linear regression and its variants</li>
<li> Decision tree algorithms, from simpler to more complex ones</li>
<li> Nearest neighbors models</li>
<li> Bayesian statistics</li>
<li> Support vector machines and finally various variants of</li>
<li> Artifical neural networks</li>
</ol>
Before we proceed however, there are several practicalities with data analysis and software tools we would
like to present. These tools will help us in our understanding of various machine learning algorithms.
<p>
Our emphasis here is on understanding the mathematical aspects of different algorithms, however, where possible
we will emphasize the importance of using available software.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec3">Software and needed installations </h2>
We will make intensive use of python as programming language and the myriad of available libraries.
Furthermore, you will find IPython/Jupyter notebooks invaluable in your work.
You can run <b>R</b> codes in the Jupyter/IPython notebooks, with the immediate benefit of visualizing your data.
<p>
If you have Python installed (we recommend Python3) and you feel pretty familiar with installing different packages,
we recommend that you install the following Python packages via <b>pip</b> as
<ol>
<li> pip install numpy scipy matplotlib ipython scikit-learn mglearn sympy pandas pillow</li>
</ol>
For Python3, replace <b>pip</b> with <b>pip3</b>.
<p>
For OSX user we recommend also, after having installed Xcode, to install <b>brew</b>. Brew allows
for a seamless installation of additional software via for example
<ol>
<li> brew install python3</li>
</ol>
For Linux users, with its variety of distributions like for example the widely popular Ubuntu distribution
you can use <b>pip</b> as well and simply install Python as
<ol>
<li> sudo apt-get install python3 (or python for pyhton2.7)</li>
</ol>
etc etc.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec4">Python installers </h2>
If you don't want to perform these operations separately, we recommend two widely used distrubutions which set up
all relevant dependencies for Python, namely
<ol>
<li> anaconda</li>
<li> Enthought canopy</li>
</ol>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec5">Installing R and C++ </h2>
<p>
You will also find it convenient to utilize R. Say more about R.
Jupyter/Ipython notebook allows you run <b>R</b> code interactively in your browser. The software library <b>R</b> is
tuned to statistically analysis and allows for an easy usage of the tools we will discuss in these texts.
<p>
For the C++ affecianodas, Jupyter/IPython notebook allows you also to install C++ and run codes written in this language
interactively in the browser. Since we will emphasize writing many of the algorithms yourself, you can thus opt for
either Python or C++ as programming languages.
<p>
To add more entropy, <b>cython</b> can also be used when running your notebooks. It means that Python with the Jupyter/IPython notebook
setup allows you to integrate widely popular softwares and tools for scientific computing. With its versatility,
including symbolic operations, Python offers a unique computational environment. Your Jupyter/IPython notebook
can easily be converted into a nicely rendered <b>PDF</b> file or a Latex file for further processing.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec6">Introduction to Jupyter notebook and available tools </h2>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec7">Representing data, overarching aims </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
@@ -123,7 +272,7 @@ display(data_pandas)
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec1">Representing data, overarching aims </h2>
<h2 id="___sec8">Representing data, more examples </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
@@ -151,6 +300,8 @@ plt.show()
</div>
<p>
<!-- ------------------- end of main content --------------- -->
+159 -8
View File
@@ -6,9 +6,9 @@ Automatically generated HTML file from DocOnce source
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
<meta name="description" content="Data Analysis and Machine Learning: Representing data">
<meta name="description" content="Data Analysis and Machine Learning: Introduction and Representing data">
<title>Data Analysis and Machine Learning: Representing data</title>
<title>Data Analysis and Machine Learning: Introduction and Representing data</title>
<style type="text/css">
@@ -65,8 +65,18 @@ div { text-align: justify; text-justify: inter-word; }
<!-- tocinfo
{'highest level': 2,
'sections': [('Representing data, overarching aims', 2, None, '___sec0'),
('Representing data, overarching aims', 2, None, '___sec1')]}
'sections': [('What is Machine Learning?', 2, None, '___sec0'),
('Types of Machine Learning', 2, None, '___sec1'),
('Different algorithms', 2, None, '___sec2'),
('Software and needed installations', 2, None, '___sec3'),
('Python installers', 2, None, '___sec4'),
('Installing R and C++', 2, None, '___sec5'),
('Introduction to Jupyter notebook and available tools',
2,
None,
'___sec6'),
('Representing data, overarching aims', 2, None, '___sec7'),
('Representing data, more examples', 2, None, '___sec8')]}
end of tocinfo -->
<body>
@@ -76,7 +86,7 @@ end of tocinfo -->
<center><h1>Data Analysis and Machine Learning: Representing data</h1></center> <!-- document title -->
<center><h1>Data Analysis and Machine Learning: Introduction and Representing data</h1></center> <!-- document title -->
<p>
<!-- author(s): Morten Hjorth-Jensen -->
@@ -92,12 +102,151 @@ end of tocinfo -->
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
<br>
<p>
<center><h4>Nov 26, 2017</h4></center> <!-- date -->
<center><h4>Nov 27, 2017</h4></center> <!-- date -->
<br>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec0">Representing data, overarching aims </h2>
<h2 id="___sec0">What is Machine Learning? </h2>
<p>
Machine learning is the science of giving computers the ability to
learn without being explicitly programmed. The idea is that there
exist generic algorithms which can be used to find patterns in a broad
class of data sets without having to write code specifically for each
problem. The algorithm will build its own logic based on the data.
<p>
Machine learning is a subfield of computer science, and is closely
related to computational statistics. It evolved from the study of
pattern recognition in artificial intelligence (AI) research, and has
made contributions to AI tasks like computer vision, natural language
processing and speech recognition. It has also, especially in later
years, found applications in a wide variety of other areas, including
bioinformatics, economy, physics, finance and marketing.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec1">Types of Machine Learning </h2>
<p>
The approaches to machine learning are many, but are often split into two main categories.
In <em>supervised learning</em> we know the answer to a problem,
and let the computer deduce the logic behind it. On the other hand, <em>unsupervised learning</em>
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 <em>reinforcement learning</em>. This is a paradigm
of learning inspired by behavioural psychology, where learning is achieved by trial-and-error,
solely from rewards and punishment.
<p>
Another way to categorize machine learning tasks is to consider the desired output of a system.
Some of the most common tasks are:
<ul>
<li> 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.</li>
<li> 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.</li>
<li> Clustering: Data are divided into groups with certain common traits, without knowing the different groups beforehand. It is thus a form of unsupervised learning.</li>
</ul>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec2">Different algorithms </h2>
In this course we will build our machine learning approach on a statistical foundation, with elements
from data analysis, stochastic processes etc before we proceed with the following machine learning algorithms
<ol>
<li> Linear regression and its variants</li>
<li> Decision tree algorithms, from simpler to more complex ones</li>
<li> Nearest neighbors models</li>
<li> Bayesian statistics</li>
<li> Support vector machines and finally various variants of</li>
<li> Artifical neural networks</li>
</ol>
Before we proceed however, there are several practicalities with data analysis and software tools we would
like to present. These tools will help us in our understanding of various machine learning algorithms.
<p>
Our emphasis here is on understanding the mathematical aspects of different algorithms, however, where possible
we will emphasize the importance of using available software.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec3">Software and needed installations </h2>
We will make intensive use of python as programming language and the myriad of available libraries.
Furthermore, you will find IPython/Jupyter notebooks invaluable in your work.
You can run <b>R</b> codes in the Jupyter/IPython notebooks, with the immediate benefit of visualizing your data.
<p>
If you have Python installed (we recommend Python3) and you feel pretty familiar with installing different packages,
we recommend that you install the following Python packages via <b>pip</b> as
<ol>
<li> pip install numpy scipy matplotlib ipython scikit-learn mglearn sympy pandas pillow</li>
</ol>
For Python3, replace <b>pip</b> with <b>pip3</b>.
<p>
For OSX user we recommend also, after having installed Xcode, to install <b>brew</b>. Brew allows
for a seamless installation of additional software via for example
<ol>
<li> brew install python3</li>
</ol>
For Linux users, with its variety of distributions like for example the widely popular Ubuntu distribution
you can use <b>pip</b> as well and simply install Python as
<ol>
<li> sudo apt-get install python3 (or python for pyhton2.7)</li>
</ol>
etc etc.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec4">Python installers </h2>
If you don't want to perform these operations separately, we recommend two widely used distrubutions which set up
all relevant dependencies for Python, namely
<ol>
<li> anaconda</li>
<li> Enthought canopy</li>
</ol>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec5">Installing R and C++ </h2>
<p>
You will also find it convenient to utilize R. Say more about R.
Jupyter/Ipython notebook allows you run <b>R</b> code interactively in your browser. The software library <b>R</b> is
tuned to statistically analysis and allows for an easy usage of the tools we will discuss in these texts.
<p>
For the C++ affecianodas, Jupyter/IPython notebook allows you also to install C++ and run codes written in this language
interactively in the browser. Since we will emphasize writing many of the algorithms yourself, you can thus opt for
either Python or C++ as programming languages.
<p>
To add more entropy, <b>cython</b> can also be used when running your notebooks. It means that Python with the Jupyter/IPython notebook
setup allows you to integrate widely popular softwares and tools for scientific computing. With its versatility,
including symbolic operations, Python offers a unique computational environment. Your Jupyter/IPython notebook
can easily be converted into a nicely rendered <b>PDF</b> file or a Latex file for further processing.
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec6">Introduction to Jupyter notebook and available tools </h2>
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec7">Representing data, overarching aims </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
@@ -128,7 +277,7 @@ display(data_pandas)
<p>
<!-- !split --><br><br><br><br><br><br><br><br><br><br>
<h2 id="___sec1">Representing data, overarching aims </h2>
<h2 id="___sec8">Representing data, more examples </h2>
<div class="alert alert-block alert-block alert-text-normal">
<b></b>
<p>
@@ -156,6 +305,8 @@ plt<span style="color: #666666">.</span>show()
</div>
<p>
<!-- ------------------- end of main content --------------- -->
File diff suppressed because one or more lines are too long
+112 -4
View File
@@ -4,19 +4,127 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"<!-- dom:TITLE: Data Analysis and Machine Learning: Representing data -->\n",
"# Data Analysis and Machine Learning: Representing data\n",
"<!-- dom:TITLE: Data Analysis and Machine Learning: Introduction and Representing data -->\n",
"# Data Analysis and Machine Learning: Introduction and Representing data\n",
"<!-- dom:AUTHOR: Morten Hjorth-Jensen at Department of Physics, University of Oslo & Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University -->\n",
"<!-- Author: --> \n",
"**Morten Hjorth-Jensen**, Department of Physics, University of Oslo and Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University\n",
"\n",
"Date: **Nov 26, 2017**\n",
"Date: **Nov 27, 2017**\n",
"\n",
"Copyright 1999-2017, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license\n",
"\n",
"\n",
"\n",
"\n",
"## What is Machine Learning?\n",
"\n",
"Machine learning is the science of giving computers the ability to\n",
"learn without being explicitly programmed. The idea is that there\n",
"exist generic algorithms which can be used to find patterns in a broad\n",
"class of data sets without having to write code specifically for each\n",
"problem. The algorithm will build its own logic based on the data.\n",
"\n",
"Machine learning is a subfield of computer science, and is closely\n",
"related to computational statistics. It evolved from the study of\n",
"pattern recognition in artificial intelligence (AI) research, and has\n",
"made contributions to AI tasks like computer vision, natural language\n",
"processing and speech recognition. It has also, especially in later\n",
"years, found applications in a wide variety of other areas, including\n",
"bioinformatics, economy, physics, finance and marketing.\n",
"\n",
"## Types of Machine Learning\n",
"\n",
"\n",
"The approaches to machine learning are many, but are often split into two main categories. \n",
"In *supervised learning* we know the answer to a problem,\n",
"and let the computer deduce the logic behind it. On the other hand, *unsupervised learning*\n",
"is a method for finding patterns and relationship in data sets without any prior knowledge of the system.\n",
"Some authours also operate with a third category, namely *reinforcement learning*. This is a paradigm \n",
"of learning inspired by behavioural psychology, where learning is achieved by trial-and-error, \n",
"solely from rewards and punishment.\n",
"\n",
"Another way to categorize machine learning tasks is to consider the desired output of a system.\n",
"Some of the most common tasks are:\n",
"\n",
" * 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.\n",
"\n",
" * 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.\n",
"\n",
" * Clustering: Data are divided into groups with certain common traits, without knowing the different groups beforehand. It is thus a form of unsupervised learning.\n",
"\n",
"## Different algorithms\n",
"In this course we will build our machine learning approach on a statistical foundation, with elements \n",
"from data analysis, stochastic processes etc before we proceed with the following machine learning algorithms\n",
"\n",
"1. Linear regression and its variants\n",
"\n",
"2. Decision tree algorithms, from simpler to more complex ones\n",
"\n",
"3. Nearest neighbors models\n",
"\n",
"4. Bayesian statistics \n",
"\n",
"5. Support vector machines and finally various variants of\n",
"\n",
"6. Artifical neural networks\n",
"\n",
"Before we proceed however, there are several practicalities with data analysis and software tools we would \n",
"like to present. These tools will help us in our understanding of various machine learning algorithms. \n",
"\n",
"Our emphasis here is on understanding the mathematical aspects of different algorithms, however, where possible \n",
"we will emphasize the importance of using available software. \n",
"\n",
"\n",
"## Software and needed installations\n",
"We will make intensive use of python as programming language and the myriad of available libraries. \n",
"Furthermore, you will find IPython/Jupyter notebooks invaluable in your work. \n",
"You can run **R** codes in the Jupyter/IPython notebooks, with the immediate benefit of visualizing your data.\n",
"\n",
"\n",
"If you have Python installed (we recommend Python3) and you feel pretty familiar with installing different packages, \n",
"we recommend that you install the following Python packages via **pip** as\n",
"1. pip install numpy scipy matplotlib ipython scikit-learn mglearn sympy pandas pillow\n",
"\n",
"For Python3, replace **pip** with **pip3**.\n",
"\n",
"For OSX user we recommend also, after having installed Xcode, to install **brew**. Brew allows \n",
"for a seamless installation of additional software via for example\n",
"1. brew install python3\n",
"\n",
"For Linux users, with its variety of distributions like for example the widely popular Ubuntu distribution\n",
"you can use **pip** as well and simply install Python as \n",
"1. sudo apt-get install python3 (or python for pyhton2.7)\n",
"\n",
"etc etc. \n",
"\n",
"## Python installers\n",
"If you don't want to perform these operations separately, we recommend two widely used distrubutions which set up \n",
"all relevant dependencies for Python, namely\n",
"1. anaconda\n",
"\n",
"2. Enthought canopy\n",
"\n",
"## Installing R and C++\n",
"\n",
"You will also find it convenient to utilize R. Say more about R. \n",
"Jupyter/Ipython notebook allows you run **R** code interactively in your browser. The software library **R** is \n",
"tuned to statistically analysis and allows for an easy usage of the tools we will discuss in these texts.\n",
"\n",
"For the C++ affecianodas, Jupyter/IPython notebook allows you also to install C++ and run codes written in this language \n",
"interactively in the browser. Since we will emphasize writing many of the algorithms yourself, you can thus opt for\n",
"either Python or C++ as programming languages. \n",
"\n",
"To add more entropy, **cython** can also be used when running your notebooks. It means that Python with the Jupyter/IPython notebook \n",
"setup allows you to integrate widely popular softwares and tools for scientific computing. With its versatility, \n",
"including symbolic operations, Python offers a unique computational environment. Your Jupyter/IPython notebook \n",
"can easily be converted into a nicely rendered **PDF** file or a Latex file for further processing.\n",
"\n",
"\n",
"## Introduction to Jupyter notebook and available tools\n",
"\n",
"\n",
"\n",
"## Representing data, overarching aims"
]
},
@@ -52,7 +160,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Representing data, overarching aims"
"## Representing data, more examples"
]
},
{
Binary file not shown.
Binary file not shown.
+115 -2
View File
@@ -1,8 +1,117 @@
TITLE: Data Analysis and Machine Learning: Representing data
TITLE: Data Analysis and Machine Learning: Introduction and Representing data
AUTHOR: Morten Hjorth-Jensen {copyright, 1999-present|CC BY-NC} at Department of Physics, University of Oslo & Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University
DATE: today
!split
===== What is Machine Learning? =====
Machine learning is the science of giving computers the ability to
learn without being explicitly programmed. The idea is that there
exist generic algorithms which can be used to find patterns in a broad
class of data sets without having to write code specifically for each
problem. The algorithm will build its own logic based on the data.
Machine learning is a subfield of computer science, and is closely
related to computational statistics. It evolved from the study of
pattern recognition in artificial intelligence (AI) research, and has
made contributions to AI tasks like computer vision, natural language
processing and speech recognition. It has also, especially in later
years, found applications in a wide variety of other areas, including
bioinformatics, economy, physics, finance and marketing.
!split
===== Types of Machine Learning =====
The approaches to machine learning are many, but are often split into 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, *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 *reinforcement learning*. This is a paradigm
of learning inspired by behavioural 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:
* 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.
* 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.
* Clustering: Data are divided into groups with certain common traits, without knowing the different groups beforehand. It is thus a form of unsupervised learning.
!split
===== Different algorithms =====
In this course we will build our machine learning approach on a statistical foundation, with elements
from data analysis, stochastic processes etc before we proceed with the following machine learning algorithms
o Linear regression and its variants
o Decision tree algorithms, from simpler to more complex ones
o Nearest neighbors models
o Bayesian statistics
o Support vector machines and finally various variants of
o Artifical neural networks
Before we proceed however, there are several practicalities with data analysis and software tools we would
like to present. These tools will help us in our understanding of various machine learning algorithms.
Our emphasis here is on understanding the mathematical aspects of different algorithms, however, where possible
we will emphasize the importance of using available software.
!split
===== Software and needed installations =====
We will make intensive use of python as programming language and the myriad of available libraries.
Furthermore, you will find IPython/Jupyter notebooks invaluable in your work.
You can run _R_ codes in the Jupyter/IPython notebooks, with the immediate benefit of visualizing your data.
If you have Python installed (we recommend Python3) and you feel pretty familiar with installing different packages,
we recommend that you install the following Python packages via _pip_ as
o pip install numpy scipy matplotlib ipython scikit-learn mglearn sympy pandas pillow
For Python3, replace _pip_ with _pip3_.
For OSX user we recommend also, after having installed Xcode, to install _brew_. Brew allows
for a seamless installation of additional software via for example
o brew install python3
For Linux users, with its variety of distributions like for example the widely popular Ubuntu distribution
you can use _pip_ as well and simply install Python as
o sudo apt-get install python3 (or python for pyhton2.7)
etc etc.
!split
===== Python installers =====
If you don't want to perform these operations separately, we recommend two widely used distrubutions which set up
all relevant dependencies for Python, namely
o anaconda
o Enthought canopy
!split
===== Installing R and C++ =====
You will also find it convenient to utilize R. Say more about R.
Jupyter/Ipython notebook allows you run _R_ code interactively in your browser. The software library _R_ is
tuned to statistically analysis and allows for an easy usage of the tools we will discuss in these texts.
For the C++ affecianodas, Jupyter/IPython notebook allows you also to install C++ and run codes written in this language
interactively in the browser. Since we will emphasize writing many of the algorithms yourself, you can thus opt for
either Python or C++ as programming languages.
To add more entropy, _cython_ can also be used when running your notebooks. It means that Python with the Jupyter/IPython notebook
setup allows you to integrate widely popular softwares and tools for scientific computing. With its versatility,
including symbolic operations, Python offers a unique computational environment. Your Jupyter/IPython notebook
can easily be converted into a nicely rendered _PDF_ file or a Latex file for further processing.
!split
===== Introduction to Jupyter notebook and available tools =====
!split
===== Representing data, overarching aims =====
!bblock
@@ -29,7 +138,7 @@ display(data_pandas)
!split
===== Representing data, overarching aims =====
===== Representing data, more examples =====
!bblock
!bc pycod
import numpy as np
@@ -51,3 +160,7 @@ plt.show()
!ec
!eblock