added dim red material
This commit is contained in:
@@ -0,0 +1,154 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<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: Dimensionality Reduction">
|
||||
|
||||
<title>Data Analysis and Machine Learning: Dimensionality Reduction</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Reducing the number of degrees of freedom, overarching view',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Principal Component Analysis', 2, None, '___sec1'),
|
||||
('Kernel PCA', 2, None, '___sec2'),
|
||||
('LLE', 2, None, '___sec3'),
|
||||
('Other techniques', 2, None, '___sec4')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="DimRed-bs.html">Data Analysis and Machine Learning: Dimensionality Reduction</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<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="._DimRed-bs001.html#___sec0" style="font-size: 80%;">Reducing the number of degrees of freedom, overarching view</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs002.html#___sec1" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs003.html#___sec2" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs004.html#___sec3" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs005.html#___sec4" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0000"></a>
|
||||
<!-- ------------------- main content ---------------------- -->
|
||||
|
||||
|
||||
|
||||
<div class="jumbotron">
|
||||
<center><h1>Data Analysis and Machine Learning: Dimensionality Reduction</h1></center> <!-- document title -->
|
||||
|
||||
<p>
|
||||
<!-- author(s): Morten Hjorth-Jensen -->
|
||||
|
||||
<center>
|
||||
<b>Morten Hjorth-Jensen</b> [1, 2]
|
||||
</center>
|
||||
|
||||
<p>
|
||||
<!-- institution(s) -->
|
||||
|
||||
<center>[1] <b>Department of Physics, University of Oslo</b></center>
|
||||
<center>[2] <b>Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University</b></center>
|
||||
<br>
|
||||
<p>
|
||||
<center><h4>Oct 24, 2018</h4></center> <!-- date -->
|
||||
<br>
|
||||
<p>
|
||||
|
||||
|
||||
<p><a href="._DimRed-bs001.html" class="btn btn-primary btn-lg">Read »</a></p>
|
||||
|
||||
|
||||
</div> <!-- end jumbotron -->
|
||||
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li class="active"><a href="._DimRed-bs000.html">1</a></li>
|
||||
<li><a href="._DimRed-bs001.html">2</a></li>
|
||||
<li><a href="._DimRed-bs002.html">3</a></li>
|
||||
<li><a href="._DimRed-bs003.html">4</a></li>
|
||||
<li><a href="._DimRed-bs004.html">5</a></li>
|
||||
<li><a href="._DimRed-bs005.html">6</a></li>
|
||||
<li><a href="._DimRed-bs001.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright --> © 1999-2018, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<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: Dimensionality Reduction">
|
||||
|
||||
<title>Data Analysis and Machine Learning: Dimensionality Reduction</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Reducing the number of degrees of freedom, overarching view',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Principal Component Analysis', 2, None, '___sec1'),
|
||||
('Kernel PCA', 2, None, '___sec2'),
|
||||
('LLE', 2, None, '___sec3'),
|
||||
('Other techniques', 2, None, '___sec4')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="DimRed-bs.html">Data Analysis and Machine Learning: Dimensionality Reduction</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<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%;">Reducing the number of degrees of freedom, overarching view</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs002.html#___sec1" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs003.html#___sec2" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs004.html#___sec3" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs005.html#___sec4" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0001"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec0" class="anchor">Reducing the number of degrees of freedom, overarching view </h2>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<p> <!-- subsequent paragraphs come in larger fonts, so start with a paragraph -->
|
||||
|
||||
<p>
|
||||
Many Machine Learning problems involve thousands or even millions of features for each training
|
||||
instance. Not only does this make training extremely slow, it can also make it much harder to find a good
|
||||
solution, as we will see. This problem is often referred to as the curse of dimensionality.
|
||||
Fortunately, in real-world problems, it is often possible to reduce the number of features considerably,
|
||||
turning an intractable problem into a tractable one.
|
||||
|
||||
<p>
|
||||
and we will go through three of the most popular dimensionality
|
||||
reduction techniques: PCA, Kernel PCA, and LLE.
|
||||
|
||||
<p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._DimRed-bs000.html">«</a></li>
|
||||
<li><a href="._DimRed-bs000.html">1</a></li>
|
||||
<li class="active"><a href="._DimRed-bs001.html">2</a></li>
|
||||
<li><a href="._DimRed-bs002.html">3</a></li>
|
||||
<li><a href="._DimRed-bs003.html">4</a></li>
|
||||
<li><a href="._DimRed-bs004.html">5</a></li>
|
||||
<li><a href="._DimRed-bs005.html">6</a></li>
|
||||
<li><a href="._DimRed-bs002.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,262 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<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: Dimensionality Reduction">
|
||||
|
||||
<title>Data Analysis and Machine Learning: Dimensionality Reduction</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Reducing the number of degrees of freedom, overarching view',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Principal Component Analysis', 2, None, '___sec1'),
|
||||
('Kernel PCA', 2, None, '___sec2'),
|
||||
('LLE', 2, None, '___sec3'),
|
||||
('Other techniques', 2, None, '___sec4')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="DimRed-bs.html">Data Analysis and Machine Learning: Dimensionality Reduction</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<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="._DimRed-bs001.html#___sec0" style="font-size: 80%;">Reducing the number of degrees of freedom, overarching view</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec1" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs003.html#___sec2" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs004.html#___sec3" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs005.html#___sec4" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0002"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec1" class="anchor">Principal Component Analysis </h2>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<p> <!-- subsequent paragraphs come in larger fonts, so start with a paragraph -->
|
||||
Principal Component Analysis (PCA) is by far the most popular dimensionality reduction algorithm.
|
||||
First it identifies the hyperplane that lies closest to the data, and then it projects the data onto it.
|
||||
|
||||
<p>
|
||||
The following Python code uses NumPy’s svd() function to obtain all the principal components of the
|
||||
training set, then extracts the first two PCs:
|
||||
X_centered = X - X.mean(axis=0)
|
||||
U, s, V = np.linalg.svd(X_centered)
|
||||
c1 = V.T[:, 0]
|
||||
c2 = V.T[:, 1]
|
||||
|
||||
<p>
|
||||
PCA assumes that the dataset is centered around the origin. As we will see, Scikit-Learn’s PCA classes take care of centering
|
||||
the data for you. However, if you implement PCA yourself (as in the preceding example), or if you use other libraries, don’t
|
||||
forget to center the data first.
|
||||
|
||||
<p>
|
||||
Once you have identified all the principal components, you can reduce the dimensionality of the dataset
|
||||
down to d dimensions by projecting it onto the hyperplane defined by the first d principal components.
|
||||
Selecting this hyperplane ensures that the projection will preserve as much variance as possible. For
|
||||
example, in Figure 8-2 the 3D dataset is projected down to the 2D plane defined by the first two principal
|
||||
components, preserving a large part of the dataset’s variance. As a result, the 2D projection looks very
|
||||
much like the original 3D dataset.
|
||||
|
||||
<p>
|
||||
W2 = V.T[:, :2]
|
||||
X2D = X_centered.dot(W2)
|
||||
|
||||
<p>
|
||||
Scikit-Learn’s PCA class implements PCA using SVD decomposition just like we did before. The
|
||||
following code applies PCA to reduce the dimensionality of the dataset down to two dimensions (note
|
||||
that it automatically takes care of centering the data):
|
||||
from sklearn.decomposition import PCA
|
||||
pca = PCA(n_components = 2)
|
||||
X2D = pca.fit_transform(X)
|
||||
After fitting the PCA transformer to the dataset, you can access the principal components using the
|
||||
components_ variable (note that it contains the PCs as horizontal vectors, so, for example, the first
|
||||
principal component is equal to pca.components_.T[:, 0]).
|
||||
|
||||
<p>
|
||||
Another very useful piece of information is the explained variance ratio of each principal component,
|
||||
available via the explained_variance_ratio_ variable. It indicates the proportion of the dataset’s
|
||||
variance that lies along the axis of each principal component. For example, let’s look at the explained
|
||||
variance ratios of the first two components of the 3D dataset represented in Figure 8-2:
|
||||
>>> print(pca.explained_variance_ratio_)
|
||||
array([ 0.84248607, 0.14631839])
|
||||
This tells you that 84.2% of the dataset’s variance lies along the first axis, and 14.6% lies along the
|
||||
second axis. This leaves less than 1.2% for the third axis, so it is reasonable to assume that it probably
|
||||
carries little information.
|
||||
|
||||
<p>
|
||||
Instead of arbitrarily choosing the number of dimensions to reduce down to, it is generally preferable to
|
||||
choose the number of dimensions that add up to a sufficiently large portion of the variance (e.g., 95%).
|
||||
Unless, of course, you are reducing dimensionality for data visualization — in that case you will
|
||||
generally want to reduce the dimensionality down to 2 or 3.
|
||||
The following code computes PCA without reducing dimensionality, then computes the minimum number
|
||||
of dimensions required to preserve 95% of the training set’s variance:
|
||||
pca = PCA()
|
||||
pca.fit(X)
|
||||
cumsum = np.cumsum(pca.explained_variance_ratio_)
|
||||
d = np.argmax(cumsum >= 0.95) + 1
|
||||
You could then set n_components=d and run PCA again. However, there is a much better option: instead
|
||||
of specifying the number of principal components you want to preserve, you can set n_components to be
|
||||
a float between 0.0 and 1.0, indicating the ratio of variance you wish to preserve:
|
||||
pca = PCA(n_components=0.95)
|
||||
X_reduced = pca.fit_transform(X)
|
||||
|
||||
<p>
|
||||
Obviously after dimensionality reduction, the training set takes up much less space. For example, try
|
||||
applying PCA to the MNIST dataset while preserving 95% of its variance. You should find that each
|
||||
instance will have just over 150 features, instead of the original 784 features. So while most of the
|
||||
variance is preserved, the dataset is now less than 20% of its original size! This is a reasonable
|
||||
compression ratio, and you can see how this can speed up a classification algorithm (such as an SVM
|
||||
classifier) tremendously.
|
||||
It is also possible to decompress the reduced dataset back to 784 dimensions by applying the inverse
|
||||
transformation of the PCA projection. Of course this won’t give you back the original data, since the
|
||||
projection lost a bit of information (within the 5% variance that was dropped), but it will likely be quite
|
||||
close to the original data. The mean squared distance between the original data and the reconstructed data
|
||||
(compressed and then decompressed) is called the reconstruction error. For example, the following code
|
||||
compresses the MNIST dataset down to 154 dimensions, then uses the inverse_transform() method to
|
||||
decompress it back to 784 dimensions. Figure 8-9 shows a few digits from the original training set (on the
|
||||
left), and the corresponding digits after compression and decompression. You can see that there is a slight
|
||||
image quality loss, but the digits are still mostly intact.
|
||||
pca = PCA(n_components = 154)
|
||||
X_mnist_reduced = pca.fit_transform(X_mnist)
|
||||
X_mnist_recovered = pca.inverse_transform(X_mnist_reduced)
|
||||
Figure
|
||||
|
||||
<p>
|
||||
Incremental PCA
|
||||
One problem with the preceding implementation of PCA is that it requires the whole training set to fit in
|
||||
memory in order for the SVD algorithm to run. Fortunately, Incremental PCA (IPCA) algorithms have
|
||||
been developed: you can split the training set into mini-batches and feed an IPCA algorithm one minibatch
|
||||
at a time. This is useful for large training sets, and also to apply PCA online (i.e., on the fly, as new
|
||||
instances arrive).
|
||||
The following code splits the MNIST dataset into 100 mini-batches (using NumPy’s array_split()
|
||||
function) and feeds them to Scikit-Learn’s IncrementalPCA class5 to reduce the dimensionality of the
|
||||
MNIST dataset down to 154 dimensions (just like before). Note that you must call the partial_fit()
|
||||
method with each mini-batch rather than the fit() method with the whole training set:
|
||||
from sklearn.decomposition import IncrementalPCA
|
||||
n_batches = 100
|
||||
inc_pca = IncrementalPCA(n_components=154)
|
||||
for X_batch in np.array_split(X_mnist, n_batches):
|
||||
inc_pca.partial_fit(X_batch)
|
||||
X_mnist_reduced = inc_pca.transform(X_mnist)
|
||||
|
||||
<p>
|
||||
Alternatively, you can use NumPy’s memmap class, which allows you to manipulate a large array stored in
|
||||
a binary file on disk as if it were entirely in memory; the class loads only the data it needs in memory,
|
||||
when it needs it. Since the IncrementalPCA class uses only a small part of the array at any given time,
|
||||
the memory usage remains under control. This makes it possible to call the usual fit() method, as you
|
||||
can see in the following code:
|
||||
X_mm = np.memmap(filename, dtype="float32", mode="readonly", shape=(m, n))
|
||||
batch_size = m // n_batches
|
||||
inc_pca = IncrementalPCA(n_components=154, batch_size=batch_size)
|
||||
inc_pca.fit(X_mm)
|
||||
|
||||
<p>
|
||||
Randomized PCA
|
||||
Scikit-Learn offers yet another option to perform PCA, called Randomized PCA. This is a stochastic
|
||||
algorithm that quickly finds an approximation of the first d principal components. Its computational
|
||||
complexity is O(m × d2) + O(d3), instead of O(m × n2) + O(n3), so it is dramatically faster than the
|
||||
previous algorithms when d is much smaller than n.
|
||||
rnd_pca = PCA(n_components=154, svd_solver="randomized")
|
||||
X_reduced = rnd_pca.fit_transform(X_mnist)
|
||||
|
||||
<p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._DimRed-bs001.html">«</a></li>
|
||||
<li><a href="._DimRed-bs000.html">1</a></li>
|
||||
<li><a href="._DimRed-bs001.html">2</a></li>
|
||||
<li class="active"><a href="._DimRed-bs002.html">3</a></li>
|
||||
<li><a href="._DimRed-bs003.html">4</a></li>
|
||||
<li><a href="._DimRed-bs004.html">5</a></li>
|
||||
<li><a href="._DimRed-bs005.html">6</a></li>
|
||||
<li><a href="._DimRed-bs003.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<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: Dimensionality Reduction">
|
||||
|
||||
<title>Data Analysis and Machine Learning: Dimensionality Reduction</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Reducing the number of degrees of freedom, overarching view',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Principal Component Analysis', 2, None, '___sec1'),
|
||||
('Kernel PCA', 2, None, '___sec2'),
|
||||
('LLE', 2, None, '___sec3'),
|
||||
('Other techniques', 2, None, '___sec4')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="DimRed-bs.html">Data Analysis and Machine Learning: Dimensionality Reduction</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<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="._DimRed-bs001.html#___sec0" style="font-size: 80%;">Reducing the number of degrees of freedom, overarching view</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs002.html#___sec1" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec2" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs004.html#___sec3" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs005.html#___sec4" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0003"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec2" class="anchor">Kernel PCA </h2>
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<p> <!-- subsequent paragraphs come in larger fonts, so start with a paragraph -->
|
||||
|
||||
<p>
|
||||
Kernel PCA
|
||||
The kernel trick is a mathematical technique that implicitly maps instances into a
|
||||
very high-dimensional space (called the feature space), enabling nonlinear classification and regression
|
||||
with Support Vector Machines. Recall that a linear decision boundary in the high-dimensional feature
|
||||
space corresponds to a complex nonlinear decision boundary in the original space.
|
||||
It turns out that the same trick can be applied to PCA, making it possible to perform complex nonlinear
|
||||
projections for dimensionality reduction. This is called Kernel PCA (kPCA). It is often good at
|
||||
preserving clusters of instances after projection, or sometimes even unrolling datasets that lie close to a
|
||||
twisted manifold.
|
||||
For example, the following code uses Scikit-Learn’s KernelPCA class to perform kPCA with an
|
||||
from sklearn.decomposition import KernelPCA
|
||||
rbf_pca = KernelPCA(n_components = 2, kernel="rbf", gamma=0.04)
|
||||
X_reduced = rbf_pca.fit_transform(X)
|
||||
Figure 8-
|
||||
|
||||
<p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._DimRed-bs002.html">«</a></li>
|
||||
<li><a href="._DimRed-bs000.html">1</a></li>
|
||||
<li><a href="._DimRed-bs001.html">2</a></li>
|
||||
<li><a href="._DimRed-bs002.html">3</a></li>
|
||||
<li class="active"><a href="._DimRed-bs003.html">4</a></li>
|
||||
<li><a href="._DimRed-bs004.html">5</a></li>
|
||||
<li><a href="._DimRed-bs005.html">6</a></li>
|
||||
<li><a href="._DimRed-bs004.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<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: Dimensionality Reduction">
|
||||
|
||||
<title>Data Analysis and Machine Learning: Dimensionality Reduction</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Reducing the number of degrees of freedom, overarching view',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Principal Component Analysis', 2, None, '___sec1'),
|
||||
('Kernel PCA', 2, None, '___sec2'),
|
||||
('LLE', 2, None, '___sec3'),
|
||||
('Other techniques', 2, None, '___sec4')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="DimRed-bs.html">Data Analysis and Machine Learning: Dimensionality Reduction</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<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="._DimRed-bs001.html#___sec0" style="font-size: 80%;">Reducing the number of degrees of freedom, overarching view</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs002.html#___sec1" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs003.html#___sec2" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec3" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs005.html#___sec4" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0004"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec3" class="anchor">LLE </h2>
|
||||
|
||||
<p>
|
||||
Locally Linear Embedding (LLE)8 is another very powerful nonlinear dimensionality reduction
|
||||
(NLDR) technique. It is a Manifold Learning technique that does not rely on projections like the previous
|
||||
algorithms. In a nutshell, LLE works by first measuring how each training instance linearly relates to its
|
||||
closest neighbors (c.n.), and then looking for a low-dimensional representation of the training set where
|
||||
these local relationships are best preserved (more details shortly). This makes it particularly good at
|
||||
unrolling twisted manifolds, especially when there is not too much noise.
|
||||
|
||||
<p>
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._DimRed-bs003.html">«</a></li>
|
||||
<li><a href="._DimRed-bs000.html">1</a></li>
|
||||
<li><a href="._DimRed-bs001.html">2</a></li>
|
||||
<li><a href="._DimRed-bs002.html">3</a></li>
|
||||
<li><a href="._DimRed-bs003.html">4</a></li>
|
||||
<li class="active"><a href="._DimRed-bs004.html">5</a></li>
|
||||
<li><a href="._DimRed-bs005.html">6</a></li>
|
||||
<li><a href="._DimRed-bs005.html">»</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
@@ -0,0 +1,144 @@
|
||||
<!--
|
||||
Automatically generated HTML file from DocOnce source
|
||||
(https://github.com/hplgit/doconce/)
|
||||
-->
|
||||
<html>
|
||||
<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: Dimensionality Reduction">
|
||||
|
||||
<title>Data Analysis and Machine Learning: Dimensionality Reduction</title>
|
||||
|
||||
<!-- Bootstrap style: bootstrap -->
|
||||
<link href="https://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||
<!-- not necessary
|
||||
<link href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
|
||||
-->
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
/* Add scrollbar to dropdown menus in bootstrap navigation bar */
|
||||
.dropdown-menu {
|
||||
height: auto;
|
||||
max-height: 400px;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Adds an invisible element before each target to offset for the navigation
|
||||
bar */
|
||||
.anchor::before {
|
||||
content:"";
|
||||
display:block;
|
||||
height:50px; /* fixed header height for style bootstrap */
|
||||
margin:-50px 0 0; /* negative fixed header height */
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<!-- tocinfo
|
||||
{'highest level': 2,
|
||||
'sections': [('Reducing the number of degrees of freedom, overarching view',
|
||||
2,
|
||||
None,
|
||||
'___sec0'),
|
||||
('Principal Component Analysis', 2, None, '___sec1'),
|
||||
('Kernel PCA', 2, None, '___sec2'),
|
||||
('LLE', 2, None, '___sec3'),
|
||||
('Other techniques', 2, None, '___sec4')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
|
||||
|
||||
<!-- Bootstrap navigation bar -->
|
||||
<div class="navbar navbar-default navbar-fixed-top">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="DimRed-bs.html">Data Analysis and Machine Learning: Dimensionality Reduction</a>
|
||||
</div>
|
||||
|
||||
<div class="navbar-collapse collapse navbar-responsive-collapse">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<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="._DimRed-bs001.html#___sec0" style="font-size: 80%;">Reducing the number of degrees of freedom, overarching view</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs002.html#___sec1" style="font-size: 80%;">Principal Component Analysis</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs003.html#___sec2" style="font-size: 80%;">Kernel PCA</a></li>
|
||||
<!-- navigation toc: --> <li><a href="._DimRed-bs004.html#___sec3" style="font-size: 80%;">LLE</a></li>
|
||||
<!-- navigation toc: --> <li><a href="#___sec4" style="font-size: 80%;">Other techniques</a></li>
|
||||
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- end of navigation bar -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
<p> </p><p> </p><p> </p> <!-- add vertical space -->
|
||||
|
||||
<a name="part0005"></a>
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec4" class="anchor">Other techniques </h2>
|
||||
|
||||
<p>
|
||||
There are many other dimensionality reduction techniques, several of which are available in Scikit-Learn.
|
||||
Here are some of the most popular:
|
||||
Multidimensional Scaling (MDS) reduces dimensionality while trying to preserve the distances
|
||||
between the instances (see Figure 8-13).
|
||||
Isomap creates a graph by connecting each instance to its nearest neighbors, then reduces
|
||||
dimensionality while trying to preserve the geodesic distances9 between the instances.
|
||||
t-Distributed Stochastic Neighbor Embedding (t-SNE) reduces dimensionality while trying to keep
|
||||
similar instances close and dissimilar instances apart. It is mostly used for visualization, in
|
||||
particular to visualize clusters of instances in high-dimensional space (e.g., to visualize the MNIST
|
||||
images in 2D).
|
||||
Linear Discriminant Analysis (LDA) is actually a classification algorithm, but during training it
|
||||
learns the most discriminative axes between the classes, and these axes can then be used to define a
|
||||
hyperplane onto which to project the data. The benefit is that the projection will keep classes as far
|
||||
apart as possible, so LDA is a good technique to reduce dimensionality before running another
|
||||
classification algorithm such as an SVM classifier
|
||||
|
||||
<p>
|
||||
<!-- navigation buttons at the bottom of the page -->
|
||||
<ul class="pagination">
|
||||
<li><a href="._DimRed-bs004.html">«</a></li>
|
||||
<li><a href="._DimRed-bs000.html">1</a></li>
|
||||
<li><a href="._DimRed-bs001.html">2</a></li>
|
||||
<li><a href="._DimRed-bs002.html">3</a></li>
|
||||
<li><a href="._DimRed-bs003.html">4</a></li>
|
||||
<li><a href="._DimRed-bs004.html">5</a></li>
|
||||
<li class="active"><a href="._DimRed-bs005.html">6</a></li>
|
||||
</ul>
|
||||
<!-- ------------------- end of main content --------------- -->
|
||||
|
||||
</div> <!-- end container -->
|
||||
<!-- include javascript, jQuery *first* -->
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
|
||||
<script src="https://netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script>
|
||||
|
||||
<!-- Bootstrap footer
|
||||
<footer>
|
||||
<a href="http://..."><img width="250" align=right src="http://..."></a>
|
||||
</footer>
|
||||
-->
|
||||
|
||||
|
||||
<center style="font-size:80%">
|
||||
<!-- copyright only on the titlepage -->
|
||||
</center>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
+74
-44
@@ -82,44 +82,45 @@ div { text-align: justify; text-justify: inter-word; }
|
||||
2,
|
||||
None,
|
||||
'___sec4'),
|
||||
('Splines and Gradient methods', 2, None, '___sec5'),
|
||||
('Gradient methods', 2, None, '___sec5'),
|
||||
('Regression Methods', 2, None, '___sec6'),
|
||||
('Logistic Regression', 2, None, '___sec7'),
|
||||
('Neural Networks', 2, None, '___sec8'),
|
||||
('Elements of Bayesian theory', 2, None, '___sec9'),
|
||||
('Reduction of dimensionality', 2, None, '___sec9'),
|
||||
('Elements of Bayesian theory', 2, None, '___sec10'),
|
||||
('Decision trees, from simple to random ones',
|
||||
2,
|
||||
None,
|
||||
'___sec10'),
|
||||
('Support Vector Machines', 2, None, '___sec11'),
|
||||
'___sec11'),
|
||||
('Support Vector Machines', 2, None, '___sec12'),
|
||||
('Unsupervised Learning, Boltzmann Machines',
|
||||
2,
|
||||
None,
|
||||
'___sec12'),
|
||||
('Python and Scikit Learn, a short guide', 2, None, '___sec13'),
|
||||
('Teach yourself C++', 2, None, '___sec14'),
|
||||
('Projects and Exercises Fall 2018', 2, None, '___sec15'),
|
||||
('First homework set, week 35', 3, None, '___sec16'),
|
||||
('Second homework set, week 36', 3, None, '___sec17'),
|
||||
('Project 1, Deadline October 1', 3, None, '___sec18'),
|
||||
('Project 2, Deadline November 5', 3, None, '___sec19'),
|
||||
('Project 3, Deadline November 30', 3, None, '___sec20'),
|
||||
('Course content', 3, None, '___sec21'),
|
||||
('Learning outcomes', 2, None, '___sec22'),
|
||||
('Prerequisites', 2, None, '___sec23'),
|
||||
('The course has two central parts', 2, None, '___sec24'),
|
||||
'___sec13'),
|
||||
('Python and Scikit Learn, a short guide', 2, None, '___sec14'),
|
||||
('Teach yourself C++', 2, None, '___sec15'),
|
||||
('Projects and Exercises Fall 2018', 2, None, '___sec16'),
|
||||
('First homework set, week 35', 3, None, '___sec17'),
|
||||
('Second homework set, week 36', 3, None, '___sec18'),
|
||||
('Project 1, Deadline October 1', 3, None, '___sec19'),
|
||||
('Project 2, Deadline November 5', 3, None, '___sec20'),
|
||||
('Project 3, Deadline November 30', 3, None, '___sec21'),
|
||||
('Course content', 3, None, '___sec22'),
|
||||
('Learning outcomes', 2, None, '___sec23'),
|
||||
('Prerequisites', 2, None, '___sec24'),
|
||||
('The course has two central parts', 2, None, '___sec25'),
|
||||
('Statistical analysis and optimization of data',
|
||||
3,
|
||||
None,
|
||||
'___sec25'),
|
||||
('Machine learning', 3, None, '___sec26'),
|
||||
('Recommended textbooks', 2, None, '___sec27'),
|
||||
'___sec26'),
|
||||
('Machine learning', 3, None, '___sec27'),
|
||||
('Recommended textbooks', 2, None, '___sec28'),
|
||||
('"Other '
|
||||
'textbooks":"https://github.com/CompPhysics/MachineLearning/tree/master/doc/Textbooks"',
|
||||
2,
|
||||
None,
|
||||
'___sec28'),
|
||||
('Teaching schedule Fall 2018', 2, None, '___sec29')]}
|
||||
'___sec29'),
|
||||
('Teaching schedule Fall 2018', 2, None, '___sec30')]}
|
||||
end of tocinfo -->
|
||||
|
||||
<body>
|
||||
@@ -327,7 +328,7 @@ formulas in HTML or ipython notebook files.
|
||||
|
||||
</ul>
|
||||
|
||||
<h2 id="___sec5">Splines and Gradient methods </h2>
|
||||
<h2 id="___sec5">Gradient methods </h2>
|
||||
|
||||
<ul>
|
||||
<li> LaTeX PDF:</li>
|
||||
@@ -443,7 +444,36 @@ formulas in HTML or ipython notebook files.
|
||||
|
||||
</ul>
|
||||
|
||||
<h2 id="___sec9">Elements of Bayesian theory </h2>
|
||||
<h2 id="___sec9">Reduction of dimensionality </h2>
|
||||
|
||||
<ul>
|
||||
<li> LaTeX PDF:</li>
|
||||
|
||||
<ul>
|
||||
<li> For printing:</li>
|
||||
|
||||
<ul>
|
||||
<li> <a href="https://compphysics.github.io/MachineLearning/doc/pub/DimRed/pdf/DimRed-minted.pdf" target="_self">Standard one-page format</a></li>
|
||||
</ul>
|
||||
|
||||
</ul>
|
||||
|
||||
<li> HTML:</li>
|
||||
|
||||
<ul>
|
||||
<li> <a href="https://compphysics.github.io/MachineLearning/doc/pub/DimRed/html/DimRed.html" target="_self">Plain html</a></li>
|
||||
<li> <a href="https://compphysics.github.io/MachineLearning/doc/pub/DimRed/html/DimRed-bs.html" target="_self">Bootstrap slide style, easy for reading on mobile devices</a></li>
|
||||
</ul>
|
||||
|
||||
<li> Jupyter notebook:</li>
|
||||
|
||||
<ul>
|
||||
<li> <a href="https://compphysics.github.io/MachineLearning/doc/pub/DimRed/ipynb/DimRed.ipynb" target="_self">ipynb file</a></li>
|
||||
</ul>
|
||||
|
||||
</ul>
|
||||
|
||||
<h2 id="___sec10">Elements of Bayesian theory </h2>
|
||||
|
||||
<ul>
|
||||
<li> LaTeX PDF:</li>
|
||||
@@ -472,7 +502,7 @@ formulas in HTML or ipython notebook files.
|
||||
|
||||
</ul>
|
||||
|
||||
<h2 id="___sec10">Decision trees, from simple to random ones </h2>
|
||||
<h2 id="___sec11">Decision trees, from simple to random ones </h2>
|
||||
|
||||
<ul>
|
||||
<li> LaTeX PDF:</li>
|
||||
@@ -501,7 +531,7 @@ formulas in HTML or ipython notebook files.
|
||||
|
||||
</ul>
|
||||
|
||||
<h2 id="___sec11">Support Vector Machines </h2>
|
||||
<h2 id="___sec12">Support Vector Machines </h2>
|
||||
|
||||
<ul>
|
||||
<li> LaTeX PDF:</li>
|
||||
@@ -530,7 +560,7 @@ formulas in HTML or ipython notebook files.
|
||||
|
||||
</ul>
|
||||
|
||||
<h2 id="___sec12">Unsupervised Learning, Boltzmann Machines </h2>
|
||||
<h2 id="___sec13">Unsupervised Learning, Boltzmann Machines </h2>
|
||||
|
||||
<ul>
|
||||
<li> LaTeX PDF:</li>
|
||||
@@ -561,7 +591,7 @@ formulas in HTML or ipython notebook files.
|
||||
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec13">Python and Scikit Learn, a short guide </h2>
|
||||
<h2 id="___sec14">Python and Scikit Learn, a short guide </h2>
|
||||
|
||||
<ul>
|
||||
<li> HTML format only:</li>
|
||||
@@ -574,7 +604,7 @@ formulas in HTML or ipython notebook files.
|
||||
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec14">Teach yourself C++ </h2>
|
||||
<h2 id="___sec15">Teach yourself C++ </h2>
|
||||
|
||||
<ul>
|
||||
<li> HTML format only:</li>
|
||||
@@ -587,9 +617,9 @@ formulas in HTML or ipython notebook files.
|
||||
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec15">Projects and Exercises Fall 2018 </h2>
|
||||
<h2 id="___sec16">Projects and Exercises Fall 2018 </h2>
|
||||
|
||||
<h3 id="___sec16">First homework set, week 35 </h3>
|
||||
<h3 id="___sec17">First homework set, week 35 </h3>
|
||||
|
||||
<ul>
|
||||
<li> LaTeX and PDF:</li>
|
||||
@@ -608,7 +638,7 @@ formulas in HTML or ipython notebook files.
|
||||
|
||||
</ul>
|
||||
|
||||
<h3 id="___sec17">Second homework set, week 36 </h3>
|
||||
<h3 id="___sec18">Second homework set, week 36 </h3>
|
||||
|
||||
<ul>
|
||||
<li> LaTeX and PDF:</li>
|
||||
@@ -627,7 +657,7 @@ formulas in HTML or ipython notebook files.
|
||||
|
||||
</ul>
|
||||
|
||||
<h3 id="___sec18">Project 1, Deadline October 1 </h3>
|
||||
<h3 id="___sec19">Project 1, Deadline October 1 </h3>
|
||||
|
||||
<ul>
|
||||
<li> LaTeX and PDF:</li>
|
||||
@@ -646,7 +676,7 @@ formulas in HTML or ipython notebook files.
|
||||
|
||||
</ul>
|
||||
|
||||
<h3 id="___sec19">Project 2, Deadline November 5 </h3>
|
||||
<h3 id="___sec20">Project 2, Deadline November 5 </h3>
|
||||
|
||||
<ul>
|
||||
<li> LaTeX and PDF:</li>
|
||||
@@ -665,7 +695,7 @@ formulas in HTML or ipython notebook files.
|
||||
|
||||
</ul>
|
||||
|
||||
<h3 id="___sec20">Project 3, Deadline November 30 </h3>
|
||||
<h3 id="___sec21">Project 3, Deadline November 30 </h3>
|
||||
|
||||
<ul>
|
||||
<li> LaTeX and PDF:</li>
|
||||
@@ -684,7 +714,7 @@ formulas in HTML or ipython notebook files.
|
||||
|
||||
</ul>
|
||||
|
||||
<h3 id="___sec21">Course content </h3>
|
||||
<h3 id="___sec22">Course content </h3>
|
||||
|
||||
<p>
|
||||
Probability theory and statistical methods play a central role in science. Nowadays we are
|
||||
@@ -703,7 +733,7 @@ tools of probability theory, the aim of this course is to expose you to central
|
||||
This course covers thus topics like Monte Carlo methods and Markov chains, Bayesian statistics, error estimates, various linear methods, optimization of data and error analysis and central algorithms in machine learning.
|
||||
The course has several numerical projects and numerical exercises that are meant to illustrate the theory.
|
||||
|
||||
<h2 id="___sec22">Learning outcomes </h2>
|
||||
<h2 id="___sec23">Learning outcomes </h2>
|
||||
|
||||
<p>
|
||||
The course introduces a variety of central algorithms and methods
|
||||
@@ -720,19 +750,19 @@ essential for studies of data analysis and machine learning. The course is proje
|
||||
<li> Work on numerical projects to illustrate the theory. The projects play a central role and students are expected to know modern programming languages like Python or C++.</li>
|
||||
</ul>
|
||||
|
||||
<h2 id="___sec23">Prerequisites </h2>
|
||||
<h2 id="___sec24">Prerequisites </h2>
|
||||
|
||||
<p>
|
||||
Basic knowledge in programming and numerics. Required courses are the equivalents to the University of Oslo mathematics courses MAT1100, MAT1110, MAT1120 and at least one of the corresponding computing and programming courses INF1000/INF1110 or MAT-INF1100/MAT-INF1100L/BIOS1100/KJM-INF1xxx.
|
||||
|
||||
<h2 id="___sec24">The course has two central parts </h2>
|
||||
<h2 id="___sec25">The course has two central parts </h2>
|
||||
|
||||
<ol>
|
||||
<li> Statistical analysis and optimization of data</li>
|
||||
<li> Machine learning</li>
|
||||
</ol>
|
||||
|
||||
<h3 id="___sec25">Statistical analysis and optimization of data </h3>
|
||||
<h3 id="___sec26">Statistical analysis and optimization of data </h3>
|
||||
|
||||
<p>
|
||||
The following topics will be covered
|
||||
@@ -749,7 +779,7 @@ The following topics will be covered
|
||||
<li> Practical optimization using Singular-value decomposition and least squares for parameterizing data.</li>
|
||||
</ul>
|
||||
|
||||
<h3 id="___sec26">Machine learning </h3>
|
||||
<h3 id="___sec27">Machine learning </h3>
|
||||
|
||||
<p>
|
||||
The following topics will be covered
|
||||
@@ -765,14 +795,14 @@ The following topics will be covered
|
||||
|
||||
All the above topics will be supported by examples, hands-on exercises and project work.
|
||||
|
||||
<h2 id="___sec27">Recommended textbooks </h2>
|
||||
<h2 id="___sec28">Recommended textbooks </h2>
|
||||
|
||||
<ul>
|
||||
<li> <a href="https://www.springer.com/gp/book/9780387848570" target="_self">Trevor Hastie, Robert Tibshirani, Jerome H. Friedman, The Elements of Statistical Learning, Springer</a></li>
|
||||
<li> <a href="http://shop.oreilly.com/product/0636920052289.do" target="_self">Aurelien Geron, Hands‑On Machine Learning with Scikit‑Learn and TensorFlow, O'Reilly</a></li>
|
||||
</ul>
|
||||
|
||||
<h2 id="___sec28"><a href="https://github.com/CompPhysics/MachineLearning/tree/master/doc/Textbooks" target="_self">Other textbooks</a> </h2>
|
||||
<h2 id="___sec29"><a href="https://github.com/CompPhysics/MachineLearning/tree/master/doc/Textbooks" target="_self">Other textbooks</a> </h2>
|
||||
|
||||
<p>
|
||||
<b>General learning book on statistical analysis</b>:
|
||||
@@ -794,7 +824,7 @@ All the above topics will be supported by examples, hands-on exercises and proje
|
||||
|
||||
<!-- !split -->
|
||||
|
||||
<h2 id="___sec29">Teaching schedule Fall 2018 </h2>
|
||||
<h2 id="___sec30">Teaching schedule Fall 2018 </h2>
|
||||
|
||||
<p>
|
||||
Acronyms for textbooks and references to chapter
|
||||
|
||||
Reference in New Issue
Block a user