updated intro

This commit is contained in:
mhjensen
2019-06-10 22:48:38 -04:00
parent 3fdabd3871
commit eb4a233c9d
47 changed files with 1830 additions and 3411 deletions
+68 -57
View File
@@ -6,6 +6,7 @@ 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="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Introduction to Applied Data Analysis and Machine Learning">
<title>Introduction to Applied Data Analysis and Machine Learning</title>
@@ -107,7 +108,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>May 28, 2018</h4></center> <!-- date -->
<center><h4>Jun 10, 2019</h4></center> <!-- date -->
<br>
<p>
</div> <!-- end jumbotron -->
@@ -115,14 +116,25 @@ end of tocinfo -->
<h2 id="___sec0" class="anchor">Introduction </h2>
<p>
Statistics, data science and machine learning form important fields of
research in modern science. They describe how to learn and make
predictions from data, as well as allowing us to extract important
correlations about physical process and the underlying laws of motion
in large data sets. The latter, big data sets, appear frequently in
essentially all disciplines, from the traditional Science, Technology,
Mathematics and Engineering fields to Life Science, Law, education
research, the Humanities and the Social Sciences.
During the last two decades there has been a swift and amazing
development of Machine Learning techniques and algorithms that impact
many areas in not only Science and Technology but also the Humanities,
Social Sciences, Medicine, Law, indeed, almost all possible
disciplines. The applications are incredibly many, from self-driving
cars to solving high-dimensional differential equations or complicated
quantum mechanical many-body problems. Machine Learning is perceived
by many as one of the main disruptive techniques nowadays.
<p>
Statistics, Data science and Machine Learning form important
fields of research in modern science. They describe how to learn and
make predictions from data, as well as allowing us to extract
important correlations about physical process and the underlying laws
of motion in large data sets. The latter, big data sets, appear
frequently in essentially all disciplines, from the traditional
Science, Technology, Mathematics and Engineering fields to Life
Science, Law, education research, the Humanities and the Social
Sciences.
<p>
It has become more
@@ -188,7 +200,7 @@ of algorithms and methods we will discuss.
<h2 id="___sec1" class="anchor">Learning outcomes </h2>
<p>
These setsof lectures aim at giving you an overview of central aspects of
These sets of lectures aim at giving you an overview of central aspects of
statistical data analysis as well as some of the central algorithms
used in machine learning. We will introduce a variety of central
algorithms and methods essential for studies of data analysis and
@@ -197,17 +209,17 @@ machine learning.
<p>
Hands-on projects and experimenting with data and algorithms plays a central role in
these lectures, and our hope is, through the various
projects and exercies, to expose you to fundamental
projects and exercises, to expose you to fundamental
research problems in these fields, with the aim to reproduce state of
the art scientific results. You will learn to develop and
structure large codes for studying these systems, get acquainted with
structure codes for studying these systems, get acquainted with
computing facilities and learn to handle large scientific projects. A
good scientific and ethical conduct is emphasized throughout the
course. More specifically, you will
<ol>
<li> learn about basic data analysis, Bayesian statistics, Monte Carlo methods, data optimization and machine learning;</li>
<li> be capable of extending the acquired knowledge to other systems and cases;</li>
<li> Learn about basic data analysis, Bayesian statistics, Monte Carlo methods, data optimization and machine learning;</li>
<li> Be capable of extending the acquired knowledge to other systems and cases;</li>
<li> Have an understanding of central algorithms used in data analysis and machine learning;</li>
<li> Gain knowledge of central aspects of Monte Carlo methods, Markov chains, Gibbs samplers and their possible applications, from numerical integration to simulation of stock markets;</li>
<li> Understand methods for regression and classification;</li>
@@ -215,16 +227,16 @@ course. More specifically, you will
<li> Work on numerical projects to illustrate the theory. The projects play a central role and you are expected to know modern programming languages like Python or C++, in addition to a basic knowledge of linear algebra (typically taught during the first one or two years of undergraduate studies).</li>
</ol>
There are several topics we will cover here, spanning from a
statistical data analysis and its basic concepts such expectation
There are several topics we will cover here, spanning from
statistical data analysis and its basic concepts such as expectation
values, variance, covariance, correlation functions and errors, via
well-known probability distribution functions like uniform
well-known probability distribution functions like the uniform
distribution, the binomial distribution, the Poisson distribution and
simple and multivariate normal distributions to central elements of
Bayesian statistics and modeling. We will also remind the reader about
central elements from linear algebra and standard methods based on
linear algebra used to fit functions such Cubic splines and gradient
methods for data optimization and the Singular-value decomposition and
linear algebra used to optimize (minimize) functions (the family of gradient descent methods)
and the Singular-value decomposition and
least square methods for parameterizing data.
<p>
@@ -232,8 +244,8 @@ We will also cover Monte Carlo methods, Markov chains, well-known
algorithms for sampling stochastic events like the Metropolis-Hastings
and Gibbs sampling methods. An important aspect of all our
calculations is a proper estimation of errors. Here we will also
discuss famous resampling techniques like the blocking, bootstrapping
and jackknife methods.
discuss famous resampling techniques like the blocking, the bootstrapping
and the jackknife methods and the infamous bias-variance tradeoff.
<p>
The second part of the material covers several algorithms used in
@@ -265,8 +277,12 @@ desired output of a system. Some of the most common tasks are:
The methods we cover have three main topics in common, irrespective of
whether we deal with supervised or unsupervised learning. The first
ingredient is normally our data set (which can be subdivided into
training and test data), the second item is a model which is normally a
function of some parameters. The model reflects our knowledge of the system (or lack thereof). As an example, if we know that our data show a behavior similar to what would be predicted by a polynomial, fitting our data to a polynomial of some degree would then determin our model.
training and test data), the second item is a model which is normally
a function of some parameters. The model reflects our knowledge of
the system (or lack thereof). As an example, if we know that our data
show a behavior similar to what would be predicted by a polynomial,
fitting our data to a polynomial of some degree would then determin
our model.
<p>
The last ingredient is a so-called <b>cost</b>
@@ -280,12 +296,11 @@ analysis, stochastic processes etc. We will discuss the following
machine learning algorithms
<ol>
<li> Linear regression and its variants, in essence polynomial regression</li>
<li> Decision tree algorithms, from simpler to more complex ones</li>
<li> Nearest neighbors models</li>
<li> Linear regression and its variants</li>
<li> Decision tree algorithms, from single trees to random forests</li>
<li> Bayesian statistics and regression</li>
<li> Support vector machines and finally various variants of</li>
<li> Artifical neural networks and deep learning</li>
<li> Artifical neural networks and deep learning, including convolutional neural networks and Bayesian neural networks</li>
<li> Networks for unsupervised learning using for example reduced Boltzmann machines.</li>
</ol>
@@ -294,21 +309,16 @@ machine learning algorithms
<p>
Python plays nowadays a central role in the development of machine
learning techniques and tools for data analysis. In particular, seen
the wealth of machine learning and data analysis packages written in
the wealth of machine learning and data analysis libraries written in
Python, easy to use libraries with immediate visualization(and not the
least impressive galleries of existing example), the popularity of the
least impressive galleries of existing examples), the popularity of the
Jupyter notebook framework with the possibility to run <b>R</b> codes or
compiled programs written in C++, and much more made our choice of
programming language for this series of lectures of easy. However,
since the focus here is not only on using existing Python tools such
as <b>scikit-learn</b> or <b>tensorflow</b>, but also on developing your own
programming language for this series of lectures easy. However,
since the focus here is not only on using existing Python libraries such
as <b>Scikit-Learn</b> or <b>Tensorflow</b>, but also on developing your own
algorithms and codes, we will as far as possible present many of these
algorithms eithers a Python codes or C++ codes. Finally, we will, as
far as possible keep parallel versions of the data analysis and
machine larning programming aspects in <b>R</b> as
well. <a href="https://www.r-project.org/" target="_self">R</a> is a language and environment
for statistical computing and graphics which is widely used in
statistics and mathematics applications.
algorithms either as a Python codes or C++ or Fortran (or other languages) codes.
<p>
The reason we also focus on compiled languages like C++ (or
@@ -317,7 +327,7 @@ utilize highly streamlined computational libraries like
<a href="http://www.netlib.org/lapack/" target="_self">Lapack</a> or other numerical libraries
written in compiled languages (many of these libraries are written in
Fortran). Although a project like <a href="https://numba.pydata.org/" target="_self">Numba</a>
holds great promise for speeding up the unrolling of lengthy loops, C+
holds great promise for speeding up the unrolling of lengthy loops, C++
and Fortran are presently still the performance winners. Numba gives
you potentially the power to speed up your applications with high
performance functions written directly in Python. In particular,
@@ -340,7 +350,7 @@ existing data files or provide code examples which produce the data to
be analyzed. Most of the applications we will discuss deal with
small data sets (less than a terabyte of information) and can easily
be analyzed and tested on standard off the shelf laptops you find in general
grocery stores.
stores.
<h2 id="___sec4" class="anchor">Data handling, machine learning and ethical aspects </h2>
@@ -348,7 +358,7 @@ grocery stores.
In most of the cases we will study, we will either generate the data
to analyze ourselves (both for supervised learning and unsupervised
learning) or we will recur again and again to data present in say
<b>scikit-learn</b> or <b>tensorflow</b>. Many of the examples we end up
<b>Scikit-Learn</b> or <b>Tensorflow</b>. Many of the examples we end up
dealing with are from a privacy and data protection point of view,
rather inoccuous and boring results of numerical
calculations. However, this does not hinder us from developing a sound
@@ -364,7 +374,7 @@ repositories like <a href="https://github.com/" target="_self">Github</a>,
and data sets we have used, freely and easily accessible to a wider
community. This helps us almost automagically in making our science
reproducible. The large open-source development communities involved
in say <a href="http://scikit-learn.org/stable/" target="_self">Scikit-learn</a>,
in say <a href="http://scikit-learn.org/stable/" target="_self">Scikit-Learn</a>,
<a href="https://www.tensorflow.org/" target="_self">Tensorflow</a>,
<a href="http://pytorch.org/" target="_self">PyTorch</a> and <a href="https://keras.io/" target="_self">Keras</a>, are
all excellent examples of this. The codes can be tested and improved
@@ -373,13 +383,13 @@ developing data analysis and machine learning tools. It is much
easier today to gain traction and acceptance for making your science
reproducible. From a societal stand, this is an important element
since many of the developers are employees of large public institutions like
universities and research labs. Our taxpayer do deserve to get
universities and research labs. Our fellow taxpayers do deserve to get
something back for their bucks.
<p>
However, this more mechanical aspect of the ethics of science (in
particular the reproducibility of scientific results) is something
which is obvious and everybody should do as part of the dialectics of
which is obvious and everybody should do so as part of the dialectics of
science. The fact that many scientists are not willing to share their codes or
data is detrimental to the scientific discourse.
@@ -387,11 +397,11 @@ data is detrimental to the scientific discourse.
Before we proceed, we should add a disclaimer. Even though
we may dream of computers developing some kind of higher learning
capabilities, at the end (even if the artificial intelligence
community keeps touting our ears full of fancy futuristic avenues), it is we
community keeps touting our ears full of fancy futuristic avenues), it is we, yes you reading these lines,
who end up constructing and instructing, via various algorithms, the
computers. Self-driving cars for example, rely on sofisticated
machine learning approaches. Self-driving cars for example, rely on sofisticated
programs which take into account all possible situations a car can
encounter. In addition, extensive usage of training datas from GPS
encounter. In addition, extensive usage of training data from GPS
information, maps etc, are typically fed into the software for
self-driving cars. Adding to this various sensors and cameras that
feed information to the programs, there are zillions of ethical issues
@@ -402,8 +412,8 @@ For self-driving cars, where basically many of the standard machine
learning algorithms discussed here enter into the codes, at a certain
stage we have to make choices. Yes, we , the lads and lasses who wrote
a program for a specific brand of a self-driving car. As an example,
a most carmakers have as their utmost priority the security of the
driver and the accompanying passengers. A famous carmaker, which is
all carmakers have as their utmost priority the security of the
driver and the accompanying passengers. A famous European carmaker, which is
one of the leaders in the market of self-driving cars, had <b>if</b>
statements of the following type: suppose there are two obstacles in
front of you and you cannot avoid to collide with one of them. One of
@@ -414,9 +424,9 @@ the likelihood of surving a collision with our future citizens, is
much higher.
<p>
This brings us leads then to serious ethical aspects. Why should we
This leads to serious ethical aspects. Why should we
opt for such an option? Who decides and who is entitled to make such
choices? Keep in mind that many of the algorithms you will about in
choices? Keep in mind that many of the algorithms you will encounter in
this series of lectures or hear about later, are indeed based on
simple programming instructions. And you are very likely to be one of
the people who may end up writing such a code. Thus, developing a
@@ -429,15 +439,16 @@ not weighting some data in a particular way, perhaps because you dearly want a
specific conclusion which may support your political views?
<p>
We do not have the answers here, but we want you think over these
topics in a more overarching way. A statistical data analysis with
its dry numbers and graphs meant to guide the eye, do not necessarily
We do not have the answers here, nor will we venture into a deeper
discussions of these aspects, but we want you think over these topics
in a more overarching way. A statistical data analysis with its dry
numbers and graphs meant to guide the eye, does not necessarily
reflect the truth, whatever that is. As a scientist, and after a
university education, you are supposedly a better citizen, with an
improved critical view and understanding of the scientific method, and
perhaps some deeper understandings of the ethics of science at
perhaps some deeper understanding of the ethics of science at
large. Use these insights. Be a critical citizen. You owe it to our
societies.
society.
<p>
To do: Add references and acknowledgements
@@ -457,7 +468,7 @@ To do: Add references and acknowledgements
<center style="font-size:80%">
<!-- copyright --> &copy; 1999-2018, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
<!-- copyright --> &copy; 1999-2019, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
</center>
@@ -1,8 +1,8 @@
\
<!DOCTYPE html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="DocOnce: https://github.com/hplgit/doconce/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Introduction to Applied Data Analysis and Machine Learning">
<title>Introduction to Applied Data Analysis and Machine Learning</title>
@@ -132,20 +132,31 @@ 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>May 28, 2018</h4></center> <!-- date -->
<center><h4>Jun 10, 2019</h4></center> <!-- date -->
<br>
<h2 id="___sec0">Introduction </h2>
<p>
Statistics, data science and machine learning form important fields of
research in modern science. They describe how to learn and make
predictions from data, as well as allowing us to extract important
correlations about physical process and the underlying laws of motion
in large data sets. The latter, big data sets, appear frequently in
essentially all disciplines, from the traditional Science, Technology,
Mathematics and Engineering fields to Life Science, Law, education
research, the Humanities and the Social Sciences.
During the last two decades there has been a swift and amazing
development of Machine Learning techniques and algorithms that impact
many areas in not only Science and Technology but also the Humanities,
Social Sciences, Medicine, Law, indeed, almost all possible
disciplines. The applications are incredibly many, from self-driving
cars to solving high-dimensional differential equations or complicated
quantum mechanical many-body problems. Machine Learning is perceived
by many as one of the main disruptive techniques nowadays.
<p>
Statistics, Data science and Machine Learning form important
fields of research in modern science. They describe how to learn and
make predictions from data, as well as allowing us to extract
important correlations about physical process and the underlying laws
of motion in large data sets. The latter, big data sets, appear
frequently in essentially all disciplines, from the traditional
Science, Technology, Mathematics and Engineering fields to Life
Science, Law, education research, the Humanities and the Social
Sciences.
<p>
It has become more
@@ -208,7 +219,7 @@ of algorithms and methods we will discuss.
<p>
<center style="font-size:80%">
<!-- copyright --> &copy; 1999-2018, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
<!-- copyright --> &copy; 1999-2019, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
</center>
</section>
@@ -217,7 +228,7 @@ of algorithms and methods we will discuss.
<h2 id="___sec1">Learning outcomes </h2>
<p>
These setsof lectures aim at giving you an overview of central aspects of
These sets of lectures aim at giving you an overview of central aspects of
statistical data analysis as well as some of the central algorithms
used in machine learning. We will introduce a variety of central
algorithms and methods essential for studies of data analysis and
@@ -226,17 +237,17 @@ machine learning.
<p>
Hands-on projects and experimenting with data and algorithms plays a central role in
these lectures, and our hope is, through the various
projects and exercies, to expose you to fundamental
projects and exercises, to expose you to fundamental
research problems in these fields, with the aim to reproduce state of
the art scientific results. You will learn to develop and
structure large codes for studying these systems, get acquainted with
structure codes for studying these systems, get acquainted with
computing facilities and learn to handle large scientific projects. A
good scientific and ethical conduct is emphasized throughout the
course. More specifically, you will
<ol>
<p><li> learn about basic data analysis, Bayesian statistics, Monte Carlo methods, data optimization and machine learning;</li>
<p><li> be capable of extending the acquired knowledge to other systems and cases;</li>
<p><li> Learn about basic data analysis, Bayesian statistics, Monte Carlo methods, data optimization and machine learning;</li>
<p><li> Be capable of extending the acquired knowledge to other systems and cases;</li>
<p><li> Have an understanding of central algorithms used in data analysis and machine learning;</li>
<p><li> Gain knowledge of central aspects of Monte Carlo methods, Markov chains, Gibbs samplers and their possible applications, from numerical integration to simulation of stock markets;</li>
<p><li> Understand methods for regression and classification;</li>
@@ -245,16 +256,16 @@ course. More specifically, you will
</ol>
<p>
There are several topics we will cover here, spanning from a
statistical data analysis and its basic concepts such expectation
There are several topics we will cover here, spanning from
statistical data analysis and its basic concepts such as expectation
values, variance, covariance, correlation functions and errors, via
well-known probability distribution functions like uniform
well-known probability distribution functions like the uniform
distribution, the binomial distribution, the Poisson distribution and
simple and multivariate normal distributions to central elements of
Bayesian statistics and modeling. We will also remind the reader about
central elements from linear algebra and standard methods based on
linear algebra used to fit functions such Cubic splines and gradient
methods for data optimization and the Singular-value decomposition and
linear algebra used to optimize (minimize) functions (the family of gradient descent methods)
and the Singular-value decomposition and
least square methods for parameterizing data.
<p>
@@ -262,8 +273,8 @@ We will also cover Monte Carlo methods, Markov chains, well-known
algorithms for sampling stochastic events like the Metropolis-Hastings
and Gibbs sampling methods. An important aspect of all our
calculations is a proper estimation of errors. Here we will also
discuss famous resampling techniques like the blocking, bootstrapping
and jackknife methods.
discuss famous resampling techniques like the blocking, the bootstrapping
and the jackknife methods and the infamous bias-variance tradeoff.
<p>
The second part of the material covers several algorithms used in
@@ -299,8 +310,12 @@ desired output of a system. Some of the most common tasks are:
The methods we cover have three main topics in common, irrespective of
whether we deal with supervised or unsupervised learning. The first
ingredient is normally our data set (which can be subdivided into
training and test data), the second item is a model which is normally a
function of some parameters. The model reflects our knowledge of the system (or lack thereof). As an example, if we know that our data show a behavior similar to what would be predicted by a polynomial, fitting our data to a polynomial of some degree would then determin our model.
training and test data), the second item is a model which is normally
a function of some parameters. The model reflects our knowledge of
the system (or lack thereof). As an example, if we know that our data
show a behavior similar to what would be predicted by a polynomial,
fitting our data to a polynomial of some degree would then determin
our model.
<p>
The last ingredient is a so-called <b>cost</b>
@@ -314,12 +329,11 @@ analysis, stochastic processes etc. We will discuss the following
machine learning algorithms
<ol>
<p><li> Linear regression and its variants, in essence polynomial regression</li>
<p><li> Decision tree algorithms, from simpler to more complex ones</li>
<p><li> Nearest neighbors models</li>
<p><li> Linear regression and its variants</li>
<p><li> Decision tree algorithms, from single trees to random forests</li>
<p><li> Bayesian statistics and regression</li>
<p><li> Support vector machines and finally various variants of</li>
<p><li> Artifical neural networks and deep learning</li>
<p><li> Artifical neural networks and deep learning, including convolutional neural networks and Bayesian neural networks</li>
<p><li> Networks for unsupervised learning using for example reduced Boltzmann machines.</li>
</ol>
@@ -328,21 +342,16 @@ machine learning algorithms
<p>
Python plays nowadays a central role in the development of machine
learning techniques and tools for data analysis. In particular, seen
the wealth of machine learning and data analysis packages written in
the wealth of machine learning and data analysis libraries written in
Python, easy to use libraries with immediate visualization(and not the
least impressive galleries of existing example), the popularity of the
least impressive galleries of existing examples), the popularity of the
Jupyter notebook framework with the possibility to run <b>R</b> codes or
compiled programs written in C++, and much more made our choice of
programming language for this series of lectures of easy. However,
since the focus here is not only on using existing Python tools such
as <b>scikit-learn</b> or <b>tensorflow</b>, but also on developing your own
programming language for this series of lectures easy. However,
since the focus here is not only on using existing Python libraries such
as <b>Scikit-Learn</b> or <b>Tensorflow</b>, but also on developing your own
algorithms and codes, we will as far as possible present many of these
algorithms eithers a Python codes or C++ codes. Finally, we will, as
far as possible keep parallel versions of the data analysis and
machine larning programming aspects in <b>R</b> as
well. <a href="https://www.r-project.org/" target="_blank">R</a> is a language and environment
for statistical computing and graphics which is widely used in
statistics and mathematics applications.
algorithms either as a Python codes or C++ or Fortran (or other languages) codes.
<p>
The reason we also focus on compiled languages like C++ (or
@@ -351,7 +360,7 @@ utilize highly streamlined computational libraries like
<a href="http://www.netlib.org/lapack/" target="_blank">Lapack</a> or other numerical libraries
written in compiled languages (many of these libraries are written in
Fortran). Although a project like <a href="https://numba.pydata.org/" target="_blank">Numba</a>
holds great promise for speeding up the unrolling of lengthy loops, C+
holds great promise for speeding up the unrolling of lengthy loops, C++
and Fortran are presently still the performance winners. Numba gives
you potentially the power to speed up your applications with high
performance functions written directly in Python. In particular,
@@ -374,7 +383,7 @@ existing data files or provide code examples which produce the data to
be analyzed. Most of the applications we will discuss deal with
small data sets (less than a terabyte of information) and can easily
be analyzed and tested on standard off the shelf laptops you find in general
grocery stores.
stores.
<h2 id="___sec4">Data handling, machine learning and ethical aspects </h2>
@@ -382,7 +391,7 @@ grocery stores.
In most of the cases we will study, we will either generate the data
to analyze ourselves (both for supervised learning and unsupervised
learning) or we will recur again and again to data present in say
<b>scikit-learn</b> or <b>tensorflow</b>. Many of the examples we end up
<b>Scikit-Learn</b> or <b>Tensorflow</b>. Many of the examples we end up
dealing with are from a privacy and data protection point of view,
rather inoccuous and boring results of numerical
calculations. However, this does not hinder us from developing a sound
@@ -398,7 +407,7 @@ repositories like <a href="https://github.com/" target="_blank">Github</a>,
and data sets we have used, freely and easily accessible to a wider
community. This helps us almost automagically in making our science
reproducible. The large open-source development communities involved
in say <a href="http://scikit-learn.org/stable/" target="_blank">Scikit-learn</a>,
in say <a href="http://scikit-learn.org/stable/" target="_blank">Scikit-Learn</a>,
<a href="https://www.tensorflow.org/" target="_blank">Tensorflow</a>,
<a href="http://pytorch.org/" target="_blank">PyTorch</a> and <a href="https://keras.io/" target="_blank">Keras</a>, are
all excellent examples of this. The codes can be tested and improved
@@ -407,13 +416,13 @@ developing data analysis and machine learning tools. It is much
easier today to gain traction and acceptance for making your science
reproducible. From a societal stand, this is an important element
since many of the developers are employees of large public institutions like
universities and research labs. Our taxpayer do deserve to get
universities and research labs. Our fellow taxpayers do deserve to get
something back for their bucks.
<p>
However, this more mechanical aspect of the ethics of science (in
particular the reproducibility of scientific results) is something
which is obvious and everybody should do as part of the dialectics of
which is obvious and everybody should do so as part of the dialectics of
science. The fact that many scientists are not willing to share their codes or
data is detrimental to the scientific discourse.
@@ -421,11 +430,11 @@ data is detrimental to the scientific discourse.
Before we proceed, we should add a disclaimer. Even though
we may dream of computers developing some kind of higher learning
capabilities, at the end (even if the artificial intelligence
community keeps touting our ears full of fancy futuristic avenues), it is we
community keeps touting our ears full of fancy futuristic avenues), it is we, yes you reading these lines,
who end up constructing and instructing, via various algorithms, the
computers. Self-driving cars for example, rely on sofisticated
machine learning approaches. Self-driving cars for example, rely on sofisticated
programs which take into account all possible situations a car can
encounter. In addition, extensive usage of training datas from GPS
encounter. In addition, extensive usage of training data from GPS
information, maps etc, are typically fed into the software for
self-driving cars. Adding to this various sensors and cameras that
feed information to the programs, there are zillions of ethical issues
@@ -436,8 +445,8 @@ For self-driving cars, where basically many of the standard machine
learning algorithms discussed here enter into the codes, at a certain
stage we have to make choices. Yes, we , the lads and lasses who wrote
a program for a specific brand of a self-driving car. As an example,
a most carmakers have as their utmost priority the security of the
driver and the accompanying passengers. A famous carmaker, which is
all carmakers have as their utmost priority the security of the
driver and the accompanying passengers. A famous European carmaker, which is
one of the leaders in the market of self-driving cars, had <b>if</b>
statements of the following type: suppose there are two obstacles in
front of you and you cannot avoid to collide with one of them. One of
@@ -448,9 +457,9 @@ the likelihood of surving a collision with our future citizens, is
much higher.
<p>
This brings us leads then to serious ethical aspects. Why should we
This leads to serious ethical aspects. Why should we
opt for such an option? Who decides and who is entitled to make such
choices? Keep in mind that many of the algorithms you will about in
choices? Keep in mind that many of the algorithms you will encounter in
this series of lectures or hear about later, are indeed based on
simple programming instructions. And you are very likely to be one of
the people who may end up writing such a code. Thus, developing a
@@ -463,15 +472,16 @@ not weighting some data in a particular way, perhaps because you dearly want a
specific conclusion which may support your political views?
<p>
We do not have the answers here, but we want you think over these
topics in a more overarching way. A statistical data analysis with
its dry numbers and graphs meant to guide the eye, do not necessarily
We do not have the answers here, nor will we venture into a deeper
discussions of these aspects, but we want you think over these topics
in a more overarching way. A statistical data analysis with its dry
numbers and graphs meant to guide the eye, does not necessarily
reflect the truth, whatever that is. As a scientist, and after a
university education, you are supposedly a better citizen, with an
improved critical view and understanding of the scientific method, and
perhaps some deeper understandings of the ethics of science at
perhaps some deeper understanding of the ethics of science at
large. Use these insights. Be a critical citizen. You owe it to our
societies.
society.
<p>
To do: Add references and acknowledgements
@@ -6,6 +6,7 @@ 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="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Introduction to Applied Data Analysis and Machine Learning">
<title>Introduction to Applied Data Analysis and Machine Learning</title>
@@ -67,20 +68,31 @@ 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>May 28, 2018</h4></center> <!-- date -->
<center><h4>Jun 10, 2019</h4></center> <!-- date -->
<br>
<h2 id="___sec0">Introduction </h2>
<p>
Statistics, data science and machine learning form important fields of
research in modern science. They describe how to learn and make
predictions from data, as well as allowing us to extract important
correlations about physical process and the underlying laws of motion
in large data sets. The latter, big data sets, appear frequently in
essentially all disciplines, from the traditional Science, Technology,
Mathematics and Engineering fields to Life Science, Law, education
research, the Humanities and the Social Sciences.
During the last two decades there has been a swift and amazing
development of Machine Learning techniques and algorithms that impact
many areas in not only Science and Technology but also the Humanities,
Social Sciences, Medicine, Law, indeed, almost all possible
disciplines. The applications are incredibly many, from self-driving
cars to solving high-dimensional differential equations or complicated
quantum mechanical many-body problems. Machine Learning is perceived
by many as one of the main disruptive techniques nowadays.
<p>
Statistics, Data science and Machine Learning form important
fields of research in modern science. They describe how to learn and
make predictions from data, as well as allowing us to extract
important correlations about physical process and the underlying laws
of motion in large data sets. The latter, big data sets, appear
frequently in essentially all disciplines, from the traditional
Science, Technology, Mathematics and Engineering fields to Life
Science, Law, education research, the Humanities and the Social
Sciences.
<p>
It has become more
@@ -146,7 +158,7 @@ of algorithms and methods we will discuss.
<h2 id="___sec1">Learning outcomes </h2>
<p>
These setsof lectures aim at giving you an overview of central aspects of
These sets of lectures aim at giving you an overview of central aspects of
statistical data analysis as well as some of the central algorithms
used in machine learning. We will introduce a variety of central
algorithms and methods essential for studies of data analysis and
@@ -155,17 +167,17 @@ machine learning.
<p>
Hands-on projects and experimenting with data and algorithms plays a central role in
these lectures, and our hope is, through the various
projects and exercies, to expose you to fundamental
projects and exercises, to expose you to fundamental
research problems in these fields, with the aim to reproduce state of
the art scientific results. You will learn to develop and
structure large codes for studying these systems, get acquainted with
structure codes for studying these systems, get acquainted with
computing facilities and learn to handle large scientific projects. A
good scientific and ethical conduct is emphasized throughout the
course. More specifically, you will
<ol>
<li> learn about basic data analysis, Bayesian statistics, Monte Carlo methods, data optimization and machine learning;</li>
<li> be capable of extending the acquired knowledge to other systems and cases;</li>
<li> Learn about basic data analysis, Bayesian statistics, Monte Carlo methods, data optimization and machine learning;</li>
<li> Be capable of extending the acquired knowledge to other systems and cases;</li>
<li> Have an understanding of central algorithms used in data analysis and machine learning;</li>
<li> Gain knowledge of central aspects of Monte Carlo methods, Markov chains, Gibbs samplers and their possible applications, from numerical integration to simulation of stock markets;</li>
<li> Understand methods for regression and classification;</li>
@@ -173,16 +185,16 @@ course. More specifically, you will
<li> Work on numerical projects to illustrate the theory. The projects play a central role and you are expected to know modern programming languages like Python or C++, in addition to a basic knowledge of linear algebra (typically taught during the first one or two years of undergraduate studies).</li>
</ol>
There are several topics we will cover here, spanning from a
statistical data analysis and its basic concepts such expectation
There are several topics we will cover here, spanning from
statistical data analysis and its basic concepts such as expectation
values, variance, covariance, correlation functions and errors, via
well-known probability distribution functions like uniform
well-known probability distribution functions like the uniform
distribution, the binomial distribution, the Poisson distribution and
simple and multivariate normal distributions to central elements of
Bayesian statistics and modeling. We will also remind the reader about
central elements from linear algebra and standard methods based on
linear algebra used to fit functions such Cubic splines and gradient
methods for data optimization and the Singular-value decomposition and
linear algebra used to optimize (minimize) functions (the family of gradient descent methods)
and the Singular-value decomposition and
least square methods for parameterizing data.
<p>
@@ -190,8 +202,8 @@ We will also cover Monte Carlo methods, Markov chains, well-known
algorithms for sampling stochastic events like the Metropolis-Hastings
and Gibbs sampling methods. An important aspect of all our
calculations is a proper estimation of errors. Here we will also
discuss famous resampling techniques like the blocking, bootstrapping
and jackknife methods.
discuss famous resampling techniques like the blocking, the bootstrapping
and the jackknife methods and the infamous bias-variance tradeoff.
<p>
The second part of the material covers several algorithms used in
@@ -223,8 +235,12 @@ desired output of a system. Some of the most common tasks are:
The methods we cover have three main topics in common, irrespective of
whether we deal with supervised or unsupervised learning. The first
ingredient is normally our data set (which can be subdivided into
training and test data), the second item is a model which is normally a
function of some parameters. The model reflects our knowledge of the system (or lack thereof). As an example, if we know that our data show a behavior similar to what would be predicted by a polynomial, fitting our data to a polynomial of some degree would then determin our model.
training and test data), the second item is a model which is normally
a function of some parameters. The model reflects our knowledge of
the system (or lack thereof). As an example, if we know that our data
show a behavior similar to what would be predicted by a polynomial,
fitting our data to a polynomial of some degree would then determin
our model.
<p>
The last ingredient is a so-called <b>cost</b>
@@ -238,12 +254,11 @@ analysis, stochastic processes etc. We will discuss the following
machine learning algorithms
<ol>
<li> Linear regression and its variants, in essence polynomial regression</li>
<li> Decision tree algorithms, from simpler to more complex ones</li>
<li> Nearest neighbors models</li>
<li> Linear regression and its variants</li>
<li> Decision tree algorithms, from single trees to random forests</li>
<li> Bayesian statistics and regression</li>
<li> Support vector machines and finally various variants of</li>
<li> Artifical neural networks and deep learning</li>
<li> Artifical neural networks and deep learning, including convolutional neural networks and Bayesian neural networks</li>
<li> Networks for unsupervised learning using for example reduced Boltzmann machines.</li>
</ol>
@@ -252,21 +267,16 @@ machine learning algorithms
<p>
Python plays nowadays a central role in the development of machine
learning techniques and tools for data analysis. In particular, seen
the wealth of machine learning and data analysis packages written in
the wealth of machine learning and data analysis libraries written in
Python, easy to use libraries with immediate visualization(and not the
least impressive galleries of existing example), the popularity of the
least impressive galleries of existing examples), the popularity of the
Jupyter notebook framework with the possibility to run <b>R</b> codes or
compiled programs written in C++, and much more made our choice of
programming language for this series of lectures of easy. However,
since the focus here is not only on using existing Python tools such
as <b>scikit-learn</b> or <b>tensorflow</b>, but also on developing your own
programming language for this series of lectures easy. However,
since the focus here is not only on using existing Python libraries such
as <b>Scikit-Learn</b> or <b>Tensorflow</b>, but also on developing your own
algorithms and codes, we will as far as possible present many of these
algorithms eithers a Python codes or C++ codes. Finally, we will, as
far as possible keep parallel versions of the data analysis and
machine larning programming aspects in <b>R</b> as
well. <a href="https://www.r-project.org/" target="_blank">R</a> is a language and environment
for statistical computing and graphics which is widely used in
statistics and mathematics applications.
algorithms either as a Python codes or C++ or Fortran (or other languages) codes.
<p>
The reason we also focus on compiled languages like C++ (or
@@ -275,7 +285,7 @@ utilize highly streamlined computational libraries like
<a href="http://www.netlib.org/lapack/" target="_blank">Lapack</a> or other numerical libraries
written in compiled languages (many of these libraries are written in
Fortran). Although a project like <a href="https://numba.pydata.org/" target="_blank">Numba</a>
holds great promise for speeding up the unrolling of lengthy loops, C+
holds great promise for speeding up the unrolling of lengthy loops, C++
and Fortran are presently still the performance winners. Numba gives
you potentially the power to speed up your applications with high
performance functions written directly in Python. In particular,
@@ -298,7 +308,7 @@ existing data files or provide code examples which produce the data to
be analyzed. Most of the applications we will discuss deal with
small data sets (less than a terabyte of information) and can easily
be analyzed and tested on standard off the shelf laptops you find in general
grocery stores.
stores.
<h2 id="___sec4">Data handling, machine learning and ethical aspects </h2>
@@ -306,7 +316,7 @@ grocery stores.
In most of the cases we will study, we will either generate the data
to analyze ourselves (both for supervised learning and unsupervised
learning) or we will recur again and again to data present in say
<b>scikit-learn</b> or <b>tensorflow</b>. Many of the examples we end up
<b>Scikit-Learn</b> or <b>Tensorflow</b>. Many of the examples we end up
dealing with are from a privacy and data protection point of view,
rather inoccuous and boring results of numerical
calculations. However, this does not hinder us from developing a sound
@@ -322,7 +332,7 @@ repositories like <a href="https://github.com/" target="_blank">Github</a>,
and data sets we have used, freely and easily accessible to a wider
community. This helps us almost automagically in making our science
reproducible. The large open-source development communities involved
in say <a href="http://scikit-learn.org/stable/" target="_blank">Scikit-learn</a>,
in say <a href="http://scikit-learn.org/stable/" target="_blank">Scikit-Learn</a>,
<a href="https://www.tensorflow.org/" target="_blank">Tensorflow</a>,
<a href="http://pytorch.org/" target="_blank">PyTorch</a> and <a href="https://keras.io/" target="_blank">Keras</a>, are
all excellent examples of this. The codes can be tested and improved
@@ -331,13 +341,13 @@ developing data analysis and machine learning tools. It is much
easier today to gain traction and acceptance for making your science
reproducible. From a societal stand, this is an important element
since many of the developers are employees of large public institutions like
universities and research labs. Our taxpayer do deserve to get
universities and research labs. Our fellow taxpayers do deserve to get
something back for their bucks.
<p>
However, this more mechanical aspect of the ethics of science (in
particular the reproducibility of scientific results) is something
which is obvious and everybody should do as part of the dialectics of
which is obvious and everybody should do so as part of the dialectics of
science. The fact that many scientists are not willing to share their codes or
data is detrimental to the scientific discourse.
@@ -345,11 +355,11 @@ data is detrimental to the scientific discourse.
Before we proceed, we should add a disclaimer. Even though
we may dream of computers developing some kind of higher learning
capabilities, at the end (even if the artificial intelligence
community keeps touting our ears full of fancy futuristic avenues), it is we
community keeps touting our ears full of fancy futuristic avenues), it is we, yes you reading these lines,
who end up constructing and instructing, via various algorithms, the
computers. Self-driving cars for example, rely on sofisticated
machine learning approaches. Self-driving cars for example, rely on sofisticated
programs which take into account all possible situations a car can
encounter. In addition, extensive usage of training datas from GPS
encounter. In addition, extensive usage of training data from GPS
information, maps etc, are typically fed into the software for
self-driving cars. Adding to this various sensors and cameras that
feed information to the programs, there are zillions of ethical issues
@@ -360,8 +370,8 @@ For self-driving cars, where basically many of the standard machine
learning algorithms discussed here enter into the codes, at a certain
stage we have to make choices. Yes, we , the lads and lasses who wrote
a program for a specific brand of a self-driving car. As an example,
a most carmakers have as their utmost priority the security of the
driver and the accompanying passengers. A famous carmaker, which is
all carmakers have as their utmost priority the security of the
driver and the accompanying passengers. A famous European carmaker, which is
one of the leaders in the market of self-driving cars, had <b>if</b>
statements of the following type: suppose there are two obstacles in
front of you and you cannot avoid to collide with one of them. One of
@@ -372,9 +382,9 @@ the likelihood of surving a collision with our future citizens, is
much higher.
<p>
This brings us leads then to serious ethical aspects. Why should we
This leads to serious ethical aspects. Why should we
opt for such an option? Who decides and who is entitled to make such
choices? Keep in mind that many of the algorithms you will about in
choices? Keep in mind that many of the algorithms you will encounter in
this series of lectures or hear about later, are indeed based on
simple programming instructions. And you are very likely to be one of
the people who may end up writing such a code. Thus, developing a
@@ -387,15 +397,16 @@ not weighting some data in a particular way, perhaps because you dearly want a
specific conclusion which may support your political views?
<p>
We do not have the answers here, but we want you think over these
topics in a more overarching way. A statistical data analysis with
its dry numbers and graphs meant to guide the eye, do not necessarily
We do not have the answers here, nor will we venture into a deeper
discussions of these aspects, but we want you think over these topics
in a more overarching way. A statistical data analysis with its dry
numbers and graphs meant to guide the eye, does not necessarily
reflect the truth, whatever that is. As a scientist, and after a
university education, you are supposedly a better citizen, with an
improved critical view and understanding of the scientific method, and
perhaps some deeper understandings of the ethics of science at
perhaps some deeper understanding of the ethics of science at
large. Use these insights. Be a critical citizen. You owe it to our
societies.
society.
<p>
To do: Add references and acknowledgements
@@ -404,7 +415,7 @@ To do: Add references and acknowledgements
<center style="font-size:80%">
<!-- copyright --> &copy; 1999-2018, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
<!-- copyright --> &copy; 1999-2019, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
</center>
+68 -57
View File
@@ -6,6 +6,7 @@ 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="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Introduction to Applied Data Analysis and Machine Learning">
<title>Introduction to Applied Data Analysis and Machine Learning</title>
@@ -72,20 +73,31 @@ 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>May 28, 2018</h4></center> <!-- date -->
<center><h4>Jun 10, 2019</h4></center> <!-- date -->
<br>
<h2 id="___sec0">Introduction </h2>
<p>
Statistics, data science and machine learning form important fields of
research in modern science. They describe how to learn and make
predictions from data, as well as allowing us to extract important
correlations about physical process and the underlying laws of motion
in large data sets. The latter, big data sets, appear frequently in
essentially all disciplines, from the traditional Science, Technology,
Mathematics and Engineering fields to Life Science, Law, education
research, the Humanities and the Social Sciences.
During the last two decades there has been a swift and amazing
development of Machine Learning techniques and algorithms that impact
many areas in not only Science and Technology but also the Humanities,
Social Sciences, Medicine, Law, indeed, almost all possible
disciplines. The applications are incredibly many, from self-driving
cars to solving high-dimensional differential equations or complicated
quantum mechanical many-body problems. Machine Learning is perceived
by many as one of the main disruptive techniques nowadays.
<p>
Statistics, Data science and Machine Learning form important
fields of research in modern science. They describe how to learn and
make predictions from data, as well as allowing us to extract
important correlations about physical process and the underlying laws
of motion in large data sets. The latter, big data sets, appear
frequently in essentially all disciplines, from the traditional
Science, Technology, Mathematics and Engineering fields to Life
Science, Law, education research, the Humanities and the Social
Sciences.
<p>
It has become more
@@ -151,7 +163,7 @@ of algorithms and methods we will discuss.
<h2 id="___sec1">Learning outcomes </h2>
<p>
These setsof lectures aim at giving you an overview of central aspects of
These sets of lectures aim at giving you an overview of central aspects of
statistical data analysis as well as some of the central algorithms
used in machine learning. We will introduce a variety of central
algorithms and methods essential for studies of data analysis and
@@ -160,17 +172,17 @@ machine learning.
<p>
Hands-on projects and experimenting with data and algorithms plays a central role in
these lectures, and our hope is, through the various
projects and exercies, to expose you to fundamental
projects and exercises, to expose you to fundamental
research problems in these fields, with the aim to reproduce state of
the art scientific results. You will learn to develop and
structure large codes for studying these systems, get acquainted with
structure codes for studying these systems, get acquainted with
computing facilities and learn to handle large scientific projects. A
good scientific and ethical conduct is emphasized throughout the
course. More specifically, you will
<ol>
<li> learn about basic data analysis, Bayesian statistics, Monte Carlo methods, data optimization and machine learning;</li>
<li> be capable of extending the acquired knowledge to other systems and cases;</li>
<li> Learn about basic data analysis, Bayesian statistics, Monte Carlo methods, data optimization and machine learning;</li>
<li> Be capable of extending the acquired knowledge to other systems and cases;</li>
<li> Have an understanding of central algorithms used in data analysis and machine learning;</li>
<li> Gain knowledge of central aspects of Monte Carlo methods, Markov chains, Gibbs samplers and their possible applications, from numerical integration to simulation of stock markets;</li>
<li> Understand methods for regression and classification;</li>
@@ -178,16 +190,16 @@ course. More specifically, you will
<li> Work on numerical projects to illustrate the theory. The projects play a central role and you are expected to know modern programming languages like Python or C++, in addition to a basic knowledge of linear algebra (typically taught during the first one or two years of undergraduate studies).</li>
</ol>
There are several topics we will cover here, spanning from a
statistical data analysis and its basic concepts such expectation
There are several topics we will cover here, spanning from
statistical data analysis and its basic concepts such as expectation
values, variance, covariance, correlation functions and errors, via
well-known probability distribution functions like uniform
well-known probability distribution functions like the uniform
distribution, the binomial distribution, the Poisson distribution and
simple and multivariate normal distributions to central elements of
Bayesian statistics and modeling. We will also remind the reader about
central elements from linear algebra and standard methods based on
linear algebra used to fit functions such Cubic splines and gradient
methods for data optimization and the Singular-value decomposition and
linear algebra used to optimize (minimize) functions (the family of gradient descent methods)
and the Singular-value decomposition and
least square methods for parameterizing data.
<p>
@@ -195,8 +207,8 @@ We will also cover Monte Carlo methods, Markov chains, well-known
algorithms for sampling stochastic events like the Metropolis-Hastings
and Gibbs sampling methods. An important aspect of all our
calculations is a proper estimation of errors. Here we will also
discuss famous resampling techniques like the blocking, bootstrapping
and jackknife methods.
discuss famous resampling techniques like the blocking, the bootstrapping
and the jackknife methods and the infamous bias-variance tradeoff.
<p>
The second part of the material covers several algorithms used in
@@ -228,8 +240,12 @@ desired output of a system. Some of the most common tasks are:
The methods we cover have three main topics in common, irrespective of
whether we deal with supervised or unsupervised learning. The first
ingredient is normally our data set (which can be subdivided into
training and test data), the second item is a model which is normally a
function of some parameters. The model reflects our knowledge of the system (or lack thereof). As an example, if we know that our data show a behavior similar to what would be predicted by a polynomial, fitting our data to a polynomial of some degree would then determin our model.
training and test data), the second item is a model which is normally
a function of some parameters. The model reflects our knowledge of
the system (or lack thereof). As an example, if we know that our data
show a behavior similar to what would be predicted by a polynomial,
fitting our data to a polynomial of some degree would then determin
our model.
<p>
The last ingredient is a so-called <b>cost</b>
@@ -243,12 +259,11 @@ analysis, stochastic processes etc. We will discuss the following
machine learning algorithms
<ol>
<li> Linear regression and its variants, in essence polynomial regression</li>
<li> Decision tree algorithms, from simpler to more complex ones</li>
<li> Nearest neighbors models</li>
<li> Linear regression and its variants</li>
<li> Decision tree algorithms, from single trees to random forests</li>
<li> Bayesian statistics and regression</li>
<li> Support vector machines and finally various variants of</li>
<li> Artifical neural networks and deep learning</li>
<li> Artifical neural networks and deep learning, including convolutional neural networks and Bayesian neural networks</li>
<li> Networks for unsupervised learning using for example reduced Boltzmann machines.</li>
</ol>
@@ -257,21 +272,16 @@ machine learning algorithms
<p>
Python plays nowadays a central role in the development of machine
learning techniques and tools for data analysis. In particular, seen
the wealth of machine learning and data analysis packages written in
the wealth of machine learning and data analysis libraries written in
Python, easy to use libraries with immediate visualization(and not the
least impressive galleries of existing example), the popularity of the
least impressive galleries of existing examples), the popularity of the
Jupyter notebook framework with the possibility to run <b>R</b> codes or
compiled programs written in C++, and much more made our choice of
programming language for this series of lectures of easy. However,
since the focus here is not only on using existing Python tools such
as <b>scikit-learn</b> or <b>tensorflow</b>, but also on developing your own
programming language for this series of lectures easy. However,
since the focus here is not only on using existing Python libraries such
as <b>Scikit-Learn</b> or <b>Tensorflow</b>, but also on developing your own
algorithms and codes, we will as far as possible present many of these
algorithms eithers a Python codes or C++ codes. Finally, we will, as
far as possible keep parallel versions of the data analysis and
machine larning programming aspects in <b>R</b> as
well. <a href="https://www.r-project.org/" target="_blank">R</a> is a language and environment
for statistical computing and graphics which is widely used in
statistics and mathematics applications.
algorithms either as a Python codes or C++ or Fortran (or other languages) codes.
<p>
The reason we also focus on compiled languages like C++ (or
@@ -280,7 +290,7 @@ utilize highly streamlined computational libraries like
<a href="http://www.netlib.org/lapack/" target="_blank">Lapack</a> or other numerical libraries
written in compiled languages (many of these libraries are written in
Fortran). Although a project like <a href="https://numba.pydata.org/" target="_blank">Numba</a>
holds great promise for speeding up the unrolling of lengthy loops, C+
holds great promise for speeding up the unrolling of lengthy loops, C++
and Fortran are presently still the performance winners. Numba gives
you potentially the power to speed up your applications with high
performance functions written directly in Python. In particular,
@@ -303,7 +313,7 @@ existing data files or provide code examples which produce the data to
be analyzed. Most of the applications we will discuss deal with
small data sets (less than a terabyte of information) and can easily
be analyzed and tested on standard off the shelf laptops you find in general
grocery stores.
stores.
<h2 id="___sec4">Data handling, machine learning and ethical aspects </h2>
@@ -311,7 +321,7 @@ grocery stores.
In most of the cases we will study, we will either generate the data
to analyze ourselves (both for supervised learning and unsupervised
learning) or we will recur again and again to data present in say
<b>scikit-learn</b> or <b>tensorflow</b>. Many of the examples we end up
<b>Scikit-Learn</b> or <b>Tensorflow</b>. Many of the examples we end up
dealing with are from a privacy and data protection point of view,
rather inoccuous and boring results of numerical
calculations. However, this does not hinder us from developing a sound
@@ -327,7 +337,7 @@ repositories like <a href="https://github.com/" target="_blank">Github</a>,
and data sets we have used, freely and easily accessible to a wider
community. This helps us almost automagically in making our science
reproducible. The large open-source development communities involved
in say <a href="http://scikit-learn.org/stable/" target="_blank">Scikit-learn</a>,
in say <a href="http://scikit-learn.org/stable/" target="_blank">Scikit-Learn</a>,
<a href="https://www.tensorflow.org/" target="_blank">Tensorflow</a>,
<a href="http://pytorch.org/" target="_blank">PyTorch</a> and <a href="https://keras.io/" target="_blank">Keras</a>, are
all excellent examples of this. The codes can be tested and improved
@@ -336,13 +346,13 @@ developing data analysis and machine learning tools. It is much
easier today to gain traction and acceptance for making your science
reproducible. From a societal stand, this is an important element
since many of the developers are employees of large public institutions like
universities and research labs. Our taxpayer do deserve to get
universities and research labs. Our fellow taxpayers do deserve to get
something back for their bucks.
<p>
However, this more mechanical aspect of the ethics of science (in
particular the reproducibility of scientific results) is something
which is obvious and everybody should do as part of the dialectics of
which is obvious and everybody should do so as part of the dialectics of
science. The fact that many scientists are not willing to share their codes or
data is detrimental to the scientific discourse.
@@ -350,11 +360,11 @@ data is detrimental to the scientific discourse.
Before we proceed, we should add a disclaimer. Even though
we may dream of computers developing some kind of higher learning
capabilities, at the end (even if the artificial intelligence
community keeps touting our ears full of fancy futuristic avenues), it is we
community keeps touting our ears full of fancy futuristic avenues), it is we, yes you reading these lines,
who end up constructing and instructing, via various algorithms, the
computers. Self-driving cars for example, rely on sofisticated
machine learning approaches. Self-driving cars for example, rely on sofisticated
programs which take into account all possible situations a car can
encounter. In addition, extensive usage of training datas from GPS
encounter. In addition, extensive usage of training data from GPS
information, maps etc, are typically fed into the software for
self-driving cars. Adding to this various sensors and cameras that
feed information to the programs, there are zillions of ethical issues
@@ -365,8 +375,8 @@ For self-driving cars, where basically many of the standard machine
learning algorithms discussed here enter into the codes, at a certain
stage we have to make choices. Yes, we , the lads and lasses who wrote
a program for a specific brand of a self-driving car. As an example,
a most carmakers have as their utmost priority the security of the
driver and the accompanying passengers. A famous carmaker, which is
all carmakers have as their utmost priority the security of the
driver and the accompanying passengers. A famous European carmaker, which is
one of the leaders in the market of self-driving cars, had <b>if</b>
statements of the following type: suppose there are two obstacles in
front of you and you cannot avoid to collide with one of them. One of
@@ -377,9 +387,9 @@ the likelihood of surving a collision with our future citizens, is
much higher.
<p>
This brings us leads then to serious ethical aspects. Why should we
This leads to serious ethical aspects. Why should we
opt for such an option? Who decides and who is entitled to make such
choices? Keep in mind that many of the algorithms you will about in
choices? Keep in mind that many of the algorithms you will encounter in
this series of lectures or hear about later, are indeed based on
simple programming instructions. And you are very likely to be one of
the people who may end up writing such a code. Thus, developing a
@@ -392,15 +402,16 @@ not weighting some data in a particular way, perhaps because you dearly want a
specific conclusion which may support your political views?
<p>
We do not have the answers here, but we want you think over these
topics in a more overarching way. A statistical data analysis with
its dry numbers and graphs meant to guide the eye, do not necessarily
We do not have the answers here, nor will we venture into a deeper
discussions of these aspects, but we want you think over these topics
in a more overarching way. A statistical data analysis with its dry
numbers and graphs meant to guide the eye, does not necessarily
reflect the truth, whatever that is. As a scientist, and after a
university education, you are supposedly a better citizen, with an
improved critical view and understanding of the scientific method, and
perhaps some deeper understandings of the ethics of science at
perhaps some deeper understanding of the ethics of science at
large. Use these insights. Be a critical citizen. You owe it to our
societies.
society.
<p>
To do: Add references and acknowledgements
@@ -409,7 +420,7 @@ To do: Add references and acknowledgements
<center style="font-size:80%">
<!-- copyright --> &copy; 1999-2018, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
<!-- copyright --> &copy; 1999-2019, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license
</center>
@@ -1,8 +1,3 @@
.idea/
*.iml
*.iws
*.eml
out/
.DS_Store
.svn
log/*.log
@@ -10,4 +5,4 @@ tmp/**
node_modules/
.sass-cache
css/reveal.min.css
js/reveal.min.js
js/reveal.min.js
@@ -1,7 +1,5 @@
language: node_js
node_js:
- 4
- 0.10
before_script:
- npm install -g grunt-cli
after_script:
- grunt retire
- npm install -g grunt-cli
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright (C) 2017 Hakim El Hattab, http://hakim.se, and reveal.js contributors
Copyright (C) 2015 Hakim El Hattab, http://hakim.se
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+199 -393
View File
@@ -1,58 +1,12 @@
# reveal.js [![Build Status](https://travis-ci.org/hakimel/reveal.js.svg?branch=master)](https://travis-ci.org/hakimel/reveal.js) <a href="https://slides.com?ref=github"><img src="https://s3.amazonaws.com/static.slid.es/images/slides-github-banner-320x40.png?1" alt="Slides" width="160" height="20"></a>
# reveal.js [![Build Status](https://travis-ci.org/hakimel/reveal.js.svg?branch=master)](https://travis-ci.org/hakimel/reveal.js)
A framework for easily creating beautiful presentations using HTML. [Check out the live demo](http://revealjs.com/).
A framework for easily creating beautiful presentations using HTML. [Check out the live demo](http://lab.hakim.se/reveal-js/).
reveal.js comes with a broad range of features including [nested slides](https://github.com/hakimel/reveal.js#markup), [Markdown contents](https://github.com/hakimel/reveal.js#markdown), [PDF export](https://github.com/hakimel/reveal.js#pdf-export), [speaker notes](https://github.com/hakimel/reveal.js#speaker-notes) and a [JavaScript API](https://github.com/hakimel/reveal.js#api). There's also a fully featured visual editor and platform for sharing reveal.js presentations at [slides.com](https://slides.com?ref=github).
reveal.js comes with a broad range of features including [nested slides](https://github.com/hakimel/reveal.js#markup), [Markdown contents](https://github.com/hakimel/reveal.js#markdown), [PDF export](https://github.com/hakimel/reveal.js#pdf-export), [speaker notes](https://github.com/hakimel/reveal.js#speaker-notes) and a [JavaScript API](https://github.com/hakimel/reveal.js#api). It's best viewed in a modern browser but [fallbacks](https://github.com/hakimel/reveal.js/wiki/Browser-Support) are available to make sure your presentation can still be viewed elsewhere.
## Table of contents
- [Online Editor](#online-editor)
- [Instructions](#instructions)
- [Markup](#markup)
- [Markdown](#markdown)
- [Element Attributes](#element-attributes)
- [Slide Attributes](#slide-attributes)
- [Configuration](#configuration)
- [Presentation Size](#presentation-size)
- [Dependencies](#dependencies)
- [Ready Event](#ready-event)
- [Auto-sliding](#auto-sliding)
- [Keyboard Bindings](#keyboard-bindings)
- [Touch Navigation](#touch-navigation)
- [Lazy Loading](#lazy-loading)
- [API](#api)
- [Slide Changed Event](#slide-changed-event)
- [Presentation State](#presentation-state)
- [Slide States](#slide-states)
- [Slide Backgrounds](#slide-backgrounds)
- [Parallax Background](#parallax-background)
- [Slide Transitions](#slide-transitions)
- [Internal links](#internal-links)
- [Fragments](#fragments)
- [Fragment events](#fragment-events)
- [Code syntax highlighting](#code-syntax-highlighting)
- [Slide number](#slide-number)
- [Overview mode](#overview-mode)
- [Fullscreen mode](#fullscreen-mode)
- [Embedded media](#embedded-media)
- [Stretching elements](#stretching-elements)
- [postMessage API](#postmessage-api)
- [PDF Export](#pdf-export)
- [Theming](#theming)
- [Speaker Notes](#speaker-notes)
- [Share and Print Speaker Notes](#share-and-print-speaker-notes)
- [Server Side Speaker Notes](#server-side-speaker-notes)
- [Multiplexing](#multiplexing)
- [Master presentation](#master-presentation)
- [Client presentation](#client-presentation)
- [Socket.io server](#socketio-server)
- [MathJax](#mathjax)
- [Installation](#installation)
- [Basic setup](#basic-setup)
- [Full setup](#full-setup)
- [Folder Structure](#folder-structure)
- [License](#license)
#### More reading
#### More reading:
- [Installation](#installation): Step-by-step instructions for getting reveal.js running on your computer.
- [Changelog](https://github.com/hakimel/reveal.js/releases): Up-to-date version history.
- [Examples](https://github.com/hakimel/reveal.js/wiki/Example-Presentations): Presentations created with reveal.js, add your own!
- [Browser Support](https://github.com/hakimel/reveal.js/wiki/Browser-Support): Explanation of browser support and fallbacks.
@@ -60,36 +14,14 @@ reveal.js comes with a broad range of features including [nested slides](https:/
## Online Editor
Presentations are written using HTML or Markdown but there's also an online editor for those of you who prefer a graphical interface. Give it a try at [https://slides.com](https://slides.com?ref=github).
Presentations are written using HTML or Markdown but there's also an online editor for those of you who prefer a graphical interface. Give it a try at [http://slides.com](http://slides.com).
## Instructions
### Markup
Here's a barebones example of a fully working reveal.js presentation:
```html
<html>
<head>
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/white.css">
</head>
<body>
<div class="reveal">
<div class="slides">
<section>Slide 1</section>
<section>Slide 2</section>
</div>
</div>
<script src="js/reveal.js"></script>
<script>
Reveal.initialize();
</script>
</body>
</html>
```
The presentation markup hierarchy needs to be `.reveal > .slides > section` where the `section` represents one slide and can be repeated indefinitely. If you place multiple `section` elements inside of another `section` they will be shown as vertical slides. The first of the vertical slides is the "root" of the others (at the top), and will be included in the horizontal sequence. For example:
Markup hierarchy needs to be ``<div class="reveal"> <div class="slides"> <section>`` where the ``<section>`` represents one slide and can be repeated indefinitely. If you place multiple ``<section>``'s inside of another ``<section>`` they will be shown as vertical slides. The first of the vertical slides is the "root" of the others (at the top), and it will be included in the horizontal sequence. For example:
```html
<div class="reveal">
@@ -105,36 +37,32 @@ The presentation markup hierarchy needs to be `.reveal > .slides > section` wher
### Markdown
It's possible to write your slides using Markdown. To enable Markdown, add the `data-markdown` attribute to your `<section>` elements and wrap the contents in a `<textarea data-template>` like the example below. You'll also need to add the `plugin/markdown/marked.js` and `plugin/markdown/markdown.js` scripts (in that order) to your HTML file.
It's possible to write your slides using Markdown. To enable Markdown, add the ```data-markdown``` attribute to your ```<section>``` elements and wrap the contents in a ```<script type="text/template">``` like the example below.
This is based on [data-markdown](https://gist.github.com/1343518) from [Paul Irish](https://github.com/paulirish) modified to use [marked](https://github.com/chjj/marked) to support [GitHub Flavored Markdown](https://help.github.com/articles/github-flavored-markdown). Sensitive to indentation (avoid mixing tabs and spaces) and line breaks (avoid consecutive breaks).
This is based on [data-markdown](https://gist.github.com/1343518) from [Paul Irish](https://github.com/paulirish) modified to use [marked](https://github.com/chjj/marked) to support [Github Flavoured Markdown](https://help.github.com/articles/github-flavored-markdown). Sensitive to indentation (avoid mixing tabs and spaces) and line breaks (avoid consecutive breaks).
```html
<section data-markdown>
<textarea data-template>
<script type="text/template">
## Page title
A paragraph with some text and a [link](http://hakim.se).
</textarea>
</script>
</section>
```
#### External Markdown
You can write your content as a separate file and have reveal.js load it at runtime. Note the separator arguments which determine how slides are delimited in the external file: the `data-separator` attribute defines a regular expression for horizontal slides (defaults to `^\r?\n---\r?\n$`, a newline-bounded horizontal rule) and `data-separator-vertical` defines vertical slides (disabled by default). The `data-separator-notes` attribute is a regular expression for specifying the beginning of the current slide's speaker notes (defaults to `note:`). The `data-charset` attribute is optional and specifies which charset to use when loading the external file.
You can write your content as a separate file and have reveal.js load it at runtime. Note the separator arguments which determine how slides are delimited in the external file. The ```data-charset``` attribute is optional and specifies which charset to use when loading the external file.
When used locally, this feature requires that reveal.js [runs from a local web server](#full-setup). The following example customises all available options:
When used locally, this feature requires that reveal.js [runs from a local web server](#full-setup).
```html
<section data-markdown="example.md"
data-separator="^\n\n\n"
data-separator-vertical="^\n\n"
data-separator-notes="^Note:"
<section data-markdown="example.md"
data-separator="^\n\n\n"
data-separator-vertical="^\n\n"
data-separator-notes="^Note:"
data-charset="iso-8859-15">
<!--
Note that Windows uses `\r\n` instead of `\n` as its linefeed character.
For a regex that supports all operating systems, use `\r?\n` instead of `\n`.
-->
</section>
```
@@ -164,19 +92,6 @@ Special syntax (in html comment) is available for adding attributes to the slide
</section>
```
#### Configuring *marked*
We use [marked](https://github.com/chjj/marked) to parse Markdown. To customise marked's rendering, you can pass in options when [configuring Reveal](#configuration):
```javascript
Reveal.initialize({
// Options which are passed into marked
// See https://github.com/chjj/marked#options-1
markdown: {
smartypants: true
}
});
```
### Configuration
@@ -185,26 +100,12 @@ At the end of your page you need to initialize reveal by running the following c
```javascript
Reveal.initialize({
// Display presentation control arrows
// Display controls in the bottom right corner
controls: true,
// Help the user learn the controls by providing hints, for example by
// bouncing the down arrow when they first encounter a vertical slide
controlsTutorial: true,
// Determines where controls appear, "edges" or "bottom-right"
controlsLayout: 'bottom-right',
// Visibility rule for backwards navigation arrows; "faded", "hidden"
// or "visible"
controlsBackArrows: 'faded',
// Display a presentation progress bar
progress: true,
// Set default timing of 2 minutes per slide
defaultTiming: 120,
// Display the page number of the current slide
slideNumber: false,
@@ -229,9 +130,6 @@ Reveal.initialize({
// Change the presentation direction to be RTL
rtl: false,
// Randomizes the order of slides each time the presentation loads
shuffle: false,
// Turns fragments on and off globally
fragments: true,
@@ -243,15 +141,6 @@ Reveal.initialize({
// key is pressed
help: true,
// Flags if speaker notes should be visible to all viewers
showNotes: false,
// Global override for autoplaying embedded media (video/audio/iframe)
// - null: Media will only autoplay if data-autoplay is present
// - true: All media will autoplay, regardless of individual setting
// - false: No media will autoplay, regardless of individual setting
autoPlayMedia: null,
// Number of milliseconds between automatically proceeding to the
// next slide, disabled when set to 0, this value can be overwritten
// by using a data-autoslide attribute on your slides
@@ -260,9 +149,6 @@ Reveal.initialize({
// Stop auto-sliding after user input
autoSlideStoppable: true,
// Use this method for navigation when auto-sliding
autoSlideMethod: Reveal.navigateNext,
// Enable slide navigation via mouse wheel
mouseWheel: false,
@@ -270,18 +156,16 @@ Reveal.initialize({
hideAddressBar: true,
// Opens links in an iframe preview overlay
// Add `data-preview-link` and `data-preview-link="false"` to customise each link
// individually
previewLinks: false,
// Transition style
transition: 'slide', // none/fade/slide/convex/concave/zoom
transition: 'default', // none/fade/slide/convex/concave/zoom
// Transition speed
transitionSpeed: 'default', // default/fast/slow
// Transition style for full page slide backgrounds
backgroundTransition: 'fade', // none/fade/slide/convex/concave/zoom
backgroundTransition: 'default', // none/fade/slide/convex/concave/zoom
// Number of slides away from the current that are visible
viewDistance: 3,
@@ -292,14 +176,10 @@ Reveal.initialize({
// Parallax background size
parallaxBackgroundSize: '', // CSS syntax, e.g. "2100px 900px"
// Number of pixels to move the parallax background per slide
// - Calculated automatically unless specified
// - Set to 0 to disable movement along an axis
parallaxBackgroundHorizontal: null,
parallaxBackgroundVertical: null,
// The display mode that will be used to show slides
display: 'block'
// Amount to move parallax background (horizontal and vertical) on slide change
// Number, e.g. 100
parallaxBackgroundHorizontal: '',
parallaxBackgroundVertical: ''
});
```
@@ -316,6 +196,56 @@ Reveal.configure({ autoSlide: 5000 });
```
### Dependencies
Reveal.js doesn't _rely_ on any third party scripts to work but a few optional libraries are included by default. These libraries are loaded as dependencies in the order they appear, for example:
```javascript
Reveal.initialize({
dependencies: [
// Cross-browser shim that fully implements classList - https://github.com/eligrey/classList.js/
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
// Interpret Markdown in <section> elements
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
// Syntax highlight for <code> elements
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
// Zoom in and out with Alt+click
{ src: 'plugin/zoom-js/zoom.js', async: true },
// Speaker notes
{ src: 'plugin/notes/notes.js', async: true },
// Remote control your reveal.js presentation using a touch device
{ src: 'plugin/remotes/remotes.js', async: true },
// MathJax
{ src: 'plugin/math/math.js', async: true }
]
});
```
You can add your own extensions using the same syntax. The following properties are available for each dependency object:
- **src**: Path to the script to load
- **async**: [optional] Flags if the script should load after reveal.js has started, defaults to false
- **callback**: [optional] Function to execute when the script has loaded
- **condition**: [optional] Function which must return true for the script to be loaded
### Ready Event
A 'ready' event is fired when reveal.js has loaded all non-async dependencies and is ready to start navigating. To check if reveal.js is already 'ready' you can call `Reveal.isReady()`.
```javascript
Reveal.addEventListener( 'ready', function( event ) {
// event.currentSlide, event.indexh, event.indexv
} );
```
### Presentation Size
All presentations have a normal size, that is the resolution at which they are authored. The framework will automatically scale presentations uniformly based on this size to ensure that everything fits on any given display or viewport.
@@ -343,69 +273,6 @@ Reveal.initialize({
});
```
If you wish to disable this behavior and do your own scaling (e.g. using media queries), try these settings:
```javascript
Reveal.initialize({
...
width: "100%",
height: "100%",
margin: 0,
minScale: 1,
maxScale: 1
});
```
### Dependencies
Reveal.js doesn't _rely_ on any third party scripts to work but a few optional libraries are included by default. These libraries are loaded as dependencies in the order they appear, for example:
```javascript
Reveal.initialize({
dependencies: [
// Cross-browser shim that fully implements classList - https://github.com/eligrey/classList.js/
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
// Interpret Markdown in <section> elements
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
// Syntax highlight for <code> elements
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
// Zoom in and out with Alt+click
{ src: 'plugin/zoom-js/zoom.js', async: true },
// Speaker notes
{ src: 'plugin/notes/notes.js', async: true },
// MathJax
{ src: 'plugin/math/math.js', async: true }
]
});
```
You can add your own extensions using the same syntax. The following properties are available for each dependency object:
- **src**: Path to the script to load
- **async**: [optional] Flags if the script should load after reveal.js has started, defaults to false
- **callback**: [optional] Function to execute when the script has loaded
- **condition**: [optional] Function which must return true for the script to be loaded
To load these dependencies, reveal.js requires [head.js](http://headjs.com/) *(a script loading library)* to be loaded before reveal.js.
### Ready Event
A 'ready' event is fired when reveal.js has loaded all non-async dependencies and is ready to start navigating. To check if reveal.js is already 'ready' you can call `Reveal.isReady()`.
```javascript
Reveal.addEventListener( 'ready', function( event ) {
// event.currentSlide, event.indexh, event.indexv
} );
```
Note that we also add a `.ready` class to the `.reveal` element so that you can hook into this with CSS.
### Auto-sliding
@@ -429,8 +296,6 @@ You can also override the slide duration for individual slides and fragments by
</section>
```
To override the method used for navigation when auto-sliding, you can specify the ```autoSlideMethod``` setting. To only navigate along the top layer and ignore vertical slides, set this to ```Reveal.navigateRight```.
Whenever the auto-slide mode is resumed or paused the ```autoslideresumed``` and ```autoslidepaused``` events are fired.
@@ -448,13 +313,6 @@ Reveal.configure({
});
```
### Touch Navigation
You can swipe to navigate through a presentation on any touch-enabled device. Horizontal swipes change between horizontal slides, vertical swipes change between vertical slides. If you wish to disable this you can set the `touch` config option to false when initializing reveal.js.
If there's some part of your content that needs to remain accessible to touch events you'll need to highlight this by adding a `data-prevent-swipe` attribute to the element. One common example where this is useful is elements that need to be scrolled.
### Lazy Loading
When working on presentation with a lot of media or iframe content it's important to load lazily. Lazy loading means that reveal.js will only load content for the few slides nearest to the current slide. The number of slides that are preloaded is determined by the `viewDistance` configuration option.
@@ -489,18 +347,11 @@ Reveal.next();
Reveal.prevFragment();
Reveal.nextFragment();
// Randomize the order of slides
Reveal.shuffle();
// Toggle presentation states, optionally pass true/false to force on/off
Reveal.toggleOverview();
Reveal.togglePause();
Reveal.toggleAutoSlide();
// Shows a help overlay with keyboard shortcuts, optionally pass true/false
// to force on/off
Reveal.toggleHelp();
// Change a config value at runtime
Reveal.configure({ controls: true });
@@ -514,14 +365,9 @@ Reveal.getScale();
Reveal.getPreviousSlide();
Reveal.getCurrentSlide();
Reveal.getIndices(); // { h: 0, v: 0 } }
Reveal.getPastSlideCount();
Reveal.getProgress(); // (0 == first slide, 1 == last slide)
Reveal.getSlides(); // Array of all slides
Reveal.getTotalSlides(); // total number of slides
// Returns the speaker notes for the current slide
Reveal.getSlideNotes();
Reveal.getIndices(); // { h: 0, v: 0 } }
Reveal.getProgress(); // 0-1
Reveal.getTotalSlides();
// State checks
Reveal.isFirstSlide();
@@ -574,59 +420,26 @@ Reveal.addEventListener( 'somestate', function() {
### Slide Backgrounds
Slides are contained within a limited portion of the screen by default to allow them to fit any display and scale uniformly. You can apply full page backgrounds outside of the slide area by adding a ```data-background``` attribute to your ```<section>``` elements. Four different types of backgrounds are supported: color, image, video and iframe.
Slides are contained within a limited portion of the screen by default to allow them to fit any display and scale uniformly. You can apply full page backgrounds outside of the slide area by adding a ```data-background``` attribute to your ```<section>``` elements. Four different types of backgrounds are supported: color, image, video and iframe. Below are a few examples.
#### Color Backgrounds
All CSS color formats are supported, like rgba() or hsl().
```html
<section data-background-color="#ff0000">
<h2>Color</h2>
<section data-background="#ff0000">
<h2>All CSS color formats are supported, like rgba() or hsl().</h2>
</section>
<section data-background="http://example.com/image.png">
<h2>This slide will have a full-size background image.</h2>
</section>
<section data-background="http://example.com/image.png" data-background-size="100px" data-background-repeat="repeat">
<h2>This background image will be sized to 100px and repeated.</h2>
</section>
<section data-background-video="https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.mp4,https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.webm" data-background-video-loop>
<h2>Video. Multiple sources can be defined using a comma separated list. Video will loop when the data-background-video-loop attribute is provided.</h2>
</section>
<section data-background-iframe="https://slides.com">
<h2>Embeds a web page as a background. Note that the page won't be interactive.</h2>
</section>
```
#### Image Backgrounds
By default, background images are resized to cover the full page. Available options:
| Attribute | Default | Description |
| :--------------------------- | :--------- | :---------- |
| data-background-image | | URL of the image to show. GIFs restart when the slide opens. |
| data-background-size | cover | See [background-size](https://developer.mozilla.org/docs/Web/CSS/background-size) on MDN. |
| data-background-position | center | See [background-position](https://developer.mozilla.org/docs/Web/CSS/background-position) on MDN. |
| data-background-repeat | no-repeat | See [background-repeat](https://developer.mozilla.org/docs/Web/CSS/background-repeat) on MDN. |
```html
<section data-background-image="http://example.com/image.png">
<h2>Image</h2>
</section>
<section data-background-image="http://example.com/image.png" data-background-size="100px" data-background-repeat="repeat">
<h2>This background image will be sized to 100px and repeated</h2>
</section>
```
#### Video Backgrounds
Automatically plays a full size video behind the slide.
| Attribute | Default | Description |
| :--------------------------- | :------ | :---------- |
| data-background-video | | A single video source, or a comma separated list of video sources. |
| data-background-video-loop | false | Flags if the video should play repeatedly. |
| data-background-video-muted | false | Flags if the audio should be muted. |
| data-background-size | cover | Use `cover` for full screen and some cropping or `contain` for letterboxing. |
```html
<section data-background-video="https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.mp4,https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.webm" data-background-video-loop data-background-video-muted>
<h2>Video</h2>
</section>
```
#### Iframe Backgrounds
Embeds a web page as a slide background that covers 100% of the reveal.js width and height. The iframe is in the background layer, behind your slides, and as such it's not possible to interact with it by default. To make your background interactive, you can add the `data-background-interactive` attribute.
```html
<section data-background-iframe="https://slides.com" data-background-interactive>
<h2>Iframe</h2>
</section>
```
#### Background Transitions
Backgrounds transition using a fade animation by default. This can be changed to a linear sliding transition by passing ```backgroundTransition: 'slide'``` to the ```Reveal.initialize()``` call. Alternatively you can set ```data-background-transition``` on any section with a background to override that specific transition.
@@ -643,16 +456,16 @@ Reveal.initialize({
// Parallax background size
parallaxBackgroundSize: '', // CSS syntax, e.g. "2100px 900px" - currently only pixels are supported (don't use % or auto)
// Number of pixels to move the parallax background per slide
// - Calculated automatically unless specified
// - Set to 0 to disable movement along an axis
// Amount of pixels to move the parallax background per slide step,
// a value of 0 disables movement along the given axis
// These are optional, if they aren't specified they'll be calculated automatically
parallaxBackgroundHorizontal: 200,
parallaxBackgroundVertical: 50
});
```
Make sure that the background size is much bigger than screen size to allow for some scrolling. [View example](http://revealjs.com/?parallaxBackgroundImage=https%3A%2F%2Fs3.amazonaws.com%2Fhakim-static%2Freveal-js%2Freveal-parallax-1.jpg&parallaxBackgroundSize=2100px%20900px).
Make sure that the background size is much bigger than screen size to allow for some scrolling. [View example](http://lab.hakim.se/reveal-js/?parallaxBackgroundImage=https%3A%2F%2Fs3.amazonaws.com%2Fhakim-static%2Freveal-js%2Freveal-parallax-1.jpg&parallaxBackgroundSize=2100px%20900px).
@@ -673,15 +486,15 @@ You can also use different in and out transitions for the same slide:
```html
<section data-transition="slide">
The train goes on …
The train goes on …
</section>
<section data-transition="slide">
and on …
<section data-transition="slide">
and on …
</section>
<section data-transition="slide-in fade-out">
<section data-transition="slide-in fade-out">
and stops.
</section>
<section data-transition="fade-in slide-out">
<section data-transition="fade-in slide-out">
(Passengers entering and leaving)
</section>
<section data-transition="slide">
@@ -690,6 +503,9 @@ You can also use different in and out transitions for the same slide:
```
Note that this does not work with the page and cube transitions.
### Internal links
It's easy to link between slides. The first example below targets the index of another slide whereas the second targets a slide with an ID attribute (```<section id="some-slide">```):
@@ -712,7 +528,7 @@ You can also add relative navigation links, similar to the built in reveal.js co
### Fragments
Fragments are used to highlight individual elements on a slide. Every element with the class ```fragment``` will be stepped through before moving on to the next slide. Here's an example: http://revealjs.com/#/fragments
Fragments are used to highlight individual elements on a slide. Every element with the class ```fragment``` will be stepped through before moving on to the next slide. Here's an example: http://lab.hakim.se/reveal-js/#/fragments
The default fragment style is to start out invisible and fade in. This style can be changed by appending a different class to the fragment:
@@ -721,7 +537,6 @@ The default fragment style is to start out invisible and fade in. This style can
<p class="fragment grow">grow</p>
<p class="fragment shrink">shrink</p>
<p class="fragment fade-out">fade-out</p>
<p class="fragment fade-up">fade-up (also down, left and right!)</p>
<p class="fragment current-visible">visible only once</p>
<p class="fragment highlight-current-blue">blue only once</p>
<p class="fragment highlight-red">highlight-red</p>
@@ -767,41 +582,33 @@ Reveal.addEventListener( 'fragmenthidden', function( event ) {
### Code syntax highlighting
By default, Reveal is configured with [highlight.js](https://highlightjs.org/) for code syntax highlighting. To enable syntax highlighting, you'll have to load the highlight plugin ([plugin/highlight/highlight.js](plugin/highlight/highlight.js)) and a highlight.js CSS theme (Reveal comes packaged with the zenburn theme: [lib/css/zenburn.css](lib/css/zenburn.css)).
Below is an example with clojure code that will be syntax highlighted. When the `data-trim` attribute is present, surrounding whitespace is automatically removed. HTML will be escaped by default. To avoid this, for example if you are using `<mark>` to call out a line of code, add the `data-noescape` attribute to the `<code>` element.
By default, Reveal is configured with [highlight.js](http://softwaremaniacs.org/soft/highlight/en/) for code syntax highlighting. Below is an example with clojure code that will be syntax highlighted. When the `data-trim` attribute is present surrounding whitespace is automatically removed.
```html
<section>
<pre><code data-trim data-noescape>
<pre><code data-trim>
(def lazy-fib
(concat
[0 1]
<mark>((fn rfib [a b]</mark>
((fn rfib [a b]
(lazy-cons (+ a b) (rfib b (+ a b)))) 0 1)))
</code></pre>
</section>
```
### Slide number
If you would like to display the page number of the current slide you can do so using the ```slideNumber``` and ```showSlideNumber``` configuration values.
If you would like to display the page number of the current slide you can do so using the ```slideNumber``` configuration value.
```javascript
// Shows the slide number using default formatting
Reveal.configure({ slideNumber: true });
// Slide number formatting can be configured using these variables:
// "h.v": horizontal . vertical slide number (default)
// "h/v": horizontal / vertical slide number
// "c": flattened slide number
// "c/t": flattened slide number / total slides
Reveal.configure({ slideNumber: 'c/t' });
// Control which views the slide number displays on using the "showSlideNumber" value:
// "all": show on all views (default)
// "speaker": only show slide numbers on speaker notes view
// "print": only show slide numbers when printing to PDF
Reveal.configure({ showSlideNumber: 'speaker' });
// h: current slide's horizontal index
// v: current slide's vertical index
// c: current slide index (flattened)
// t: total number of slides (flattened)
Reveal.configure({ slideNumber: 'c / t' });
```
@@ -819,26 +626,20 @@ Reveal.addEventListener( 'overviewhidden', function( event ) { /* ... */ } );
Reveal.toggleOverview();
```
### Fullscreen mode
Just press »F« on your keyboard to show your presentation in fullscreen mode. Press the »ESC« key to exit fullscreen mode.
### Embedded media
Embedded HTML5 `<video>`/`<audio>` and YouTube iframes are automatically paused when you navigate away from a slide. This can be disabled by decorating your element with a `data-ignore` attribute.
Add `data-autoplay` to your media element if you want it to automatically start playing when the slide is shown:
```html
<video data-autoplay src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"></video>
```
If you want to enable or disable autoplay globally, for all embedded media, you can use the `autoPlayMedia` configuration option. If you set this to `true` ALL media will autoplay regardless of individual `data-autoplay` attributes. If you initialize with `autoPlayMedia: false` NO media will autoplay.
Note that embedded HTML5 `<video>`/`<audio>` and YouTube/Vimeo iframes are automatically paused when you navigate away from a slide. This can be disabled by decorating your element with a `data-ignore` attribute.
### Embedded iframes
reveal.js automatically pushes two [post messages](https://developer.mozilla.org/en-US/docs/Web/API/Window.postMessage) to embedded iframes. ```slide:start``` when the slide containing the iframe is made visible and ```slide:stop``` when it is hidden.
Additionally the framework automatically pushes two [post messages](https://developer.mozilla.org/en-US/docs/Web/API/Window.postMessage) to all iframes, ```slide:start``` when the slide containing the iframe is made visible and ```slide:stop``` when it is hidden.
### Stretching elements
@@ -868,7 +669,7 @@ When reveal.js runs inside of an iframe it can optionally bubble all of its even
```javascript
window.addEventListener( 'message', function( event ) {
var data = JSON.parse( event.data );
if( data.namespace === 'reveal' && data.eventName ==='slidechanged' ) {
if( data.namespace === 'reveal' && data.eventName ='slidechanged' ) {
// Slide changed, see data.state for slide number
}
} );
@@ -891,36 +692,17 @@ Reveal.initialize({
## PDF Export
Presentations can be exported to PDF via a special print stylesheet. This feature requires that you use [Google Chrome](http://google.com/chrome) or [Chromium](https://www.chromium.org/Home) and to be serving the presentation from a webserver.
Presentations can be exported to PDF via a special print stylesheet. This feature requires that you use [Google Chrome](http://google.com/chrome) or [Chromium](https://www.chromium.org/Home).
Here's an example of an exported presentation that's been uploaded to SlideShare: http://www.slideshare.net/hakimel/revealjs-300.
### Page size
Export dimensions are inferred from the configured [presentation size](#presentation-size). Slides that are too tall to fit within a single page will expand onto multiple pages. You can limit how many pages a slide may expand onto using the `pdfMaxPagesPerSlide` config option, for example `Reveal.configure({ pdfMaxPagesPerSlide: 1 })` ensures that no slide ever grows to more than one printed page.
1. Open your presentation with `print-pdf` included anywhere in the query string. This triggers the default index HTML to load the PDF print stylesheet ([css/print/pdf.css](https://github.com/hakimel/reveal.js/blob/master/css/print/pdf.css)). You can test this with [lab.hakim.se/reveal-js?print-pdf](http://lab.hakim.se/reveal-js?print-pdf).
2. Open the in-browser print dialog (CMD+P).
3. Change the **Destination** setting to **Save as PDF**.
4. Change the **Layout** to **Landscape**.
5. Change the **Margins** to **None**.
6. Click **Save**.
### Print stylesheet
To enable the PDF print capability in your presentation, the special print stylesheet at [/css/print/pdf.css](https://github.com/hakimel/reveal.js/blob/master/css/print/pdf.css) must be loaded. The default index.html file handles this for you when `print-pdf` is included in the query string. If you're using a different HTML template, you can add this to your HEAD:
```html
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
```
### Instructions
1. Open your presentation with `print-pdf` included in the query string i.e. http://localhost:8000/?print-pdf. You can test this with [revealjs.com?print-pdf](http://revealjs.com?print-pdf).
* If you want to include [speaker notes](#speaker-notes) in your export, you can append `showNotes=true` to the query string: http://localhost:8000/?print-pdf&showNotes=true
1. Open the in-browser print dialog (CTRL/CMD+P).
1. Change the **Destination** setting to **Save as PDF**.
1. Change the **Layout** to **Landscape**.
1. Change the **Margins** to **None**.
1. Enable the **Background graphics** option.
1. Click **Save**.
![Chrome Print Settings](https://s3.amazonaws.com/hakim-static/reveal-js/pdf-print-settings-2.png)
![Chrome Print Settings](https://s3.amazonaws.com/hakim-static/reveal-js/pdf-print-settings.png)
Alternatively you can use the [decktape](https://github.com/astefanutti/decktape) project.
@@ -951,12 +733,8 @@ If you want to add a theme of your own see the instructions here: [/css/theme/RE
reveal.js comes with a speaker notes plugin which can be used to present per-slide notes in a separate browser window. The notes window also gives you a preview of the next upcoming slide so it may be helpful even if you haven't written any notes. Press the 's' key on your keyboard to open the notes window.
A speaker timer starts as soon as the speaker view is opened. You can reset it to 00:00:00 at any time by simply clicking/tapping on it.
Notes are defined by appending an ```<aside>``` element to a slide as seen below. You can add the ```data-markdown``` attribute to the aside element if you prefer writing notes using Markdown.
Alternatively you can add your notes in a `data-notes` attribute on the slide. Like `<section data-notes="Something important"></section>`.
When used locally, this feature requires that reveal.js [runs from a local web server](#full-setup).
```html
@@ -983,23 +761,6 @@ Note:
This will only display in the notes window.
```
#### Share and Print Speaker Notes
Notes are only visible to the speaker inside of the speaker view. If you wish to share your notes with others you can initialize reveal.js with the `showNotes` config value set to `true`. Notes will appear along the bottom of the presentations.
When `showNotes` is enabled notes are also included when you [export to PDF](https://github.com/hakimel/reveal.js#pdf-export). By default, notes are printed in a semi-transparent box on top of the slide. If you'd rather print them on a separate page after the slide, set `showNotes: "separate-page"`.
#### Speaker notes clock and timers
The speaker notes window will also show:
- Time elapsed since the beginning of the presentation. If you hover the mouse above this section, a timer reset button will appear.
- Current wall-clock time
- (Optionally) a pacing timer which indicates whether the current pace of the presentation is on track for the right timing (shown in green), and if not, whether the presenter should speed up (shown in red) or has the luxury of slowing down (blue).
The pacing timer can be enabled by configuring by the `defaultTiming` parameter in the `Reveal` configuration block, which specifies the number of seconds per slide. 120 can be a reasonable rule of thumb. Timings can also be given per slide `<section>` by setting the `data-timing` attribute. Both values are in numbers of seconds.
## Server Side Speaker Notes
In some cases it can be desirable to run notes on a separate device from the one you're presenting on. The Node.js-based notes plugin lets you do this using the same note definitions as its client side counterpart. Include the required scripts by adding the following dependencies:
@@ -1017,14 +778,14 @@ Reveal.initialize({
Then:
1. Install [Node.js](http://nodejs.org/) (4.0.0 or later)
1. Install [Node.js](http://nodejs.org/)
2. Run ```npm install```
3. Run ```node plugin/notes-server```
## Multiplexing
The multiplex plugin allows your audience to view the slides of the presentation you are controlling on their own phone, tablet or laptop. As the master presentation navigates the slides, all client presentations will update in real time. See a demo at [https://reveal-js-multiplex-ccjbegmaii.now.sh/](https://reveal-js-multiplex-ccjbegmaii.now.sh/).
The multiplex plugin allows your audience to view the slides of the presentation you are controlling on their own phone, tablet or laptop. As the master presentation navigates the slides, all client presentations will update in real time. See a demo at [http://revealjs.jit.su/](http://revealjs.jit.su).
The multiplex plugin needs the following 3 things to operate:
@@ -1035,7 +796,7 @@ The multiplex plugin needs the following 3 things to operate:
More details:
#### Master presentation
Served from a static file server accessible (preferably) only to the presenter. This need only be on your (the presenter's) computer. (It's safer to run the master presentation from your own computer, so if the venue's Internet goes down it doesn't stop the show.) An example would be to execute the following commands in the directory of your master presentation:
Served from a static file server accessible (preferably) only to the presenter. This need only be on your (the presenter's) computer. (It's safer to run the master presentation from your own computer, so if the venue's Internet goes down it doesn't stop the show.) An example would be to execute the following commands in the directory of your master presentation:
1. ```npm install node-static```
2. ```static```
@@ -1053,12 +814,12 @@ Reveal.initialize({
// Example values. To generate your own, see the socket.io server instructions.
secret: '13652805320794272084', // Obtained from the socket.io server. Gives this (the master) control of the presentation
id: '1ea875674b17ca76', // Obtained from socket.io server
url: 'https://reveal-js-multiplex-ccjbegmaii.now.sh' // Location of socket.io server
url: 'revealjs.jit.su:80' // Location of socket.io server
},
// Don't forget to add the dependencies
dependencies: [
{ src: '//cdn.socket.io/socket.io-1.3.5.js', async: true },
{ src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js', async: true },
{ src: 'plugin/multiplex/master.js', async: true },
// and if you want speaker notes
@@ -1081,12 +842,12 @@ Reveal.initialize({
// Example values. To generate your own, see the socket.io server instructions.
secret: null, // null so the clients do not have control of the master presentation
id: '1ea875674b17ca76', // id, obtained from socket.io server
url: 'https://reveal-js-multiplex-ccjbegmaii.now.sh' // Location of socket.io server
url: 'revealjs.jit.su:80' // Location of socket.io server
},
// Don't forget to add the dependencies
dependencies: [
{ src: '//cdn.socket.io/socket.io-1.3.5.js', async: true },
{ src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js', async: true },
{ src: 'plugin/multiplex/client.js', async: true }
// other dependencies...
@@ -1100,17 +861,15 @@ Server that receives the slideChanged events from the master presentation and br
1. ```npm install```
2. ```node plugin/multiplex```
Or you can use the socket.io server at [https://reveal-js-multiplex-ccjbegmaii.now.sh/](https://reveal-js-multiplex-ccjbegmaii.now.sh/).
Or you use the socket.io server at [http://revealjs.jit.su](http://revealjs.jit.su).
You'll need to generate a unique secret and token pair for your master and client presentations. To do so, visit ```http://example.com/token```, where ```http://example.com``` is the location of your socket.io server. Or if you're going to use the socket.io server at [https://reveal-js-multiplex-ccjbegmaii.now.sh/](https://reveal-js-multiplex-ccjbegmaii.now.sh/), visit [https://reveal-js-multiplex-ccjbegmaii.now.sh/token](https://reveal-js-multiplex-ccjbegmaii.now.sh/token).
You'll need to generate a unique secret and token pair for your master and client presentations. To do so, visit ```http://example.com/token```, where ```http://example.com``` is the location of your socket.io server. Or if you're going to use the socket.io server at [http://revealjs.jit.su](http://revealjs.jit.su), visit [http://revealjs.jit.su/token](http://revealjs.jit.su/token).
You are very welcome to point your presentations at the Socket.io server running at [https://reveal-js-multiplex-ccjbegmaii.now.sh/](https://reveal-js-multiplex-ccjbegmaii.now.sh/), but availability and stability are not guaranteed.
For anything mission critical I recommend you run your own server. The easiest way to do this is by installing [now](https://zeit.co/now). With that installed, deploying your own Multiplex server is as easy running the following command from the reveal.js folder: `now plugin/multiplex`.
You are very welcome to point your presentations at the Socket.io server running at [http://revealjs.jit.su](http://revealjs.jit.su), but availability and stability are not guaranteed. For anything mission critical I recommend you run your own server. It is simple to deploy to nodejitsu, heroku, your own environment, etc.
##### socket.io server as file static server
The socket.io server can play the role of static file server for your client presentation, as in the example at [https://reveal-js-multiplex-ccjbegmaii.now.sh/](https://reveal-js-multiplex-ccjbegmaii.now.sh/). (Open [https://reveal-js-multiplex-ccjbegmaii.now.sh/](https://reveal-js-multiplex-ccjbegmaii.now.sh/) in two browsers. Navigate through the slides on one, and the other will update to match.)
The socket.io server can play the role of static file server for your client presentation, as in the example at [http://revealjs.jit.su](http://revealjs.jit.su). (Open [http://revealjs.jit.su](http://revealjs.jit.su) in two browsers. Navigate through the slides on one, and the other will update to match.)
Example configuration:
```javascript
@@ -1126,14 +885,14 @@ Reveal.initialize({
// Don't forget to add the dependencies
dependencies: [
{ src: '//cdn.socket.io/socket.io-1.3.5.js', async: true },
{ src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js', async: true },
{ src: 'plugin/multiplex/client.js', async: true }
// other dependencies...
]
```
It can also play the role of static file server for your master presentation and client presentations at the same time (as long as you don't want to use speaker notes). (Open [https://reveal-js-multiplex-ccjbegmaii.now.sh/](https://reveal-js-multiplex-ccjbegmaii.now.sh/) in two browsers. Navigate through the slides on one, and the other will update to match. Navigate through the slides on the second, and the first will update to match.) This is probably not desirable, because you don't want your audience to mess with your slides while you're presenting. ;)
It can also play the role of static file server for your master presentation and client presentations at the same time (as long as you don't want to use speaker notes). (Open [http://revealjs.jit.su](http://revealjs.jit.su) in two browsers. Navigate through the slides on one, and the other will update to match. Navigate through the slides on the second, and the first will update to match.) This is probably not desirable, because you don't want your audience to mess with your slides while you're presenting. ;)
Example configuration:
```javascript
@@ -1149,7 +908,7 @@ Reveal.initialize({
// Don't forget to add the dependencies
dependencies: [
{ src: '//cdn.socket.io/socket.io-1.3.5.js', async: true },
{ src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.16/socket.io.min.js', async: true },
{ src: 'plugin/multiplex/master.js', async: true },
{ src: 'plugin/multiplex/client.js', async: true }
@@ -1158,11 +917,56 @@ Reveal.initialize({
});
```
## Leap Motion
The Leap Motion plugin lets you utilize your [Leap Motion](https://www.leapmotion.com/) device to control basic navigation of your presentation. The gestures currently supported are:
##### 1 to 2 fingers
Pointer &mdash; Point to anything on screen. Move your finger past the device to expand the pointer.
##### 1 hand + 3 or more fingers (left/right/up/down)
Navigate through your slides. See config options to invert movements.
##### 2 hands upwards
Toggle the overview mode. Do it a second time to exit the overview.
#### Config Options
You can edit the following options:
| Property | Default | Description
| ----------------- |:-----------------:| :-------------
| autoCenter | true | Center the pointer based on where you put your finger into the leap motions detection field.
| gestureDelay | 500 | How long to delay between gestures in milliseconds.
| naturalSwipe | true | Swipe as though you were touching a touch screen. Set to false to invert.
| pointerColor | #00aaff | The color of the pointer.
| pointerOpacity | 0.7 | The opacity of the pointer.
| pointerSize | 15 | The minimum height and width of the pointer.
| pointerTolerance | 120 | Bigger = slower pointer.
Example configuration:
```js
Reveal.initialize({
// other options...
leap: {
naturalSwipe : false, // Invert swipe gestures
pointerOpacity : 0.5, // Set pointer opacity to 0.5
pointerColor : '#d80000' // Red pointer
},
dependencies: [
{ src: 'plugin/leap/leap.js', async: true }
]
});
```
## MathJax
If you want to display math equations in your presentation you can easily do so by including this plugin. The plugin is a very thin wrapper around the [MathJax](http://www.mathjax.org/) library. To use it you'll need to include it as a reveal.js dependency, [find our more about dependencies here](#dependencies).
The plugin defaults to using [LaTeX](http://en.wikipedia.org/wiki/LaTeX) but that can be adjusted through the ```math``` configuration object. Note that MathJax is loaded from a remote server. If you want to use it offline you'll need to download a copy of the library and adjust the ```mathjax``` configuration value.
The plugin defaults to using [LaTeX](http://en.wikipedia.org/wiki/LaTeX) but that can be adjusted through the ```math``` configuration object. Note that MathJax is loaded from a remote server. If you want to use it offline you'll need to download a copy of the library and adjust the ```mathjax``` configuration value.
Below is an example of how the plugin can be configured. If you don't intend to change these values you do not need to include the ```math``` config object at all.
@@ -1172,10 +976,10 @@ Reveal.initialize({
// other options ...
math: {
mathjax: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js',
mathjax: 'https://cdn.mathjax.org/mathjax/latest/MathJax.js',
config: 'TeX-AMS_HTML-full' // See http://docs.mathjax.org/en/latest/config-files.html
},
dependencies: [
{ src: 'plugin/math/math.js', async: true }
]
@@ -1205,31 +1009,33 @@ The core of reveal.js is very easy to install. You'll simply need to download a
Some reveal.js features, like external Markdown and speaker notes, require that presentations run from a local web server. The following instructions will set up such a server as well as all of the development tasks needed to make edits to the reveal.js source code.
1. Install [Node.js](http://nodejs.org/) (4.0.0 or later)
1. Install [Node.js](http://nodejs.org/)
1. Clone the reveal.js repository
2. Install [Grunt](http://gruntjs.com/getting-started#installing-the-cli)
4. Clone the reveal.js repository
```sh
$ git clone https://github.com/hakimel/reveal.js.git
```
1. Navigate to the reveal.js folder
5. Navigate to the reveal.js folder
```sh
$ cd reveal.js
```
1. Install dependencies
6. Install dependencies
```sh
$ npm install
```
1. Serve the presentation and monitor source files for changes
7. Serve the presentation and monitor source files for changes
```sh
$ npm start
$ grunt serve
```
1. Open <http://localhost:8000> to view your presentation
8. Open <http://localhost:8000> to view your presentation
You can change the port by using `npm start -- --port=8001`.
You can change the port by using `grunt serve --port 8001`.
### Folder Structure
@@ -1243,4 +1049,4 @@ Some reveal.js features, like external Markdown and speaker notes, require that
MIT licensed
Copyright (C) 2017 Hakim El Hattab, http://hakim.se
Copyright (C) 2015 Hakim El Hattab, http://hakim.se
@@ -1,18 +1,18 @@
{
"name": "reveal.js",
"version": "3.6.0",
"version": "3.1.0",
"main": [
"js/reveal.js",
"css/reveal.css"
],
"homepage": "http://revealjs.com",
"homepage": "http://lab.hakim.se/reveal-js/",
"license": "MIT",
"description": "The HTML Presentation Framework",
"authors": [
"Hakim El Hattab <hakim.elhattab@gmail.com>"
],
"dependencies": {
"headjs": "~1.0.3"
"headjs": "~0.9.6"
},
"repository": {
"type": "git",
@@ -38,8 +38,7 @@
.share-reveal,
.state-background,
.reveal .progress,
.reveal .backgrounds,
.reveal .slide-number {
.reveal .backgrounds {
display: none !important;
}
@@ -142,7 +141,7 @@
.reveal .slides section {
visibility: visible !important;
position: static !important;
width: auto !important;
width: 100% !important;
height: auto !important;
display: block !important;
overflow: visible !important;
@@ -200,4 +199,4 @@
font-size: 0.8em;
}
}
}
@@ -1,9 +1,15 @@
/**
* This stylesheet is used to print reveal.js
* presentations to PDF.
*
* https://github.com/hakimel/reveal.js#pdf-export
*/
/* Default Print Stylesheet Template
by Rob Glazebrook of CSSnewbie.com
Last Updated: June 4, 2008
Feel free (nay, compelled) to edit, append, and
manipulate this file as you see fit. */
/* SECTION 1: Set default width, margin, float, and
background. This prevents elements from extending
beyond the edge of the printed page, and prevents
unnecessary background images from printing */
* {
-webkit-print-color-adjust: exact;
@@ -23,10 +29,12 @@ html {
overflow: visible;
}
/* Remove any elements not needed in print. */
/* SECTION 2: Remove any elements not needed in print.
This would include navigation, ads, sidebars, etc. */
.nestedarrow,
.reveal .controls,
.reveal .progress,
.reveal .slide-number,
.reveal .playback,
.reveal.overview,
.fork-reveal,
@@ -35,7 +43,16 @@ html {
display: none !important;
}
h1, h2, h3, h4, h5, h6 {
/* SECTION 3: Set body font face, size, and color.
Consider using a serif font for readability. */
body, p, td, li, div {
}
/* SECTION 4: Set heading font face, sizes, and color.
Differentiate your headings from your body text.
Perhaps use a large sans-serif for distinction. */
h1,h2,h3,h4,h5,h6 {
text-shadow: 0 0 0 #000 !important;
}
@@ -44,6 +61,8 @@ h1, h2, h3, h4, h5, h6 {
font-family: Courier, 'Courier New', monospace !important;
}
/* SECTION 5: more reveal.js specific additions by @skypanther */
ul, ol, div, p {
visibility: visible;
position: static;
@@ -60,9 +79,8 @@ ul, ol, div, p {
}
.reveal .slides {
position: static;
width: 100% !important;
height: auto !important;
zoom: 1 !important;
width: 100%;
height: auto;
left: auto;
top: auto;
@@ -82,19 +100,13 @@ ul, ol, div, p {
-ms-perspective-origin: 50% 50%;
perspective-origin: 50% 50%;
}
.reveal .slides .pdf-page {
position: relative;
overflow: hidden;
z-index: 1;
page-break-after: always;
}
.reveal .slides section {
page-break-after: always !important;
visibility: visible !important;
position: relative !important;
display: block !important;
position: absolute !important;
position: relative !important;
margin: 0 !important;
padding: 0 !important;
@@ -113,66 +125,33 @@ ul, ol, div, p {
-ms-transform: none !important;
transform: none !important;
}
.reveal section.stack {
position: relative !important;
margin: 0 !important;
padding: 0 !important;
page-break-after: avoid !important;
height: auto !important;
min-height: auto !important;
}
.reveal img {
box-shadow: none;
}
.reveal .roll {
overflow: visible;
line-height: 1em;
}
/* Slide backgrounds are placed inside of their slide when exporting to PDF */
.reveal .slide-background {
.reveal section .slide-background {
display: block !important;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: auto !important;
z-index: -1;
}
/* Display slide speaker notes when 'showNotes' is enabled */
.reveal.show-notes {
max-width: none;
max-height: none;
}
.reveal .speaker-notes-pdf {
display: block;
width: 100%;
height: auto;
max-height: none;
top: auto;
right: auto;
bottom: auto;
left: auto;
z-index: 100;
}
/* Layout option which makes notes appear on a separate page */
.reveal .speaker-notes-pdf[data-layout="separate-page"] {
/* All elements should be above the slide-background */
.reveal section>* {
position: relative;
color: inherit;
background-color: transparent;
padding: 20px;
page-break-after: always;
border: 0;
z-index: 1;
}
/* Display slide numbers when 'slideNumber' is enabled */
.reveal .slide-number-pdf {
display: block;
position: absolute;
font-size: 14px;
}
@@ -1,9 +1,9 @@
/*!
* reveal.js
* http://revealjs.com
* http://lab.hakim.se/reveal-js
* MIT licensed
*
* Copyright (C) 2017 Hakim El Hattab, http://hakim.se
* Copyright (C) 2015 Hakim El Hattab, http://hakim.se
*/
@@ -23,7 +23,7 @@ html, body, .reveal div, .reveal span, .reveal applet, .reveal object, .reveal i
.reveal article, .reveal aside, .reveal canvas, .reveal details, .reveal embed,
.reveal figure, .reveal figcaption, .reveal footer, .reveal header, .reveal hgroup,
.reveal menu, .reveal nav, .reveal output, .reveal ruby, .reveal section, .reveal summary,
.reveal time, .reveal mark, .reveal audio, .reveal video {
.reveal time, .reveal mark, .reveal audio, video {
margin: 0;
padding: 0;
border: 0;
@@ -69,13 +69,13 @@ body {
&.visible {
opacity: 1;
visibility: inherit;
visibility: visible;
}
}
.reveal .slides section .fragment.grow {
opacity: 1;
visibility: inherit;
visibility: visible;
&.visible {
transform: scale( 1.3 );
@@ -84,7 +84,7 @@ body {
.reveal .slides section .fragment.shrink {
opacity: 1;
visibility: inherit;
visibility: visible;
&.visible {
transform: scale( 0.7 );
@@ -101,7 +101,7 @@ body {
.reveal .slides section .fragment.fade-out {
opacity: 1;
visibility: inherit;
visibility: visible;
&.visible {
opacity: 0;
@@ -111,62 +111,29 @@ body {
.reveal .slides section .fragment.semi-fade-out {
opacity: 1;
visibility: inherit;
visibility: visible;
&.visible {
opacity: 0.5;
visibility: inherit;
visibility: visible;
}
}
.reveal .slides section .fragment.strike {
opacity: 1;
visibility: inherit;
&.visible {
text-decoration: line-through;
}
}
.reveal .slides section .fragment.fade-up {
transform: translate(0, 20%);
&.visible {
transform: translate(0, 0);
}
}
.reveal .slides section .fragment.fade-down {
transform: translate(0, -20%);
&.visible {
transform: translate(0, 0);
}
}
.reveal .slides section .fragment.fade-right {
transform: translate(-20%, 0);
&.visible {
transform: translate(0, 0);
}
}
.reveal .slides section .fragment.fade-left {
transform: translate(20%, 0);
&.visible {
transform: translate(0, 0);
}
}
.reveal .slides section .fragment.current-visible {
opacity: 0;
visibility: hidden;
&.current-fragment {
opacity: 1;
visibility: inherit;
visibility: visible;
}
}
@@ -177,7 +144,7 @@ body {
.reveal .slides section .fragment.highlight-blue,
.reveal .slides section .fragment.highlight-current-blue {
opacity: 1;
visibility: inherit;
visibility: visible;
}
.reveal .slides section .fragment.highlight-red.visible {
color: #ff2c2d
@@ -235,271 +202,80 @@ body {
* CONTROLS
*********************************************/
@keyframes bounce-right {
0%, 10%, 25%, 40%, 50% {transform: translateX(0);}
20% {transform: translateX(10px);}
30% {transform: translateX(-5px);}
}
@keyframes bounce-down {
0%, 10%, 25%, 40%, 50% {transform: translateY(0);}
20% {transform: translateY(10px);}
30% {transform: translateY(-5px);}
}
$controlArrowSize: 3.6em;
$controlArrowSpacing: 1.4em;
$controlArrowLength: 2.6em;
$controlArrowThickness: 0.5em;
$controlsArrowAngle: 45deg;
$controlsArrowAngleHover: 40deg;
$controlsArrowAngleActive: 36deg;
@mixin controlsArrowTransform( $angle ) {
&:before {
transform: translateX(($controlArrowSize - $controlArrowLength)/2) translateY(($controlArrowSize - $controlArrowThickness)/2) rotate( $angle );
}
&:after {
transform: translateX(($controlArrowSize - $controlArrowLength)/2) translateY(($controlArrowSize - $controlArrowThickness)/2) rotate( -$angle );
}
}
.reveal .controls {
$spacing: 12px;
display: none;
position: fixed;
width: 110px;
height: 110px;
z-index: 30;
right: 10px;
bottom: 10px;
-webkit-user-select: none;
}
.reveal .controls div {
position: absolute;
top: auto;
bottom: $spacing;
right: $spacing;
left: auto;
z-index: 1;
color: #000;
pointer-events: none;
font-size: 10px;
opacity: 0.05;
width: 0;
height: 0;
border: 12px solid transparent;
transform: scale(.9999);
transition: all 0.2s ease;
button {
position: absolute;
padding: 0;
background-color: transparent;
border: 0;
outline: 0;
cursor: pointer;
color: currentColor;
transform: scale(.9999);
transition: color 0.2s ease,
opacity 0.2s ease,
transform 0.2s ease;
z-index: 2; // above slides
pointer-events: auto;
font-size: inherit;
visibility: hidden;
opacity: 0;
-webkit-appearance: none;
-webkit-tap-highlight-color: rgba( 0, 0, 0, 0 );
}
.controls-arrow:before,
.controls-arrow:after {
content: '';
position: absolute;
top: 0;
left: 0;
width: $controlArrowLength;
height: $controlArrowThickness;
border-radius: $controlArrowThickness/2;
background-color: currentColor;
transition: all 0.15s ease, background-color 0.8s ease;
transform-origin: floor(($controlArrowThickness/2)*10)/10 50%;
will-change: transform;
}
.controls-arrow {
position: relative;
width: $controlArrowSize;
height: $controlArrowSize;
@include controlsArrowTransform( $controlsArrowAngle );
&:hover {
@include controlsArrowTransform( $controlsArrowAngleHover );
}
&:active {
@include controlsArrowTransform( $controlsArrowAngleActive );
}
}
.navigate-left {
right: $controlArrowSize + $controlArrowSpacing*2;
bottom: $controlArrowSpacing + $controlArrowSize/2;
transform: translateX( -10px );
}
.navigate-right {
right: 0;
bottom: $controlArrowSpacing + $controlArrowSize/2;
transform: translateX( 10px );
.controls-arrow {
transform: rotate( 180deg );
}
&.highlight {
animation: bounce-right 2s 50 both ease-out;
}
}
.navigate-up {
right: $controlArrowSpacing + $controlArrowSize/2;
bottom: $controlArrowSpacing*2 + $controlArrowSize;
transform: translateY( -10px );
.controls-arrow {
transform: rotate( 90deg );
}
}
.navigate-down {
right: $controlArrowSpacing + $controlArrowSize/2;
bottom: 0;
transform: translateY( 10px );
.controls-arrow {
transform: rotate( -90deg );
}
&.highlight {
animation: bounce-down 2s 50 both ease-out;
}
}
// Back arrow style: "faded":
// Deemphasize backwards navigation arrows in favor of drawing
// attention to forwards navigation
&[data-controls-back-arrows="faded"] .navigate-left.enabled,
&[data-controls-back-arrows="faded"] .navigate-up.enabled {
opacity: 0.3;
&:hover {
opacity: 1;
}
}
// Back arrow style: "hidden":
// Never show arrows for backwards navigation
&[data-controls-back-arrows="hidden"] .navigate-left.enabled,
&[data-controls-back-arrows="hidden"] .navigate-up.enabled {
opacity: 0;
visibility: hidden;
}
// Any control button that can be clicked is "enabled"
.enabled {
visibility: visible;
opacity: 0.9;
cursor: pointer;
transform: none;
}
// Any control button that leads to showing or hiding
// a fragment
.enabled.fragmented {
opacity: 0.5;
}
.enabled:hover,
.enabled.fragmented:hover {
opacity: 1;
}
-webkit-tap-highlight-color: rgba( 0, 0, 0, 0 );
}
// Adjust the layout when there are no vertical slides
.reveal:not(.has-vertical-slides) .controls .navigate-left {
bottom: $controlArrowSpacing;
right: 0.5em + $controlArrowSpacing + $controlArrowSize;
.reveal .controls div.enabled {
opacity: 0.7;
cursor: pointer;
}
.reveal:not(.has-vertical-slides) .controls .navigate-right {
bottom: $controlArrowSpacing;
right: 0.5em;
.reveal .controls div.enabled:active {
margin-top: 1px;
}
// Adjust the layout when there are no horizontal slides
.reveal:not(.has-horizontal-slides) .controls .navigate-up {
right: $controlArrowSpacing;
bottom: $controlArrowSpacing + $controlArrowSize;
}
.reveal:not(.has-horizontal-slides) .controls .navigate-down {
right: $controlArrowSpacing;
bottom: 0.5em;
}
.reveal .controls div.navigate-left {
top: 42px;
// Invert arrows based on background color
.reveal.has-dark-background .controls {
color: #fff;
}
.reveal.has-light-background .controls {
color: #000;
}
// Disable active states on touch devices
.reveal.no-hover .controls .controls-arrow:hover,
.reveal.no-hover .controls .controls-arrow:active {
@include controlsArrowTransform( $controlsArrowAngle );
}
// Edge aligned controls layout
@media screen and (min-width: 500px) {
$spacing: 8px;
.reveal .controls[data-controls-layout="edges"] {
& {
top: 0;
right: 0;
bottom: 0;
left: 0;
}
.navigate-left,
.navigate-right,
.navigate-up,
.navigate-down {
bottom: auto;
right: auto;
}
.navigate-left {
top: 50%;
left: $spacing;
margin-top: -$controlArrowSize/2;
}
.navigate-right {
top: 50%;
right: $spacing;
margin-top: -$controlArrowSize/2;
}
.navigate-up {
top: $spacing;
left: 50%;
margin-left: -$controlArrowSize/2;
}
.navigate-down {
bottom: $spacing;
left: 50%;
margin-left: -$controlArrowSize/2;
}
border-right-width: 22px;
border-right-color: #000;
}
.reveal .controls div.navigate-left.fragmented {
opacity: 0.3;
}
}
.reveal .controls div.navigate-right {
left: 74px;
top: 42px;
border-left-width: 22px;
border-left-color: #000;
}
.reveal .controls div.navigate-right.fragmented {
opacity: 0.3;
}
.reveal .controls div.navigate-up {
left: 42px;
border-bottom-width: 22px;
border-bottom-color: #000;
}
.reveal .controls div.navigate-up.fragmented {
opacity: 0.3;
}
.reveal .controls div.navigate-down {
left: 42px;
top: 74px;
border-top-width: 22px;
border-top-color: #000;
}
.reveal .controls div.navigate-down.fragmented {
opacity: 0.3;
}
/*********************************************
@@ -507,7 +283,7 @@ $controlsArrowAngleActive: 36deg;
*********************************************/
.reveal .progress {
position: absolute;
position: fixed;
display: none;
height: 3px;
width: 100%;
@@ -516,22 +292,21 @@ $controlsArrowAngleActive: 36deg;
z-index: 10;
background-color: rgba( 0, 0, 0, 0.2 );
color: #fff;
}
.reveal .progress:after {
content: '';
display: block;
position: absolute;
height: 10px;
height: 20px;
width: 100%;
top: -10px;
top: -20px;
}
.reveal .progress span {
display: block;
height: 100%;
width: 0px;
background-color: currentColor;
background-color: #000;
transition: width 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
}
@@ -542,19 +317,11 @@ $controlsArrowAngleActive: 36deg;
.reveal .slide-number {
position: fixed;
display: block;
right: 8px;
bottom: 8px;
right: 15px;
bottom: 15px;
opacity: 0.5;
z-index: 31;
font-family: Helvetica, sans-serif;
font-size: 12px;
line-height: 1;
color: #fff;
background-color: rgba( 0, 0, 0, 0.4 );
padding: 5px;
}
.reveal .slide-number-delimiter {
margin: 0 3px;
}
/*********************************************
@@ -569,16 +336,6 @@ $controlsArrowAngleActive: 36deg;
touch-action: none;
}
// Mobile Safari sometimes overlays a header at the top
// of the page when in landscape mode. Using fixed
// positioning ensures that reveal.js reduces its height
// when this header is visible.
@media only screen and (orientation : landscape) {
.reveal.ua-iphone {
position: fixed;
}
}
.reveal .slides {
position: absolute;
width: 100%;
@@ -588,7 +345,6 @@ $controlsArrowAngleActive: 36deg;
bottom: 0;
left: 0;
margin: auto;
pointer-events: none;
overflow: visible;
z-index: 1;
@@ -607,10 +363,9 @@ $controlsArrowAngleActive: 36deg;
position: absolute;
width: 100%;
padding: 20px 0px;
pointer-events: auto;
z-index: 10;
transform-style: flat;
transform-style: preserve-3d;
transition: transform-origin 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985),
transform 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985),
visibility 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985),
@@ -645,13 +400,6 @@ $controlsArrowAngleActive: 36deg;
opacity: 1;
}
.reveal .slides>section:empty,
.reveal .slides>section>section:empty,
.reveal .slides>section[data-background-interactive],
.reveal .slides>section>section[data-background-interactive] {
pointer-events: none;
}
.reveal.center,
.reveal.center .slides,
.reveal.center .slides section {
@@ -684,14 +432,8 @@ $controlsArrowAngleActive: 36deg;
*********************************************/
@mixin transition-global($style) {
.reveal .slides section[data-transition=#{$style}],
.reveal.#{$style} .slides section:not([data-transition]) {
@content;
}
}
@mixin transition-stack($style) {
.reveal .slides section[data-transition=#{$style}].stack,
.reveal.#{$style} .slides section.stack {
.reveal .slides>section[data-transition=#{$style}],
.reveal.#{$style} .slides>section:not([data-transition]) {
@content;
}
}
@@ -754,10 +496,6 @@ $controlsArrowAngleActive: 36deg;
*********************************************/
@each $stylename in default, convex {
@include transition-stack(#{$stylename}) {
transform-style: preserve-3d;
}
@include transition-horizontal-past(#{$stylename}) {
transform: translate3d(-100%, 0, 0) rotateY(-90deg) translate3d(-100%, 0, 0);
}
@@ -776,10 +514,6 @@ $controlsArrowAngleActive: 36deg;
* CONCAVE TRANSITION
*********************************************/
@include transition-stack(concave) {
transform-style: preserve-3d;
}
@include transition-horizontal-past(concave) {
transform: translate3d(-100%, 0, 0) rotateY(90deg) translate3d(-100%, 0, 0);
}
@@ -819,10 +553,6 @@ $controlsArrowAngleActive: 36deg;
/*********************************************
* CUBE TRANSITION
*
* WARNING:
* this is deprecated and will be removed in a
* future version.
*********************************************/
.reveal.cube .slides {
@@ -834,7 +564,6 @@ $controlsArrowAngleActive: 36deg;
min-height: 700px;
backface-visibility: hidden;
box-sizing: border-box;
transform-style: preserve-3d;
}
.reveal.center.cube .slides section {
min-height: 0;
@@ -895,10 +624,6 @@ $controlsArrowAngleActive: 36deg;
/*********************************************
* PAGE TRANSITION
*
* WARNING:
* this is deprecated and will be removed in a
* future version.
*********************************************/
.reveal.page .slides {
@@ -910,7 +635,6 @@ $controlsArrowAngleActive: 36deg;
padding: 30px;
min-height: 700px;
box-sizing: border-box;
transform-style: preserve-3d;
}
.reveal.page .slides section.past {
z-index: 12;
@@ -1083,7 +807,6 @@ $controlsArrowAngleActive: 36deg;
height: 100%;
opacity: 0;
visibility: hidden;
overflow: hidden;
background-color: rgba( 0, 0, 0, 0 );
background-position: 50% 50%;
@@ -1100,7 +823,6 @@ $controlsArrowAngleActive: 36deg;
.reveal .slide-background.present {
opacity: 1;
visibility: visible;
z-index: 2;
}
.print-pdf .reveal .slide-background {
@@ -1117,11 +839,7 @@ $controlsArrowAngleActive: 36deg;
max-height: none;
top: 0;
left: 0;
object-fit: cover;
}
.reveal .slide-background[data-background-size="contain"] video {
object-fit: contain;
}
/* Immediate transition style */
.reveal[data-background-transition=none]>.backgrounds .slide-background,
@@ -1251,15 +969,8 @@ $controlsArrowAngleActive: 36deg;
perspective-origin: 50% 50%;
perspective: 700px;
.slides {
// Fixes overview rendering errors in FF48+, not applied to
// other browsers since it degrades performance
-moz-transform-style: preserve-3d;
}
.slides section {
height: 100%;
top: 0 !important;
height: 700px;
opacity: 1 !important;
overflow: hidden;
visibility: visible !important;
@@ -1289,10 +1000,6 @@ $controlsArrowAngleActive: 36deg;
.backgrounds {
perspective: inherit;
// Fixes overview rendering errors in FF48+, not applied to
// other browsers since it degrades performance
-moz-transform-style: preserve-3d;
}
.backgrounds .slide-background {
@@ -1303,10 +1010,6 @@ $controlsArrowAngleActive: 36deg;
outline: 10px solid rgba(150,150,150,0.1);
outline-offset: 10px;
}
.backgrounds .slide-background.stack {
overflow: visible;
}
}
// Disable transitions transitions while we're activating
@@ -1321,6 +1024,10 @@ $controlsArrowAngleActive: 36deg;
transition: none;
}
.reveal.overview-animated .slides {
transition: transform 0.4s ease;
}
/*********************************************
* RTL SUPPORT
@@ -1418,7 +1125,6 @@ $controlsArrowAngleActive: 36deg;
display: inline-block;
width: 40px;
height: 40px;
line-height: 36px;
padding: 0 10px;
float: right;
opacity: 0.6;
@@ -1446,7 +1152,6 @@ $controlsArrowAngleActive: 36deg;
.reveal .overlay .viewport {
position: absolute;
display: flex;
top: 40px;
right: 0;
bottom: 0;
@@ -1470,23 +1175,6 @@ $controlsArrowAngleActive: 36deg;
visibility: visible;
}
.reveal .overlay.overlay-preview.loaded .viewport-inner {
position: absolute;
z-index: -1;
left: 0;
top: 45%;
width: 100%;
text-align: center;
letter-spacing: normal;
}
.reveal .overlay.overlay-preview .x-frame-error {
opacity: 0;
transition: opacity 0.3s ease 0.3s;
}
.reveal .overlay.overlay-preview.loaded .x-frame-error {
opacity: 1;
}
.reveal .overlay.overlay-preview.loaded .spinner {
opacity: 0;
visibility: hidden;
@@ -1500,8 +1188,8 @@ $controlsArrowAngleActive: 36deg;
.reveal .overlay.overlay-help .viewport .viewport-inner {
width: 600px;
margin: auto;
padding: 20px 20px 80px 20px;
margin: 0 auto;
padding: 60px;
text-align: center;
letter-spacing: normal;
}
@@ -1513,13 +1201,13 @@ $controlsArrowAngleActive: 36deg;
.reveal .overlay.overlay-help .viewport .viewport-inner table {
border: 1px solid #fff;
border-collapse: collapse;
font-size: 16px;
font-size: 14px;
}
.reveal .overlay.overlay-help .viewport .viewport-inner table th,
.reveal .overlay.overlay-help .viewport .viewport-inner table td {
width: 200px;
padding: 14px;
padding: 10px;
border: 1px solid #fff;
vertical-align: middle;
}
@@ -1536,13 +1224,12 @@ $controlsArrowAngleActive: 36deg;
*********************************************/
.reveal .playback {
position: absolute;
position: fixed;
left: 15px;
bottom: 20px;
bottom: 15px;
z-index: 30;
cursor: pointer;
transition: all 400ms ease;
-webkit-tap-highlight-color: rgba( 0, 0, 0, 0 );
}
.reveal.overview .playback {
@@ -1601,97 +1288,10 @@ $controlsArrowAngleActive: 36deg;
* SPEAKER NOTES
*********************************************/
// Hide on-page notes
.reveal aside.notes {
display: none;
}
// An interface element that can optionally be used to show the
// speaker notes to all viewers, on top of the presentation
.reveal .speaker-notes {
display: none;
position: absolute;
width: 25vw;
height: 100%;
top: 0;
left: 100%;
padding: 14px 18px 14px 18px;
z-index: 1;
font-size: 18px;
line-height: 1.4;
border: 1px solid rgba( 0, 0, 0, 0.05 );
color: #222;
background-color: #f5f5f5;
overflow: auto;
box-sizing: border-box;
text-align: left;
font-family: Helvetica, sans-serif;
-webkit-overflow-scrolling: touch;
.notes-placeholder {
color: #ccc;
font-style: italic;
}
&:focus {
outline: none;
}
&:before {
content: 'Speaker notes';
display: block;
margin-bottom: 10px;
opacity: 0.5;
}
}
.reveal.show-notes {
max-width: 75vw;
overflow: visible;
}
.reveal.show-notes .speaker-notes {
display: block;
}
@media screen and (min-width: 1600px) {
.reveal .speaker-notes {
font-size: 20px;
}
}
@media screen and (max-width: 1024px) {
.reveal.show-notes {
border-left: 0;
max-width: none;
max-height: 70%;
overflow: visible;
}
.reveal.show-notes .speaker-notes {
top: 100%;
left: 0;
width: 100%;
height: (30/0.7)*1%;
}
}
@media screen and (max-width: 600px) {
.reveal.show-notes {
max-height: 60%;
}
.reveal.show-notes .speaker-notes {
top: 100%;
height: (40/0.6)*1%;
}
.reveal .speaker-notes {
font-size: 14px;
}
}
/*********************************************
* ZOOM PLUGIN
@@ -1715,3 +1315,5 @@ $controlsArrowAngleActive: 36deg;
.zoomed .reveal .roll span:after {
visibility: hidden;
}
@@ -1,10 +1,10 @@
## Dependencies
Themes are written using Sass to keep things modular and reduce the need for repeated selectors across files. Make sure that you have the reveal.js development environment including the Grunt dependencies installed before proceeding: https://github.com/hakimel/reveal.js#full-setup
Themes are written using Sass to keep things modular and reduce the need for repeated selectors across files. Make sure that you have the reveal.js development environment including the Grunt dependencies installed before proceding: https://github.com/hakimel/reveal.js#full-setup
## Creating a Theme
To create your own theme, start by duplicating a ```.scss``` file in [/css/theme/source](https://github.com/hakimel/reveal.js/blob/master/css/theme/source). It will be automatically compiled by Grunt from Sass to CSS (see the [Gruntfile](https://github.com/hakimel/reveal.js/blob/master/Gruntfile.js)) when you run `npm run build -- css-themes`.
To create your own theme, start by duplicating any ```.scss``` file in [/css/theme/source](https://github.com/hakimel/reveal.js/blob/master/css/theme/source) and adding it to the compilation list in the [Gruntfile](https://github.com/hakimel/reveal.js/blob/master/Gruntfile.js).
Each theme file does four things in the following order:
@@ -19,3 +19,5 @@ This is where you override the default theme. Either by specifying variables (se
4. **Include [/css/theme/template/theme.scss](https://github.com/hakimel/reveal.js/blob/master/css/theme/template/theme.scss)**
The template theme file which will generate final CSS output based on the currently defined variables.
When you are done, run `grunt css-themes` to compile the Sass file to CSS and you are ready to use your new theme.
@@ -1,7 +1,7 @@
/**
* Black theme for reveal.js. This is the opposite of the 'white' theme.
*
* By Hakim El Hattab, http://hakim.se
* Copyright (C) 2015 Hakim El Hattab, http://hakim.se
*/
@@ -21,7 +21,7 @@ $backgroundColor: #222;
$mainColor: #fff;
$headingColor: #fff;
$mainFontSize: 42px;
$mainFontSize: 38px;
$mainFont: 'Source Sans Pro', Helvetica, sans-serif;
$headingFont: 'Source Sans Pro', Helvetica, sans-serif;
$headingTextShadow: none;
@@ -1,7 +1,7 @@
/**
* White theme for reveal.js. This is the opposite of the 'black' theme.
*
* By Hakim El Hattab, http://hakim.se
* Copyright (C) 2015 Hakim El Hattab, http://hakim.se
*/
@@ -21,7 +21,7 @@ $backgroundColor: #fff;
$mainColor: #222;
$headingColor: #222;
$mainFontSize: 42px;
$mainFontSize: 38px;
$mainFont: 'Source Sans Pro', Helvetica, sans-serif;
$headingFont: 'Source Sans Pro', Helvetica, sans-serif;
$headingTextShadow: none;
+376 -14
View File
@@ -1,15 +1,23 @@
<!doctype html>
<html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>reveal.js</title>
<title>reveal.js - The HTML Presentation Framework</title>
<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
<meta name="author" content="Hakim El Hattab">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="css/reveal.css">
<link rel="stylesheet" href="css/theme/black.css">
<link rel="stylesheet" href="css/theme/black.css" id="theme">
<!-- Theme used for syntax highlighting of code -->
<!-- Code syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- Printing and PDF exports -->
@@ -20,30 +28,384 @@
link.href = window.location.search.match( /print-pdf/gi ) ? 'css/print/pdf.css' : 'css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<section>Slide 1</section>
<section>Slide 2</section>
<section>
<h1>Reveal.js</h1>
<h3>The HTML Presentation Framework</h3>
<p>
<small>Created by <a href="http://hakim.se">Hakim El Hattab</a> / <a href="http://twitter.com/hakimel">@hakimel</a></small>
</p>
</section>
<section>
<h2>Hello There</h2>
<p>
reveal.js enables you to create beautiful interactive slide decks using HTML. This presentation will show you examples of what it can do.
</p>
</section>
<!-- Example of nested vertical slides -->
<section>
<section>
<h2>Vertical Slides</h2>
<p>Slides can be nested inside of each other.</p>
<p>Use the <em>Space</em> key to navigate through all slides.</p>
<br>
<a href="#" class="navigate-down">
<img width="178" height="238" data-src="https://s3.amazonaws.com/hakim-static/reveal-js/arrow.png" alt="Down arrow">
</a>
</section>
<section>
<h2>Basement Level 1</h2>
<p>Nested slides are useful for adding additional detail underneath a high level horizontal slide.</p>
</section>
<section>
<h2>Basement Level 2</h2>
<p>That's it, time to go back up.</p>
<br>
<a href="#/2">
<img width="178" height="238" data-src="https://s3.amazonaws.com/hakim-static/reveal-js/arrow.png" alt="Up arrow" style="transform: rotate(180deg); -webkit-transform: rotate(180deg);">
</a>
</section>
</section>
<section>
<h2>Slides</h2>
<p>
Not a coder? Not a problem. There's a fully-featured visual editor for authoring these, try it out at <a href="http://slides.com" target="_blank">http://slides.com</a>.
</p>
</section>
<section>
<h2>Point of View</h2>
<p>
Press <strong>ESC</strong> to enter the slide overview.
</p>
<p>
Hold down alt and click on any element to zoom in on it using <a href="http://lab.hakim.se/zoom-js">zoom.js</a>. Alt + click anywhere to zoom back out.
</p>
</section>
<section>
<h2>Touch Optimized</h2>
<p>
Presentations look great on touch devices, like mobile phones and tablets. Simply swipe through your slides.
</p>
</section>
<section data-markdown>
<script type="text/template">
## Markdown support
Write content using inline or external Markdown.
Instructions and more info available in the [readme](https://github.com/hakimel/reveal.js#markdown).
```
<section data-markdown>
## Markdown support
Write content using inline or external Markdown.
Instructions and more info available in the [readme](https://github.com/hakimel/reveal.js#markdown).
</section>
```
</script>
</section>
<section>
<section id="fragments">
<h2>Fragments</h2>
<p>Hit the next arrow...</p>
<p class="fragment">... to step through ...</p>
<p><span class="fragment">... a</span> <span class="fragment">fragmented</span> <span class="fragment">slide.</span></p>
<aside class="notes">
This slide has fragments which are also stepped through in the notes window.
</aside>
</section>
<section>
<h2>Fragment Styles</h2>
<p>There's different types of fragments, like:</p>
<p class="fragment grow">grow</p>
<p class="fragment shrink">shrink</p>
<p class="fragment fade-out">fade-out</p>
<p class="fragment current-visible">current-visible</p>
<p class="fragment highlight-red">highlight-red</p>
<p class="fragment highlight-blue">highlight-blue</p>
</section>
</section>
<section id="transitions">
<h2>Transition Styles</h2>
<p>
You can select from different transitions, like: <br>
<a href="?transition=none#/transitions">None</a> -
<a href="?transition=fade#/transitions">Fade</a> -
<a href="?transition=slide#/transitions">Slide</a> -
<a href="?transition=convex#/transitions">Convex</a> -
<a href="?transition=concave#/transitions">Concave</a> -
<a href="?transition=zoom#/transitions">Zoom</a>
</p>
</section>
<section id="themes">
<h2>Themes</h2>
<p>
reveal.js comes with a few themes built in: <br>
<!-- Hacks to swap themes after the page has loaded. Not flexible and only intended for the reveal.js demo deck. -->
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/black.css'); return false;">Black (default)</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/white.css'); return false;">White</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/league.css'); return false;">League</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/sky.css'); return false;">Sky</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/beige.css'); return false;">Beige</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/simple.css'); return false;">Simple</a> <br>
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/serif.css'); return false;">Serif</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/blood.css'); return false;">Blood</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/night.css'); return false;">Night</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/moon.css'); return false;">Moon</a> -
<a href="#" onclick="document.getElementById('theme').setAttribute('href','css/theme/solarized.css'); return false;">Solarized</a>
</p>
</section>
<section>
<section data-background="#dddddd">
<h2>Slide Backgrounds</h2>
<p>
Set <code>data-background="#dddddd"</code> on a slide to change the background color. All CSS color formats are supported.
</p>
<a href="#" class="navigate-down">
<img width="178" height="238" data-src="https://s3.amazonaws.com/hakim-static/reveal-js/arrow.png" alt="Down arrow">
</a>
</section>
<section data-background="https://s3.amazonaws.com/hakim-static/reveal-js/image-placeholder.png">
<h2>Image Backgrounds</h2>
<pre><code>&lt;section data-background="image.png"&gt;</code></pre>
</section>
<section data-background="https://s3.amazonaws.com/hakim-static/reveal-js/image-placeholder.png" data-background-repeat="repeat" data-background-size="100px">
<h2>Tiled Backgrounds</h2>
<pre><code style="word-wrap: break-word;">&lt;section data-background="image.png" data-background-repeat="repeat" data-background-size="100px"&gt;</code></pre>
</section>
<section data-background-video="https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.mp4,https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.webm" data-background-color="#000000">
<div style="background-color: rgba(0, 0, 0, 0.9); color: #fff; padding: 20px;">
<h2>Video Backgrounds</h2>
<pre><code style="word-wrap: break-word;">&lt;section data-background-video="video.mp4,video.webm"&gt;</code></pre>
</div>
</section>
<section data-background="http://i.giphy.com/90F8aUepslB84.gif">
<h2>... and GIFs!</h2>
</section>
</section>
<section data-transition="slide" data-background="#4d7e65" data-background-transition="zoom">
<h2>Background Transitions</h2>
<p>
Different background transitions are available via the backgroundTransition option. This one's called "zoom".
</p>
<pre><code>Reveal.configure({ backgroundTransition: 'zoom' })</code></pre>
</section>
<section data-transition="slide" data-background="#b5533c" data-background-transition="zoom">
<h2>Background Transitions</h2>
<p>
You can override background transitions per-slide.
</p>
<pre><code style="word-wrap: break-word;">&lt;section data-background-transition="zoom"&gt;</code></pre>
</section>
<section>
<h2>Pretty Code</h2>
<pre><code data-trim contenteditable>
function linkify( selector ) {
if( supports3DTransforms ) {
var nodes = document.querySelectorAll( selector );
for( var i = 0, len = nodes.length; i &lt; len; i++ ) {
var node = nodes[i];
if( !node.className ) {
node.className += ' roll';
}
}
}
}
</code></pre>
<p>Code syntax highlighting courtesy of <a href="http://softwaremaniacs.org/soft/highlight/en/description/">highlight.js</a>.</p>
</section>
<section>
<h2>Marvelous List</h2>
<ul>
<li>No order here</li>
<li>Or here</li>
<li>Or here</li>
<li>Or here</li>
</ul>
</section>
<section>
<h2>Fantastic Ordered List</h2>
<ol>
<li>One is smaller than...</li>
<li>Two is smaller than...</li>
<li>Three!</li>
</ol>
</section>
<section>
<h2>Tabular Tables</h2>
<table>
<thead>
<tr>
<th>Item</th>
<th>Value</th>
<th>Quantity</th>
</tr>
</thead>
<tbody>
<tr>
<td>Apples</td>
<td>$1</td>
<td>7</td>
</tr>
<tr>
<td>Lemonade</td>
<td>$2</td>
<td>18</td>
</tr>
<tr>
<td>Bread</td>
<td>$3</td>
<td>2</td>
</tr>
</tbody>
</table>
</section>
<section>
<h2>Clever Quotes</h2>
<p>
These guys come in two forms, inline: <q cite="http://searchservervirtualization.techtarget.com/definition/Our-Favorite-Technology-Quotations">
&ldquo;The nice thing about standards is that there are so many to choose from&rdquo;</q> and block:
</p>
<blockquote cite="http://searchservervirtualization.techtarget.com/definition/Our-Favorite-Technology-Quotations">
&ldquo;For years there has been a theory that millions of monkeys typing at random on millions of typewriters would
reproduce the entire works of Shakespeare. The Internet has proven this theory to be untrue.&rdquo;
</blockquote>
</section>
<section>
<h2>Intergalactic Interconnections</h2>
<p>
You can link between slides internally,
<a href="#/2/3">like this</a>.
</p>
</section>
<section>
<h2>Speaker View</h2>
<p>There's a <a href="https://github.com/hakimel/reveal.js#speaker-notes">speaker view</a>. It includes a timer, preview of the upcoming slide as well as your speaker notes.</p>
<p>Press the <em>S</em> key to try it out.</p>
<aside class="notes">
Oh hey, these are some notes. They'll be hidden in your presentation, but you can see them if you open the speaker notes window (hit 's' on your keyboard).
</aside>
</section>
<section>
<h2>Export to PDF</h2>
<p>Presentations can be <a href="https://github.com/hakimel/reveal.js#pdf-export">exported to PDF</a>, here's an example:</p>
<iframe src="//www.slideshare.net/slideshow/embed_code/42840540" width="445" height="355" frameborder="0" marginwidth="0" marginheight="0" scrolling="no" style="border:3px solid #666; margin-bottom:5px; max-width: 100%;" allowfullscreen> </iframe>
</section>
<section>
<h2>Global State</h2>
<p>
Set <code>data-state="something"</code> on a slide and <code>"something"</code>
will be added as a class to the document element when the slide is open. This lets you
apply broader style changes, like switching the page background.
</p>
</section>
<section data-state="customevent">
<h2>State Events</h2>
<p>
Additionally custom events can be triggered on a per slide basis by binding to the <code>data-state</code> name.
</p>
<pre><code class="javascript" data-trim contenteditable style="font-size: 18px;">
Reveal.addEventListener( 'customevent', function() {
console.log( '"customevent" has fired' );
} );
</code></pre>
</section>
<section>
<h2>Take a Moment</h2>
<p>
Press B or . on your keyboard to pause the presentation. This is helpful when you're on stage and want to take distracting slides off the screen.
</p>
</section>
<section>
<h2>Much more</h2>
<ul>
<li>Right-to-left support</li>
<li><a href="https://github.com/hakimel/reveal.js#api">Extensive JavaScript API</a></li>
<li><a href="https://github.com/hakimel/reveal.js#auto-sliding">Auto-progression</a></li>
<li><a href="https://github.com/hakimel/reveal.js#parallax-background">Parallax backgrounds</a></li>
<li><a href="https://github.com/hakimel/reveal.js#keyboard-bindings">Custom keyboard bindings</a></li>
</ul>
</section>
<section style="text-align: left;">
<h1>THE END</h1>
<p>
- <a href="http://slides.com">Try the online editor</a> <br>
- <a href="https://github.com/hakimel/reveal.js">Source code &amp; documentation</a>
</p>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.js"></script>
<script>
// More info about config & dependencies:
// - https://github.com/hakimel/reveal.js#configuration
// - https://github.com/hakimel/reveal.js#dependencies
// Full list of configuration options available at:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
// Optional reveal.js plugins
dependencies: [
{ src: 'plugin/markdown/marked.js' },
{ src: 'plugin/markdown/markdown.js' },
{ src: 'plugin/notes/notes.js', async: true },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
{ src: 'plugin/highlight/highlight.js', async: true, condition: function() { return !!document.querySelector( 'pre code' ); }, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/zoom-js/zoom.js', async: true },
{ src: 'plugin/notes/notes.js', async: true }
]
});
</script>
</body>
</html>
File diff suppressed because it is too large Load Diff
@@ -6,75 +6,112 @@ based on dark.css by Ivan Sagalaev
*/
.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #3f3f3f;
color: #dcdcdc;
display: block; padding: 0.5em;
background: #3F3F3F;
color: #DCDCDC;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-tag {
color: #e3ceab;
.hljs-tag,
.css .hljs-class,
.css .hljs-id,
.lisp .hljs-title,
.nginx .hljs-title,
.hljs-request,
.hljs-status,
.clojure .hljs-attribute {
color: #E3CEAB;
}
.hljs-template-tag {
color: #dcdcdc;
.django .hljs-template_tag,
.django .hljs-variable,
.django .hljs-filter .hljs-argument {
color: #DCDCDC;
}
.hljs-number {
color: #8cd0d3;
.hljs-number,
.hljs-date {
color: #8CD0D3;
}
.dos .hljs-envvar,
.dos .hljs-stream,
.hljs-variable,
.hljs-template-variable,
.hljs-attribute {
color: #efdcbc;
.apache .hljs-sqbracket {
color: #EFDCBC;
}
.hljs-literal {
color: #efefaf;
.dos .hljs-flow,
.diff .hljs-change,
.python .exception,
.python .hljs-built_in,
.hljs-literal,
.tex .hljs-special {
color: #EFEFAF;
}
.diff .hljs-chunk,
.hljs-subst {
color: #8f8f8f;
color: #8F8F8F;
}
.dos .hljs-keyword,
.python .hljs-decorator,
.hljs-title,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class,
.hljs-section,
.hljs-type {
color: #efef8f;
.haskell .hljs-type,
.diff .hljs-header,
.ruby .hljs-class .hljs-parent,
.apache .hljs-tag,
.nginx .hljs-built_in,
.tex .hljs-command,
.hljs-prompt {
color: #efef8f;
}
.hljs-symbol,
.hljs-bullet,
.hljs-link {
color: #dca3a3;
.dos .hljs-winutils,
.ruby .hljs-symbol,
.ruby .hljs-symbol .hljs-string,
.ruby .hljs-string {
color: #DCA3A3;
}
.hljs-deletion,
.diff .hljs-deletion,
.hljs-string,
.hljs-tag .hljs-value,
.hljs-preprocessor,
.hljs-pragma,
.hljs-built_in,
.hljs-builtin-name {
color: #cc9393;
.sql .hljs-aggregate,
.hljs-javadoc,
.smalltalk .hljs-class,
.smalltalk .hljs-localvars,
.smalltalk .hljs-array,
.css .hljs-rules .hljs-value,
.hljs-attr_selector,
.hljs-pseudo,
.apache .hljs-cbracket,
.tex .hljs-formula,
.coffeescript .hljs-attribute {
color: #CC9393;
}
.hljs-addition,
.hljs-shebang,
.diff .hljs-addition,
.hljs-comment,
.hljs-quote,
.hljs-meta {
color: #7f9f7f;
.java .hljs-annotation,
.hljs-template_comment,
.hljs-pi,
.hljs-doctype {
color: #7F9F7F;
}
.hljs-emphasis {
font-style: italic;
.coffeescript .javascript,
.javascript .xml,
.tex .hljs-formula,
.xml .javascript,
.xml .vbscript,
.xml .css,
.xml .hljs-cdata {
opacity: 0.5;
}
.hljs-strong {
font-weight: bold;
}
+8 -9
View File
@@ -1,9 +1,8 @@
/*! head.core - v1.0.2 */
(function(n,t){"use strict";function r(n){a[a.length]=n}function k(n){var t=new RegExp(" ?\\b"+n+"\\b");c.className=c.className.replace(t,"")}function p(n,t){for(var i=0,r=n.length;i<r;i++)t.call(n,n[i],i)}function tt(){var t,e,f,o;c.className=c.className.replace(/ (w-|eq-|gt-|gte-|lt-|lte-|portrait|no-portrait|landscape|no-landscape)\d+/g,"");t=n.innerWidth||c.clientWidth;e=n.outerWidth||n.screen.width;u.screen.innerWidth=t;u.screen.outerWidth=e;r("w-"+t);p(i.screens,function(n){t>n?(i.screensCss.gt&&r("gt-"+n),i.screensCss.gte&&r("gte-"+n)):t<n?(i.screensCss.lt&&r("lt-"+n),i.screensCss.lte&&r("lte-"+n)):t===n&&(i.screensCss.lte&&r("lte-"+n),i.screensCss.eq&&r("e-q"+n),i.screensCss.gte&&r("gte-"+n))});f=n.innerHeight||c.clientHeight;o=n.outerHeight||n.screen.height;u.screen.innerHeight=f;u.screen.outerHeight=o;u.feature("portrait",f>t);u.feature("landscape",f<t)}function it(){n.clearTimeout(b);b=n.setTimeout(tt,50)}var y=n.document,rt=n.navigator,ut=n.location,c=y.documentElement,a=[],i={screens:[240,320,480,640,768,800,1024,1280,1440,1680,1920],screensCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!1},browsers:[{ie:{min:6,max:11}}],browserCss:{gt:!0,gte:!1,lt:!0,lte:!1,eq:!0},html5:!0,page:"-page",section:"-section",head:"head"},v,u,s,w,o,h,l,d,f,g,nt,e,b;if(n.head_conf)for(v in n.head_conf)n.head_conf[v]!==t&&(i[v]=n.head_conf[v]);u=n[i.head]=function(){u.ready.apply(null,arguments)};u.feature=function(n,t,i){return n?(Object.prototype.toString.call(t)==="[object Function]"&&(t=t.call()),r((t?"":"no-")+n),u[n]=!!t,i||(k("no-"+n),k(n),u.feature()),u):(c.className+=" "+a.join(" "),a=[],u)};u.feature("js",!0);s=rt.userAgent.toLowerCase();w=/mobile|android|kindle|silk|midp|phone|(windows .+arm|touch)/.test(s);u.feature("mobile",w,!0);u.feature("desktop",!w,!0);s=/(chrome|firefox)[ \/]([\w.]+)/.exec(s)||/(iphone|ipad|ipod)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(android)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(webkit|opera)(?:.*version)?[ \/]([\w.]+)/.exec(s)||/(msie) ([\w.]+)/.exec(s)||/(trident).+rv:(\w.)+/.exec(s)||[];o=s[1];h=parseFloat(s[2]);switch(o){case"msie":case"trident":o="ie";h=y.documentMode||h;break;case"firefox":o="ff";break;case"ipod":case"ipad":case"iphone":o="ios";break;case"webkit":o="safari"}for(u.browser={name:o,version:h},u.browser[o]=!0,l=0,d=i.browsers.length;l<d;l++)for(f in i.browsers[l])if(o===f)for(r(f),g=i.browsers[l][f].min,nt=i.browsers[l][f].max,e=g;e<=nt;e++)h>e?(i.browserCss.gt&&r("gt-"+f+e),i.browserCss.gte&&r("gte-"+f+e)):h<e?(i.browserCss.lt&&r("lt-"+f+e),i.browserCss.lte&&r("lte-"+f+e)):h===e&&(i.browserCss.lte&&r("lte-"+f+e),i.browserCss.eq&&r("eq-"+f+e),i.browserCss.gte&&r("gte-"+f+e));else r("no-"+f);r(o);r(o+parseInt(h,10));i.html5&&o==="ie"&&h<9&&p("abbr|article|aside|audio|canvas|details|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|progress|section|summary|time|video".split("|"),function(n){y.createElement(n)});p(ut.pathname.split("/"),function(n,u){if(this.length>2&&this[u+1]!==t)u&&r(this.slice(u,u+1).join("-").toLowerCase()+i.section);else{var f=n||"index",e=f.indexOf(".");e>0&&(f=f.substring(0,e));c.id=f.toLowerCase()+i.page;u||r("root"+i.section)}});u.screen={height:n.screen.height,width:n.screen.width};tt();b=0;n.addEventListener?n.addEventListener("resize",it,!1):n.attachEvent("onresize",it)})(window);
/*! head.css3 - v1.0.0 */
(function(n,t){"use strict";function a(n){for(var r in n)if(i[n[r]]!==t)return!0;return!1}function r(n){var t=n.charAt(0).toUpperCase()+n.substr(1),i=(n+" "+c.join(t+" ")+t).split(" ");return!!a(i)}var h=n.document,o=h.createElement("i"),i=o.style,s=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),c="Webkit Moz O ms Khtml".split(" "),l=n.head_conf&&n.head_conf.head||"head",u=n[l],f={gradient:function(){var n="background-image:";return i.cssText=(n+s.join("gradient(linear,left top,right bottom,from(#9f9),to(#fff));"+n)+s.join("linear-gradient(left top,#eee,#fff);"+n)).slice(0,-n.length),!!i.backgroundImage},rgba:function(){return i.cssText="background-color:rgba(0,0,0,0.5)",!!i.backgroundColor},opacity:function(){return o.style.opacity===""},textshadow:function(){return i.textShadow===""},multiplebgs:function(){i.cssText="background:url(https://),url(https://),red url(https://)";var n=(i.background||"").match(/url/g);return Object.prototype.toString.call(n)==="[object Array]"&&n.length===3},boxshadow:function(){return r("boxShadow")},borderimage:function(){return r("borderImage")},borderradius:function(){return r("borderRadius")},cssreflections:function(){return r("boxReflect")},csstransforms:function(){return r("transform")},csstransitions:function(){return r("transition")},touch:function(){return"ontouchstart"in n},retina:function(){return n.devicePixelRatio>1},fontface:function(){var t=u.browser.name,n=u.browser.version;switch(t){case"ie":return n>=9;case"chrome":return n>=13;case"ff":return n>=6;case"ios":return n>=5;case"android":return!1;case"webkit":return n>=5.1;case"opera":return n>=10;default:return!1}}};for(var e in f)f[e]&&u.feature(e,f[e].call(),!0);u.feature()})(window);
/*! head.load - v1.0.3 */
(function(n,t){"use strict";function w(){}function u(n,t){if(n){typeof n=="object"&&(n=[].slice.call(n));for(var i=0,r=n.length;i<r;i++)t.call(n,n[i],i)}}function it(n,i){var r=Object.prototype.toString.call(i).slice(8,-1);return i!==t&&i!==null&&r===n}function s(n){return it("Function",n)}function a(n){return it("Array",n)}function et(n){var i=n.split("/"),t=i[i.length-1],r=t.indexOf("?");return r!==-1?t.substring(0,r):t}function f(n){(n=n||w,n._done)||(n(),n._done=1)}function ot(n,t,r,u){var f=typeof n=="object"?n:{test:n,success:!t?!1:a(t)?t:[t],failure:!r?!1:a(r)?r:[r],callback:u||w},e=!!f.test;return e&&!!f.success?(f.success.push(f.callback),i.load.apply(null,f.success)):e||!f.failure?u():(f.failure.push(f.callback),i.load.apply(null,f.failure)),i}function v(n){var t={},i,r;if(typeof n=="object")for(i in n)!n[i]||(t={name:i,url:n[i]});else t={name:et(n),url:n};return(r=c[t.name],r&&r.url===t.url)?r:(c[t.name]=t,t)}function y(n){n=n||c;for(var t in n)if(n.hasOwnProperty(t)&&n[t].state!==l)return!1;return!0}function st(n){n.state=ft;u(n.onpreload,function(n){n.call()})}function ht(n){n.state===t&&(n.state=nt,n.onpreload=[],rt({url:n.url,type:"cache"},function(){st(n)}))}function ct(){var n=arguments,t=n[n.length-1],r=[].slice.call(n,1),f=r[0];return(s(t)||(t=null),a(n[0]))?(n[0].push(t),i.load.apply(null,n[0]),i):(f?(u(r,function(n){s(n)||!n||ht(v(n))}),b(v(n[0]),s(f)?f:function(){i.load.apply(null,r)})):b(v(n[0])),i)}function lt(){var n=arguments,t=n[n.length-1],r={};return(s(t)||(t=null),a(n[0]))?(n[0].push(t),i.load.apply(null,n[0]),i):(u(n,function(n){n!==t&&(n=v(n),r[n.name]=n)}),u(n,function(n){n!==t&&(n=v(n),b(n,function(){y(r)&&f(t)}))}),i)}function b(n,t){if(t=t||w,n.state===l){t();return}if(n.state===tt){i.ready(n.name,t);return}if(n.state===nt){n.onpreload.push(function(){b(n,t)});return}n.state=tt;rt(n,function(){n.state=l;t();u(h[n.name],function(n){f(n)});o&&y()&&u(h.ALL,function(n){f(n)})})}function at(n){n=n||"";var t=n.split("?")[0].split(".");return t[t.length-1].toLowerCase()}function rt(t,i){function e(t){t=t||n.event;u.onload=u.onreadystatechange=u.onerror=null;i()}function o(f){f=f||n.event;(f.type==="load"||/loaded|complete/.test(u.readyState)&&(!r.documentMode||r.documentMode<9))&&(n.clearTimeout(t.errorTimeout),n.clearTimeout(t.cssTimeout),u.onload=u.onreadystatechange=u.onerror=null,i())}function s(){if(t.state!==l&&t.cssRetries<=20){for(var i=0,f=r.styleSheets.length;i<f;i++)if(r.styleSheets[i].href===u.href){o({type:"load"});return}t.cssRetries++;t.cssTimeout=n.setTimeout(s,250)}}var u,h,f;i=i||w;h=at(t.url);h==="css"?(u=r.createElement("link"),u.type="text/"+(t.type||"css"),u.rel="stylesheet",u.href=t.url,t.cssRetries=0,t.cssTimeout=n.setTimeout(s,500)):(u=r.createElement("script"),u.type="text/"+(t.type||"javascript"),u.src=t.url);u.onload=u.onreadystatechange=o;u.onerror=e;u.async=!1;u.defer=!1;t.errorTimeout=n.setTimeout(function(){e({type:"timeout"})},7e3);f=r.head||r.getElementsByTagName("head")[0];f.insertBefore(u,f.lastChild)}function vt(){for(var t,u=r.getElementsByTagName("script"),n=0,f=u.length;n<f;n++)if(t=u[n].getAttribute("data-headjs-load"),!!t){i.load(t);return}}function yt(n,t){var v,p,e;return n===r?(o?f(t):d.push(t),i):(s(n)&&(t=n,n="ALL"),a(n))?(v={},u(n,function(n){v[n]=c[n];i.ready(n,function(){y(v)&&f(t)})}),i):typeof n!="string"||!s(t)?i:(p=c[n],p&&p.state===l||n==="ALL"&&y()&&o)?(f(t),i):(e=h[n],e?e.push(t):e=h[n]=[t],i)}function e(){if(!r.body){n.clearTimeout(i.readyTimeout);i.readyTimeout=n.setTimeout(e,50);return}o||(o=!0,vt(),u(d,function(n){f(n)}))}function k(){r.addEventListener?(r.removeEventListener("DOMContentLoaded",k,!1),e()):r.readyState==="complete"&&(r.detachEvent("onreadystatechange",k),e())}var r=n.document,d=[],h={},c={},ut="async"in r.createElement("script")||"MozAppearance"in r.documentElement.style||n.opera,o,g=n.head_conf&&n.head_conf.head||"head",i=n[g]=n[g]||function(){i.ready.apply(null,arguments)},nt=1,ft=2,tt=3,l=4,p;if(r.readyState==="complete")e();else if(r.addEventListener)r.addEventListener("DOMContentLoaded",k,!1),n.addEventListener("load",e,!1);else{r.attachEvent("onreadystatechange",k);n.attachEvent("onload",e);p=!1;try{p=!n.frameElement&&r.documentElement}catch(wt){}p&&p.doScroll&&function pt(){if(!o){try{p.doScroll("left")}catch(t){n.clearTimeout(i.readyTimeout);i.readyTimeout=n.setTimeout(pt,50);return}e()}}()}i.load=i.js=ut?lt:ct;i.test=ot;i.ready=yt;i.ready(r,function(){y()&&u(h.ALL,function(n){f(n)});i.feature&&i.feature("domloaded",!0)})})(window);
/*
//# sourceMappingURL=head.min.js.map
*/
/**
Head JS The only script in your <HEAD>
Copyright Tero Piirainen (tipiirai)
License MIT / http://bit.ly/mit-license
Version 0.96
http://headjs.com
*/(function(a){function z(){d||(d=!0,s(e,function(a){p(a)}))}function y(c,d){var e=a.createElement("script");e.type="text/"+(c.type||"javascript"),e.src=c.src||c,e.async=!1,e.onreadystatechange=e.onload=function(){var a=e.readyState;!d.done&&(!a||/loaded|complete/.test(a))&&(d.done=!0,d())},(a.body||b).appendChild(e)}function x(a,b){if(a.state==o)return b&&b();if(a.state==n)return k.ready(a.name,b);if(a.state==m)return a.onpreload.push(function(){x(a,b)});a.state=n,y(a.url,function(){a.state=o,b&&b(),s(g[a.name],function(a){p(a)}),u()&&d&&s(g.ALL,function(a){p(a)})})}function w(a,b){a.state===undefined&&(a.state=m,a.onpreload=[],y({src:a.url,type:"cache"},function(){v(a)}))}function v(a){a.state=l,s(a.onpreload,function(a){a.call()})}function u(a){a=a||h;var b;for(var c in a){if(a.hasOwnProperty(c)&&a[c].state!=o)return!1;b=!0}return b}function t(a){return Object.prototype.toString.call(a)=="[object Function]"}function s(a,b){if(!!a){typeof a=="object"&&(a=[].slice.call(a));for(var c=0;c<a.length;c++)b.call(a,a[c],c)}}function r(a){var b;if(typeof a=="object")for(var c in a)a[c]&&(b={name:c,url:a[c]});else b={name:q(a),url:a};var d=h[b.name];if(d&&d.url===b.url)return d;h[b.name]=b;return b}function q(a){var b=a.split("/"),c=b[b.length-1],d=c.indexOf("?");return d!=-1?c.substring(0,d):c}function p(a){a._done||(a(),a._done=1)}var b=a.documentElement,c,d,e=[],f=[],g={},h={},i=a.createElement("script").async===!0||"MozAppearance"in a.documentElement.style||window.opera,j=window.head_conf&&head_conf.head||"head",k=window[j]=window[j]||function(){k.ready.apply(null,arguments)},l=1,m=2,n=3,o=4;i?k.js=function(){var a=arguments,b=a[a.length-1],c={};t(b)||(b=null),s(a,function(d,e){d!=b&&(d=r(d),c[d.name]=d,x(d,b&&e==a.length-2?function(){u(c)&&p(b)}:null))});return k}:k.js=function(){var a=arguments,b=[].slice.call(a,1),d=b[0];if(!c){f.push(function(){k.js.apply(null,a)});return k}d?(s(b,function(a){t(a)||w(r(a))}),x(r(a[0]),t(d)?d:function(){k.js.apply(null,b)})):x(r(a[0]));return k},k.ready=function(b,c){if(b==a){d?p(c):e.push(c);return k}t(b)&&(c=b,b="ALL");if(typeof b!="string"||!t(c))return k;var f=h[b];if(f&&f.state==o||b=="ALL"&&u()&&d){p(c);return k}var i=g[b];i?i.push(c):i=g[b]=[c];return k},k.ready(a,function(){u()&&s(g.ALL,function(a){p(a)}),k.feature&&k.feature("domloaded",!0)});if(window.addEventListener)a.addEventListener("DOMContentLoaded",z,!1),window.addEventListener("load",z,!1);else if(window.attachEvent){a.attachEvent("onreadystatechange",function(){a.readyState==="complete"&&z()});var A=1;try{A=window.frameElement}catch(B){}!A&&b.doScroll&&function(){try{b.doScroll("left"),z()}catch(a){setTimeout(arguments.callee,1);return}}(),window.attachEvent("onload",z)}!a.readyState&&a.addEventListener&&(a.readyState="loading",a.addEventListener("DOMContentLoaded",handler=function(){a.removeEventListener("DOMContentLoaded",handler,!1),a.readyState="complete"},!1)),setTimeout(function(){c=!0,s(f,function(a){a()})},300)})(document)
@@ -1,14 +1,13 @@
{
"name": "reveal.js",
"version": "3.6.0",
"version": "3.1.0",
"description": "The HTML Presentation Framework",
"homepage": "http://revealjs.com",
"homepage": "http://lab.hakim.se/reveal-js",
"subdomain": "revealjs",
"main": "js/reveal.js",
"scripts": {
"test": "grunt test",
"start": "grunt serve",
"build": "grunt"
"start": "grunt serve"
},
"author": {
"name": "Hakim El Hattab",
@@ -20,24 +19,27 @@
"url": "git://github.com/hakimel/reveal.js.git"
},
"engines": {
"node": ">=4.0.0"
"node": "~0.10.0"
},
"dependencies": {
"underscore": "~1.5.1",
"express": "~2.5.9",
"mustache": "~0.7.2",
"socket.io": "~0.9.16"
},
"devDependencies": {
"express": "^4.15.2",
"grunt": "^1.0.1",
"grunt-autoprefixer": "^3.0.4",
"grunt-cli": "^1.2.0",
"grunt-contrib-connect": "^1.0.2",
"grunt-contrib-cssmin": "^2.1.0",
"grunt-contrib-jshint": "^1.1.0",
"grunt-contrib-qunit": "~1.2.0",
"grunt-contrib-uglify": "^2.3.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-sass": "^2.0.0",
"grunt-retire": "^1.0.7",
"grunt-zip": "~0.17.1",
"mustache": "^2.3.0",
"socket.io": "^1.7.3"
"grunt-contrib-qunit": "~0.5.2",
"grunt-contrib-jshint": "~0.6.4",
"grunt-contrib-cssmin": "~0.12.2",
"grunt-contrib-uglify": "~0.2.4",
"grunt-contrib-watch": "~0.5.3",
"grunt-sass": "~0.14.0",
"grunt-contrib-connect": "~0.8.0",
"grunt-autoprefixer": "~1.0.1",
"grunt-zip": "~0.7.0",
"grunt": "~0.4.0",
"node-sass": "~0.9.3"
},
"license": "MIT"
}
File diff suppressed because one or more lines are too long
@@ -99,13 +99,6 @@
</script>
</section>
<!-- Images -->
<section data-markdown>
<script type="text/template">
![Sample image](https://s3.amazonaws.com/static.slid.es/logo/v2/slides-symbol-512x512.png)
</script>
</section>
</div>
</div>
@@ -29,8 +29,3 @@ Content 3.1
## External 3.2
Content 3.2
## External 3.3
![External Image](https://s3.amazonaws.com/static.slid.es/logo/v2/slides-symbol-512x512.png)
@@ -4,26 +4,33 @@
* of external markdown documents.
*/
(function( root, factory ) {
if (typeof define === 'function' && define.amd) {
root.marked = require( './marked' );
root.RevealMarkdown = factory( root.marked );
root.RevealMarkdown.initialize();
} else if( typeof exports === 'object' ) {
if( typeof exports === 'object' ) {
module.exports = factory( require( './marked' ) );
} else {
}
else {
// Browser globals (root is window)
root.RevealMarkdown = factory( root.marked );
root.RevealMarkdown.initialize();
}
}( this, function( marked ) {
if( typeof marked === 'undefined' ) {
throw 'The reveal.js Markdown plugin requires marked to be loaded';
}
if( typeof hljs !== 'undefined' ) {
marked.setOptions({
highlight: function( lang, code ) {
return hljs.highlightAuto( lang, code ).value;
}
});
}
var DEFAULT_SLIDE_SEPARATOR = '^\r?\n---\r?\n$',
DEFAULT_NOTES_SEPARATOR = 'notes?:',
DEFAULT_NOTES_SEPARATOR = 'note:',
DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR = '\\\.element\\\s*?(.+?)$',
DEFAULT_SLIDE_ATTRIBUTES_SEPARATOR = '\\\.slide:\\\s*?(\\\S.+?)$';
var SCRIPT_END_PLACEHOLDER = '__SCRIPT_END__';
/**
* Retrieves the markdown contents of a slide section
@@ -31,15 +38,11 @@
*/
function getMarkdownFromSlide( section ) {
// look for a <script> or <textarea data-template> wrapper
var template = section.querySelector( '[data-template]' ) || section.querySelector( 'script' );
var template = section.querySelector( 'script' );
// strip leading whitespace so it isn't evaluated as code
var text = ( template || section ).textContent;
// restore script end tags
text = text.replace( new RegExp( SCRIPT_END_PLACEHOLDER, 'g' ), '</script>' );
var leadingWs = text.match( /^\n?(\s*)/ )[1].length,
leadingTabs = text.match( /^\n?(\t*)/ )[1].length;
@@ -109,13 +112,9 @@
var notesMatch = content.split( new RegExp( options.notesSeparator, 'mgi' ) );
if( notesMatch.length === 2 ) {
content = notesMatch[0] + '<aside class="notes">' + marked(notesMatch[1].trim()) + '</aside>';
content = notesMatch[0] + '<aside class="notes" data-markdown>' + notesMatch[1].trim() + '</aside>';
}
// prevent script end tags in the content from interfering
// with parsing
content = content.replace( /<\/script>/g, SCRIPT_END_PLACEHOLDER );
return '<script type="text/template">' + content + '</script>';
}
@@ -178,7 +177,7 @@
markdownSections += '<section '+ options.attributes +'>';
sectionStack[i].forEach( function( child ) {
markdownSections += '<section data-markdown>' + createMarkdownSlide( child, options ) + '</section>';
markdownSections += '<section data-markdown>' + createMarkdownSlide( child, options ) + '</section>';
} );
markdownSections += '</section>';
@@ -380,24 +379,6 @@
return {
initialize: function() {
if( typeof marked === 'undefined' ) {
throw 'The reveal.js Markdown plugin requires marked to be loaded';
}
if( typeof hljs !== 'undefined' ) {
marked.setOptions({
highlight: function( code, lang ) {
return hljs.highlightAuto( code, [lang] ).value;
}
});
}
var options = Reveal.getConfig().markdown;
if ( options ) {
marked.setOptions( options );
}
processSlides();
convertSlides();
},
File diff suppressed because one or more lines are too long
@@ -7,17 +7,14 @@
var RevealMath = window.RevealMath || (function(){
var options = Reveal.getConfig().math || {};
options.mathjax = options.mathjax || 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js';
options.mathjax = options.mathjax || 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js';
options.config = options.config || 'TeX-AMS_HTML-full';
loadScript( options.mathjax + '?config=' + options.config, function() {
MathJax.Hub.Config({
messageStyle: 'none',
tex2jax: {
inlineMath: [['$','$'],['\\(','\\)']] ,
skipTags: ['script','noscript','style','textarea','pre']
},
tex2jax: { inlineMath: [['$','$'],['\\(','\\)']] },
skipStartupTypeset: true
});
@@ -8,6 +8,6 @@
if (data.socketId !== socketId) { return; }
if( window.location.host === 'localhost:1947' ) return;
Reveal.setState(data.state);
Reveal.slide(data.indexh, data.indexv, data.indexf, 'remote');
});
}());
@@ -1,45 +1,37 @@
var http = require('http');
var express = require('express');
var fs = require('fs');
var io = require('socket.io');
var crypto = require('crypto');
var app = express();
var staticDir = express.static;
var server = http.createServer(app);
var app = express.createServer();
var staticDir = express.static;
io = io(server);
io = io.listen(app);
var opts = {
port: process.env.PORT || 1948,
baseDir : __dirname + '/../../'
};
io.on( 'connection', function( socket ) {
socket.on('multiplex-statechanged', function(data) {
if (typeof data.secret == 'undefined' || data.secret == null || data.secret === '') return;
if (createHash(data.secret) === data.socketId) {
data.secret = null;
socket.broadcast.emit(data.socketId, data);
io.sockets.on('connection', function(socket) {
socket.on('slidechanged', function(slideData) {
if (typeof slideData.secret == 'undefined' || slideData.secret == null || slideData.secret === '') return;
if (createHash(slideData.secret) === slideData.socketId) {
slideData.secret = null;
socket.broadcast.emit(slideData.socketId, slideData);
};
});
});
[ 'css', 'js', 'plugin', 'lib' ].forEach(function(dir) {
app.use('/' + dir, staticDir(opts.baseDir + dir));
app.configure(function() {
[ 'css', 'js', 'plugin', 'lib' ].forEach(function(dir) {
app.use('/' + dir, staticDir(opts.baseDir + dir));
});
});
app.get("/", function(req, res) {
res.writeHead(200, {'Content-Type': 'text/html'});
var stream = fs.createReadStream(opts.baseDir + '/index.html');
stream.on('error', function( error ) {
res.write('<style>body{font-family: sans-serif;}</style><h2>reveal.js multiplex server.</h2><a href="/token">Generate token</a>');
res.end();
});
stream.on('readable', function() {
stream.pipe(res);
});
fs.createReadStream(opts.baseDir + '/index.html').pipe(res);
});
app.get("/token", function(req,res) {
@@ -55,7 +47,7 @@ var createHash = function(secret) {
};
// Actually listen
server.listen( opts.port || null );
app.listen(opts.port || null);
var brown = '\033[33m',
green = '\033[32m',
@@ -1,34 +1,51 @@
(function() {
// Don't emit events from inside of notes windows
if ( window.location.search.match( /receiver/gi ) ) { return; }
var multiplex = Reveal.getConfig().multiplex;
var socket = io.connect( multiplex.url );
var socket = io.connect(multiplex.url);
function post() {
var notify = function( slideElement, indexh, indexv, origin ) {
if( typeof origin === 'undefined' && origin !== 'remote' ) {
var nextindexh;
var nextindexv;
var messageData = {
state: Reveal.getState(),
secret: multiplex.secret,
socketId: multiplex.id
};
var fragmentindex = Reveal.getIndices().f;
if (typeof fragmentindex == 'undefined') {
fragmentindex = 0;
}
socket.emit( 'multiplex-statechanged', messageData );
if (slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION') {
nextindexh = indexh;
nextindexv = indexv + 1;
} else {
nextindexh = indexh + 1;
nextindexv = 0;
}
var slideData = {
indexh : indexh,
indexv : indexv,
indexf : fragmentindex,
nextindexh : nextindexh,
nextindexv : nextindexv,
secret: multiplex.secret,
socketId : multiplex.id
};
socket.emit('slidechanged', slideData);
}
}
Reveal.addEventListener( 'slidechanged', function( event ) {
notify( event.currentSlide, event.indexh, event.indexv, event.origin );
} );
var fragmentNotify = function( event ) {
notify( Reveal.getCurrentSlide(), Reveal.getIndices().h, Reveal.getIndices().v, event.origin );
};
// post once the page is loaded, so the client follows also on "open URL".
window.addEventListener( 'load', post );
// Monitor events that trigger a change in state
Reveal.addEventListener( 'slidechanged', post );
Reveal.addEventListener( 'fragmentshown', post );
Reveal.addEventListener( 'fragmenthidden', post );
Reveal.addEventListener( 'overviewhidden', post );
Reveal.addEventListener( 'overviewshown', post );
Reveal.addEventListener( 'paused', post );
Reveal.addEventListener( 'resumed', post );
}());
Reveal.addEventListener( 'fragmentshown', fragmentNotify );
Reveal.addEventListener( 'fragmenthidden', fragmentNotify );
}());
@@ -41,15 +41,10 @@
}
// When a new notes window connects, post our current state
socket.on( 'new-subscriber', function( data ) {
socket.on( 'connect', function( data ) {
post();
} );
// When the state changes from inside of the speaker view
socket.on( 'statechanged-speaker', function( data ) {
Reveal.setState( data.state );
} );
// Monitor events that trigger a change in state
Reveal.addEventListener( 'slidechanged', post );
Reveal.addEventListener( 'fragmentshown', post );
@@ -1,40 +1,37 @@
var http = require('http');
var express = require('express');
var fs = require('fs');
var io = require('socket.io');
var _ = require('underscore');
var Mustache = require('mustache');
var app = express();
var app = express.createServer();
var staticDir = express.static;
var server = http.createServer(app);
io = io(server);
io = io.listen(app);
var opts = {
port : 1947,
baseDir : __dirname + '/../../'
};
io.on( 'connection', function( socket ) {
io.sockets.on( 'connection', function( socket ) {
socket.on( 'new-subscriber', function( data ) {
socket.broadcast.emit( 'new-subscriber', data );
socket.on( 'connect', function( data ) {
socket.broadcast.emit( 'connect', data );
});
socket.on( 'statechanged', function( data ) {
delete data.state.overview;
socket.broadcast.emit( 'statechanged', data );
});
socket.on( 'statechanged-speaker', function( data ) {
delete data.state.overview;
socket.broadcast.emit( 'statechanged-speaker', data );
});
});
[ 'css', 'js', 'images', 'plugin', 'lib' ].forEach( function( dir ) {
app.use( '/' + dir, staticDir( opts.baseDir + dir ) );
app.configure( function() {
[ 'css', 'js', 'images', 'plugin', 'lib' ].forEach( function( dir ) {
app.use( '/' + dir, staticDir( opts.baseDir + dir ) );
});
});
app.get('/', function( req, res ) {
@@ -55,7 +52,7 @@ app.get( '/notes/:socketId', function( req, res ) {
});
// Actually listen
server.listen( opts.port || null );
app.listen( opts.port || null );
var brown = '\033[33m',
green = '\033[32m',
@@ -65,5 +62,5 @@ var slidesLocation = 'http://localhost' + ( opts.port ? ( ':' + opts.port ) : ''
console.log( brown + 'reveal.js - Speaker Notes' + reset );
console.log( '1. Open the slides at ' + green + slidesLocation + reset );
console.log( '2. Click on the link in your JS console to go to the notes page' );
console.log( '2. Click on the link your JS console to go to the notes page' );
console.log( '3. Advance through your slides and your notes will advance automatically' );
@@ -8,7 +8,6 @@
<style>
body {
font-family: Helvetica;
font-size: 18px;
}
#current-slide,
@@ -31,26 +30,15 @@
position: absolute;
top: 10px;
left: 10px;
z-index: 2;
}
.overlay-element {
height: 34px;
line-height: 34px;
padding: 0 10px;
text-shadow: none;
background: rgba( 220, 220, 220, 0.8 );
color: #222;
font-weight: bold;
font-size: 14px;
}
.overlay-element.interactive:hover {
background: rgba( 220, 220, 220, 1 );
z-index: 2;
color: rgba( 255, 255, 255, 0.9 );
}
#current-slide {
position: absolute;
width: 60%;
width: 65%;
height: 100%;
top: 0;
left: 0;
@@ -59,20 +47,19 @@
#upcoming-slide {
position: absolute;
width: 40%;
width: 35%;
height: 40%;
right: 0;
top: 0;
}
/* Speaker controls */
#speaker-controls {
position: absolute;
top: 40%;
right: 0;
width: 40%;
width: 35%;
height: 60%;
overflow: auto;
font-size: 18px;
}
@@ -137,108 +124,26 @@
font-size: 1.2em;
}
/* Layout selector */
#speaker-layout {
position: absolute;
top: 10px;
right: 10px;
color: #222;
z-index: 10;
}
#speaker-layout select {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
border: 0;
box-shadow: 0;
cursor: pointer;
opacity: 0;
font-size: 1em;
background-color: transparent;
-moz-appearance: none;
-webkit-appearance: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
#speaker-layout select:focus {
outline: none;
box-shadow: none;
}
.clear {
clear: both;
}
/* Speaker layout: Wide */
body[data-speaker-layout="wide"] #current-slide,
body[data-speaker-layout="wide"] #upcoming-slide {
width: 50%;
height: 45%;
padding: 6px;
@media screen and (max-width: 1080px) {
#speaker-controls {
font-size: 16px;
}
}
body[data-speaker-layout="wide"] #current-slide {
top: 0;
left: 0;
@media screen and (max-width: 900px) {
#speaker-controls {
font-size: 14px;
}
}
body[data-speaker-layout="wide"] #upcoming-slide {
top: 0;
left: 50%;
}
body[data-speaker-layout="wide"] #speaker-controls {
top: 45%;
left: 0;
width: 100%;
height: 50%;
font-size: 1.25em;
}
/* Speaker layout: Tall */
body[data-speaker-layout="tall"] #current-slide,
body[data-speaker-layout="tall"] #upcoming-slide {
width: 45%;
height: 50%;
padding: 6px;
}
body[data-speaker-layout="tall"] #current-slide {
top: 0;
left: 0;
}
body[data-speaker-layout="tall"] #upcoming-slide {
top: 50%;
left: 0;
}
body[data-speaker-layout="tall"] #speaker-controls {
padding-top: 40px;
top: 0;
left: 45%;
width: 55%;
height: 100%;
font-size: 1.25em;
}
/* Speaker layout: Notes only */
body[data-speaker-layout="notes-only"] #current-slide,
body[data-speaker-layout="notes-only"] #upcoming-slide {
display: none;
}
body[data-speaker-layout="notes-only"] #speaker-controls {
padding-top: 40px;
top: 0;
left: 0;
width: 100%;
height: 100%;
font-size: 1.25em;
@media screen and (max-width: 800px) {
#speaker-controls {
font-size: 12px;
}
}
</style>
@@ -247,7 +152,7 @@
<body>
<div id="current-slide"></div>
<div id="upcoming-slide"><span class="overlay-element label">Upcoming</span></div>
<div id="upcoming-slide"><span class="label">UPCOMING:</span></div>
<div id="speaker-controls">
<div class="speaker-controls-time">
<h4 class="label">Time <span class="reset-button">Click to Reset</span></h4>
@@ -265,10 +170,6 @@
<div class="value"></div>
</div>
</div>
<div id="speaker-layout" class="overlay-element interactive">
<span class="speaker-layout-label"></span>
<select class="speaker-layout-dropdown"></select>
</div>
<script src="/socket.io/socket.io.js"></script>
<script src="/plugin/markdown/marked.js"></script>
@@ -281,20 +182,11 @@
currentState,
currentSlide,
upcomingSlide,
layoutLabel,
layoutDropdown,
connected = false;
var socket = io.connect( window.location.origin ),
socketId = '{{socketId}}';
var SPEAKER_LAYOUTS = {
'default': 'Default',
'wide': 'Wide',
'tall': 'Tall',
'notes-only': 'Notes only'
};
socket.on( 'statechanged', function( data ) {
// ignore data from sockets that aren't ours
@@ -303,6 +195,7 @@
if( connected === false ) {
connected = true;
setupIframes( data );
setupKeyboard();
setupNotes();
setupTimer();
@@ -313,28 +206,13 @@
} );
setupLayout();
// Load our presentation iframes
setupIframes();
// Once the iframes have loaded, emit a signal saying there's
// a new subscriber which will trigger a 'statechanged'
// message to be sent back
window.addEventListener( 'message', function( event ) {
var data = JSON.parse( event.data );
if( data && data.namespace === 'reveal' ) {
if( /ready/.test( data.eventName ) ) {
socket.emit( 'new-subscriber', { socketId: socketId } );
}
}
// Messages sent by reveal.js inside of the current slide preview
if( data && data.namespace === 'reveal' ) {
if( /slidechanged|fragmentshown|fragmenthidden|overviewshown|overviewhidden|paused|resumed/.test( data.eventName ) && currentState !== JSON.stringify( data.state ) ) {
socket.emit( 'statechanged-speaker', { state: data.state } );
socket.emit( 'connect', { socketId: socketId } );
}
}
@@ -389,7 +267,7 @@
/**
* Creates the preview iframes.
*/
function setupIframes() {
function setupIframes( data ) {
var params = [
'receiver',
@@ -399,8 +277,9 @@
'backgroundTransition=none'
].join( '&' );
var currentURL = '/?' + params + '&postMessageEvents=true';
var upcomingURL = '/?' + params + '&controls=false';
var hash = '#/' + data.state.indexh + '/' + data.state.indexv;
var currentURL = '/?' + params + '&postMessageEvents=true' + hash;
var upcomingURL = '/?' + params + '&controls=false' + hash;
currentSlide = document.createElement( 'iframe' );
currentSlide.setAttribute( 'width', 1280 );
@@ -472,74 +351,6 @@
}
/**
* Sets up the speaker view layout and layout selector.
*/
function setupLayout() {
layoutDropdown = document.querySelector( '.speaker-layout-dropdown' );
layoutLabel = document.querySelector( '.speaker-layout-label' );
// Render the list of available layouts
for( var id in SPEAKER_LAYOUTS ) {
var option = document.createElement( 'option' );
option.setAttribute( 'value', id );
option.textContent = SPEAKER_LAYOUTS[ id ];
layoutDropdown.appendChild( option );
}
// Monitor the dropdown for changes
layoutDropdown.addEventListener( 'change', function( event ) {
setLayout( layoutDropdown.value );
}, false );
// Restore any currently persisted layout
setLayout( getLayout() );
}
/**
* Sets a new speaker view layout. The layout is persisted
* in local storage.
*/
function setLayout( value ) {
var title = SPEAKER_LAYOUTS[ value ];
layoutLabel.innerHTML = 'Layout' + ( title ? ( ': ' + title ) : '' );
layoutDropdown.value = value;
document.body.setAttribute( 'data-speaker-layout', value );
// Persist locally
if( window.localStorage ) {
window.localStorage.setItem( 'reveal-speaker-layout', value );
}
}
/**
* Returns the ID of the most recently set speaker layout
* or our default layout if none has been set.
*/
function getLayout() {
if( window.localStorage ) {
var layout = window.localStorage.getItem( 'reveal-speaker-layout' );
if( layout ) {
return layout;
}
}
// Default to the first record in the layouts hash
for( var id in SPEAKER_LAYOUTS ) {
return id;
}
}
function zeroPadInteger( num ) {
var str = '00' + parseInt( num );
@@ -8,7 +8,6 @@
<style>
body {
font-family: Helvetica;
font-size: 18px;
}
#current-slide,
@@ -31,26 +30,15 @@
position: absolute;
top: 10px;
left: 10px;
z-index: 2;
}
.overlay-element {
height: 34px;
line-height: 34px;
padding: 0 10px;
text-shadow: none;
background: rgba( 220, 220, 220, 0.8 );
color: #222;
font-weight: bold;
font-size: 14px;
}
.overlay-element.interactive:hover {
background: rgba( 220, 220, 220, 1 );
z-index: 2;
color: rgba( 255, 255, 255, 0.9 );
}
#current-slide {
position: absolute;
width: 60%;
width: 65%;
height: 100%;
top: 0;
left: 0;
@@ -59,20 +47,20 @@
#upcoming-slide {
position: absolute;
width: 40%;
width: 35%;
height: 40%;
right: 0;
top: 0;
}
/* Speaker controls */
#speaker-controls {
position: absolute;
top: 40%;
right: 0;
width: 40%;
width: 35%;
height: 60%;
overflow: auto;
font-size: 18px;
}
@@ -82,7 +70,6 @@
}
.speaker-controls-time .label,
.speaker-controls-pace .label,
.speaker-controls-notes .label {
text-transform: uppercase;
font-weight: normal;
@@ -91,7 +78,7 @@
margin: 0;
}
.speaker-controls-time, .speaker-controls-pace {
.speaker-controls-time {
border-bottom: 1px solid rgba( 200, 200, 200, 0.5 );
margin-bottom: 10px;
padding: 10px 16px;
@@ -112,13 +99,6 @@
.speaker-controls-time .timer,
.speaker-controls-time .clock {
width: 50%;
}
.speaker-controls-time .timer,
.speaker-controls-time .clock,
.speaker-controls-time .pacing .hours-value,
.speaker-controls-time .pacing .minutes-value,
.speaker-controls-time .pacing .seconds-value {
font-size: 1.9em;
}
@@ -132,23 +112,7 @@
}
.speaker-controls-time span.mute {
opacity: 0.3;
}
.speaker-controls-time .pacing-title {
margin-top: 5px;
}
.speaker-controls-time .pacing.ahead {
color: blue;
}
.speaker-controls-time .pacing.on-track {
color: green;
}
.speaker-controls-time .pacing.behind {
color: red;
color: #bbb;
}
.speaker-controls-notes {
@@ -161,124 +125,24 @@
font-size: 1.2em;
}
/* Layout selector */
#speaker-layout {
position: absolute;
top: 10px;
right: 10px;
color: #222;
z-index: 10;
}
#speaker-layout select {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
border: 0;
box-shadow: 0;
cursor: pointer;
opacity: 0;
font-size: 1em;
background-color: transparent;
-moz-appearance: none;
-webkit-appearance: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
#speaker-layout select:focus {
outline: none;
box-shadow: none;
}
.clear {
clear: both;
}
/* Speaker layout: Wide */
body[data-speaker-layout="wide"] #current-slide,
body[data-speaker-layout="wide"] #upcoming-slide {
width: 50%;
height: 45%;
padding: 6px;
}
body[data-speaker-layout="wide"] #current-slide {
top: 0;
left: 0;
}
body[data-speaker-layout="wide"] #upcoming-slide {
top: 0;
left: 50%;
}
body[data-speaker-layout="wide"] #speaker-controls {
top: 45%;
left: 0;
width: 100%;
height: 50%;
font-size: 1.25em;
}
/* Speaker layout: Tall */
body[data-speaker-layout="tall"] #current-slide,
body[data-speaker-layout="tall"] #upcoming-slide {
width: 45%;
height: 50%;
padding: 6px;
}
body[data-speaker-layout="tall"] #current-slide {
top: 0;
left: 0;
}
body[data-speaker-layout="tall"] #upcoming-slide {
top: 50%;
left: 0;
}
body[data-speaker-layout="tall"] #speaker-controls {
padding-top: 40px;
top: 0;
left: 45%;
width: 55%;
height: 100%;
font-size: 1.25em;
}
/* Speaker layout: Notes only */
body[data-speaker-layout="notes-only"] #current-slide,
body[data-speaker-layout="notes-only"] #upcoming-slide {
display: none;
}
body[data-speaker-layout="notes-only"] #speaker-controls {
padding-top: 40px;
top: 0;
left: 0;
width: 100%;
height: 100%;
font-size: 1.25em;
}
@media screen and (max-width: 1080px) {
body[data-speaker-layout="default"] #speaker-controls {
#speaker-controls {
font-size: 16px;
}
}
@media screen and (max-width: 900px) {
body[data-speaker-layout="default"] #speaker-controls {
#speaker-controls {
font-size: 14px;
}
}
@media screen and (max-width: 800px) {
body[data-speaker-layout="default"] #speaker-controls {
#speaker-controls {
font-size: 12px;
}
}
@@ -289,7 +153,7 @@
<body>
<div id="current-slide"></div>
<div id="upcoming-slide"><span class="overlay-element label">Upcoming</span></div>
<div id="upcoming-slide"><span class="label">UPCOMING:</span></div>
<div id="speaker-controls">
<div class="speaker-controls-time">
<h4 class="label">Time <span class="reset-button">Click to Reset</span></h4>
@@ -300,11 +164,6 @@
<span class="hours-value">00</span><span class="minutes-value">:00</span><span class="seconds-value">:00</span>
</div>
<div class="clear"></div>
<h4 class="label pacing-title" style="display: none">Pacing Time to finish current slide</h4>
<div class="pacing" style="display: none">
<span class="hours-value">00</span><span class="minutes-value">:00</span><span class="seconds-value">:00</span>
</div>
</div>
<div class="speaker-controls-notes hidden">
@@ -312,10 +171,6 @@
<div class="value"></div>
</div>
</div>
<div id="speaker-layout" class="overlay-element interactive">
<span class="speaker-layout-label"></span>
<select class="speaker-layout-dropdown"></select>
</div>
<script src="../../plugin/markdown/marked.js"></script>
<script>
@@ -327,27 +182,12 @@
currentState,
currentSlide,
upcomingSlide,
layoutLabel,
layoutDropdown,
connected = false;
var SPEAKER_LAYOUTS = {
'default': 'Default',
'wide': 'Wide',
'tall': 'Tall',
'notes-only': 'Notes only'
};
setupLayout();
window.addEventListener( 'message', function( event ) {
var data = JSON.parse( event.data );
// The overview mode is only useful to the reveal.js instance
// where navigation occurs so we don't sync it
if( data.state ) delete data.state.overview;
// Messages sent by the notes plugin inside of the main window
if( data && data.namespace === 'reveal-notes' ) {
if( data.type === 'connect' ) {
@@ -363,10 +203,8 @@
// Send a message back to notify that the handshake is complete
window.opener.postMessage( JSON.stringify({ namespace: 'reveal-notes', type: 'connected'} ), '*' );
}
else if( /slidechanged|fragmentshown|fragmenthidden|paused|resumed/.test( data.eventName ) && currentState !== JSON.stringify( data.state ) ) {
else if( /slidechanged|fragmentshown|fragmenthidden|overviewshown|overviewhidden|paused|resumed/.test( data.eventName ) && currentState !== JSON.stringify( data.state ) ) {
window.opener.postMessage( JSON.stringify({ method: 'setState', args: [ data.state ]} ), '*' );
}
}
@@ -401,7 +239,6 @@
// No need for updating the notes in case of fragment changes
if ( data.notes ) {
notes.classList.remove( 'hidden' );
notesValue.style.whiteSpace = data.whitespace;
if( data.markdown ) {
notesValue.innerHTML = marked( data.notes );
}
@@ -450,10 +287,9 @@
'backgroundTransition=none'
].join( '&' );
var urlSeparator = /\?/.test(data.url) ? '&' : '?';
var hash = '#/' + data.state.indexh + '/' + data.state.indexv;
var currentURL = data.url + urlSeparator + params + '&postMessageEvents=true' + hash;
var upcomingURL = data.url + urlSeparator + params + '&controls=false' + hash;
var currentURL = data.url + '?' + params + '&postMessageEvents=true' + hash;
var upcomingURL = data.url + '?' + params + '&controls=false' + hash;
currentSlide = document.createElement( 'iframe' );
currentSlide.setAttribute( 'width', 1280 );
@@ -479,47 +315,6 @@
}
function getTimings() {
var slides = Reveal.getSlides();
var defaultTiming = Reveal.getConfig().defaultTiming;
if (defaultTiming == null) {
return null;
}
var timings = [];
for ( var i in slides ) {
var slide = slides[i];
var timing = defaultTiming;
if( slide.hasAttribute( 'data-timing' )) {
var t = slide.getAttribute( 'data-timing' );
timing = parseInt(t);
if( isNaN(timing) ) {
console.warn("Could not parse timing '" + t + "' of slide " + i + "; using default of " + defaultTiming);
timing = defaultTiming;
}
}
timings.push(timing);
}
return timings;
}
/**
* Return the number of seconds allocated for presenting
* all slides up to and including this one.
*/
function getTimeAllocated(timings) {
var slides = Reveal.getSlides();
var allocated = 0;
var currentSlide = Reveal.getSlidePastCount();
for (var i in slides.slice(0, currentSlide + 1)) {
allocated += timings[i];
}
return allocated;
}
/**
* Create the timer and clock and start updating them
* at an interval.
@@ -527,78 +322,28 @@
function setupTimer() {
var start = new Date(),
timeEl = document.querySelector( '.speaker-controls-time' ),
clockEl = timeEl.querySelector( '.clock-value' ),
hoursEl = timeEl.querySelector( '.hours-value' ),
minutesEl = timeEl.querySelector( '.minutes-value' ),
secondsEl = timeEl.querySelector( '.seconds-value' ),
pacingTitleEl = timeEl.querySelector( '.pacing-title' ),
pacingEl = timeEl.querySelector( '.pacing' ),
pacingHoursEl = pacingEl.querySelector( '.hours-value' ),
pacingMinutesEl = pacingEl.querySelector( '.minutes-value' ),
pacingSecondsEl = pacingEl.querySelector( '.seconds-value' );
var timings = getTimings();
if (timings !== null) {
pacingTitleEl.style.removeProperty('display');
pacingEl.style.removeProperty('display');
}
function _displayTime( hrEl, minEl, secEl, time) {
var sign = Math.sign(time) == -1 ? "-" : "";
time = Math.abs(Math.round(time / 1000));
var seconds = time % 60;
var minutes = Math.floor( time / 60 ) % 60 ;
var hours = Math.floor( time / ( 60 * 60 )) ;
hrEl.innerHTML = sign + zeroPadInteger( hours );
if (hours == 0) {
hrEl.classList.add( 'mute' );
}
else {
hrEl.classList.remove( 'mute' );
}
minEl.innerHTML = ':' + zeroPadInteger( minutes );
if (hours == 0 && minutes == 0) {
minEl.classList.add( 'mute' );
}
else {
minEl.classList.remove( 'mute' );
}
secEl.innerHTML = ':' + zeroPadInteger( seconds );
}
timeEl = document.querySelector( '.speaker-controls-time' ),
clockEl = timeEl.querySelector( '.clock-value' ),
hoursEl = timeEl.querySelector( '.hours-value' ),
minutesEl = timeEl.querySelector( '.minutes-value' ),
secondsEl = timeEl.querySelector( '.seconds-value' );
function _updateTimer() {
var diff, hours, minutes, seconds,
now = new Date();
now = new Date();
diff = now.getTime() - start.getTime();
hours = Math.floor( diff / ( 1000 * 60 * 60 ) );
minutes = Math.floor( ( diff / ( 1000 * 60 ) ) % 60 );
seconds = Math.floor( ( diff / 1000 ) % 60 );
clockEl.innerHTML = now.toLocaleTimeString( 'en-US', { hour12: true, hour: '2-digit', minute:'2-digit' } );
_displayTime( hoursEl, minutesEl, secondsEl, diff );
if (timings !== null) {
_updatePacing(diff);
}
}
function _updatePacing(diff) {
var slideEndTiming = getTimeAllocated(timings) * 1000;
var currentSlide = Reveal.getSlidePastCount();
var currentSlideTiming = timings[currentSlide] * 1000;
var timeLeftCurrentSlide = slideEndTiming - diff;
if (timeLeftCurrentSlide < 0) {
pacingEl.className = 'pacing behind';
}
else if (timeLeftCurrentSlide < currentSlideTiming) {
pacingEl.className = 'pacing on-track';
}
else {
pacingEl.className = 'pacing ahead';
}
_displayTime( pacingHoursEl, pacingMinutesEl, pacingSecondsEl, timeLeftCurrentSlide );
hoursEl.innerHTML = zeroPadInteger( hours );
hoursEl.className = hours > 0 ? '' : 'mute';
minutesEl.innerHTML = ':' + zeroPadInteger( minutes );
minutesEl.className = minutes > 0 ? '' : 'mute';
secondsEl.innerHTML = ':' + zeroPadInteger( seconds );
}
@@ -608,112 +353,14 @@
// Then update every second
setInterval( _updateTimer, 1000 );
function _resetTimer() {
if (timings == null) {
start = new Date();
}
else {
// Reset timer to beginning of current slide
var slideEndTiming = getTimeAllocated(timings) * 1000;
var currentSlide = Reveal.getSlidePastCount();
var currentSlideTiming = timings[currentSlide] * 1000;
var previousSlidesTiming = slideEndTiming - currentSlideTiming;
var now = new Date();
start = new Date(now.getTime() - previousSlidesTiming);
}
_updateTimer();
}
timeEl.addEventListener( 'click', function() {
_resetTimer();
start = new Date();
_updateTimer();
return false;
} );
}
/**
* Sets up the speaker view layout and layout selector.
*/
function setupLayout() {
layoutDropdown = document.querySelector( '.speaker-layout-dropdown' );
layoutLabel = document.querySelector( '.speaker-layout-label' );
// Render the list of available layouts
for( var id in SPEAKER_LAYOUTS ) {
var option = document.createElement( 'option' );
option.setAttribute( 'value', id );
option.textContent = SPEAKER_LAYOUTS[ id ];
layoutDropdown.appendChild( option );
}
// Monitor the dropdown for changes
layoutDropdown.addEventListener( 'change', function( event ) {
setLayout( layoutDropdown.value );
}, false );
// Restore any currently persisted layout
setLayout( getLayout() );
}
/**
* Sets a new speaker view layout. The layout is persisted
* in local storage.
*/
function setLayout( value ) {
var title = SPEAKER_LAYOUTS[ value ];
layoutLabel.innerHTML = 'Layout' + ( title ? ( ': ' + title ) : '' );
layoutDropdown.value = value;
document.body.setAttribute( 'data-speaker-layout', value );
// Persist locally
if( supportsLocalStorage() ) {
window.localStorage.setItem( 'reveal-speaker-layout', value );
}
}
/**
* Returns the ID of the most recently set speaker layout
* or our default layout if none has been set.
*/
function getLayout() {
if( supportsLocalStorage() ) {
var layout = window.localStorage.getItem( 'reveal-speaker-layout' );
if( layout ) {
return layout;
}
}
// Default to the first record in the layouts hash
for( var id in SPEAKER_LAYOUTS ) {
return id;
}
}
function supportsLocalStorage() {
try {
localStorage.setItem('test', 'test');
localStorage.removeItem('test');
return true;
}
catch( e ) {
return false;
}
}
function zeroPadInteger( num ) {
var str = '00' + parseInt( num );
@@ -11,18 +11,10 @@
*/
var RevealNotes = (function() {
function openNotes( notesFilePath ) {
if( !notesFilePath ) {
var jsFileLocation = document.querySelector('script[src$="notes.js"]').src; // this js file path
jsFileLocation = jsFileLocation.replace(/notes\.js(\?.*)?$/, ''); // the js folder path
notesFilePath = jsFileLocation + 'notes.html';
}
var notesPopup = window.open( notesFilePath, 'reveal.js - Notes', 'width=1100,height=700' );
// Allow popup window access to Reveal API
notesPopup.Reveal = this.Reveal;
function openNotes() {
var jsFileLocation = document.querySelector('script[src$="notes.js"]').src; // this js file path
jsFileLocation = jsFileLocation.replace(/notes\.js(\?.*)?$/, ''); // the js folder path
var notesPopup = window.open( jsFileLocation + 'notes.html', 'reveal.js - Notes', 'width=1100,height=700' );
/**
* Connect to the notes window through a postmessage handshake.
@@ -53,40 +45,22 @@ var RevealNotes = (function() {
/**
* Posts the current slide data to the notes window
*/
function post( event ) {
function post() {
var slideElement = Reveal.getCurrentSlide(),
notesElement = slideElement.querySelector( 'aside.notes' ),
fragmentElement = slideElement.querySelector( '.current-fragment' );
notesElement = slideElement.querySelector( 'aside.notes' );
var messageData = {
namespace: 'reveal-notes',
type: 'state',
notes: '',
markdown: false,
whitespace: 'normal',
state: Reveal.getState()
};
// Look for notes defined in a slide attribute
if( slideElement.hasAttribute( 'data-notes' ) ) {
messageData.notes = slideElement.getAttribute( 'data-notes' );
messageData.whitespace = 'pre-wrap';
}
// Look for notes defined in a fragment
if( fragmentElement ) {
var fragmentNotes = fragmentElement.querySelector( 'aside.notes' );
if( fragmentNotes ) {
notesElement = fragmentNotes;
}
else if( fragmentElement.hasAttribute( 'data-notes' ) ) {
messageData.notes = fragmentElement.getAttribute( 'data-notes' );
messageData.whitespace = 'pre-wrap';
// In case there are slide notes
notesElement = null;
}
}
// Look for notes defined in an aside element
@@ -120,7 +94,6 @@ var RevealNotes = (function() {
}
connect();
}
if( !/receiver/i.test( window.location.search ) ) {
@@ -136,18 +109,12 @@ var RevealNotes = (function() {
// modifier is present
if ( document.querySelector( ':focus' ) !== null || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return;
// Disregard the event if keyboard is disabled
if ( Reveal.getConfig().keyboard === false ) return;
if( event.keyCode === 83 ) {
event.preventDefault();
openNotes();
}
}, false );
// Show our keyboard shortcut in the reveal.js help overlay
if( window.Reveal ) Reveal.registerKeyboardShortcut( 'S', 'Speaker notes view' );
}
return { open: openNotes };
@@ -2,18 +2,32 @@
* phantomjs script for printing presentations to PDF.
*
* Example:
* phantomjs print-pdf.js "http://revealjs.com?print-pdf" reveal-demo.pdf
* phantomjs print-pdf.js "http://lab.hakim.se/reveal-js?print-pdf" reveal-demo.pdf
*
* @author Manuel Bieh (https://github.com/manuelbieh)
* @author Hakim El Hattab (https://github.com/hakimel)
* @author Manuel Riezebosch (https://github.com/riezebosch)
* By Manuel Bieh (https://github.com/manuelbieh)
*/
// html2pdf.js
var page = new WebPage();
var system = require( 'system' );
var probePage = new WebPage();
var printPage = new WebPage();
var slideWidth = system.args[3] ? system.args[3].split( 'x' )[0] : 960;
var slideHeight = system.args[3] ? system.args[3].split( 'x' )[1] : 700;
page.viewportSize = {
width: slideWidth,
height: slideHeight
};
// TODO
// Something is wrong with these config values. An input
// paper width of 1920px actually results in a 756px wide
// PDF.
page.paperSize = {
width: Math.round( slideWidth * 2 ),
height: Math.round( slideHeight * 2 ),
border: 0
};
var inputFile = system.args[1] || 'index.html?print-pdf';
var outputFile = system.args[2] || 'slides.pdf';
@@ -22,48 +36,13 @@ if( outputFile.match( /\.pdf$/gi ) === null ) {
outputFile += '.pdf';
}
console.log( 'Export PDF: Reading reveal.js config [1/4]' );
console.log( 'Printing PDF (Paper size: '+ page.paperSize.width + 'x' + page.paperSize.height +')' );
probePage.open( inputFile, function( status ) {
console.log( 'Export PDF: Preparing print layout [2/4]' );
var config = probePage.evaluate( function() {
return Reveal.getConfig();
} );
if( config ) {
printPage.paperSize = {
width: Math.floor( config.width * ( 1 + config.margin ) ),
height: Math.floor( config.height * ( 1 + config.margin ) ),
border: 0
};
printPage.open( inputFile, function( status ) {
console.log( 'Export PDF: Preparing pdf [3/4]')
printPage.evaluate(function() {
Reveal.isReady() ? window.callPhantom() : Reveal.addEventListener( 'pdf-ready', window.callPhantom );
});
} );
printPage.onCallback = function(data) {
// For some reason we need to "jump the queue" for syntax highlighting to work.
// See: http://stackoverflow.com/a/3580132/129269
setTimeout(function() {
console.log( 'Export PDF: Writing file [4/4]' );
printPage.render( outputFile );
console.log( 'Export PDF: Finished successfully!' );
phantom.exit();
}, 0);
};
}
else {
console.log( 'Export PDF: Unable to read reveal.js config. Make sure the input address points to a reveal.js page.' );
phantom.exit(1);
}
page.open( inputFile, function( status ) {
window.setTimeout( function() {
console.log( 'Printed succesfully' );
page.render( outputFile );
phantom.exit();
}, 1000 );
} );
@@ -21,7 +21,7 @@ function Hilitor(id, tag)
var targetNode = document.getElementById(id) || document.body;
var hiliteTag = tag || "EM";
var skipTags = new RegExp("^(?:" + hiliteTag + "|SCRIPT|FORM)$");
var skipTags = new RegExp("^(?:" + hiliteTag + "|SCRIPT|FORM|SPAN)$");
var colors = ["#ff6", "#a0ffff", "#9f9", "#f99", "#f6f"];
var wordColor = [];
var colorIdx = 0;
@@ -53,11 +53,11 @@ function Hilitor(id, tag)
if(node.nodeType == 3) { // NODE_TEXT
if((nv = node.nodeValue) && (regs = matchRegex.exec(nv))) {
//find the slide's section element and save it in our list of matching slides
var secnode = node;
while (secnode != null && secnode.nodeName != 'SECTION') {
var secnode = node.parentNode;
while (secnode.nodeName != 'SECTION') {
secnode = secnode.parentNode;
}
var slideIndex = Reveal.getIndices(secnode);
var slidelen = matchingSlides.length;
var alreadyAdded = false;
@@ -69,7 +69,7 @@ function Hilitor(id, tag)
if (! alreadyAdded) {
matchingSlides.push(slideIndex);
}
if(!wordColor[regs[0].toLowerCase()]) {
wordColor[regs[0].toLowerCase()] = colors[colorIdx++ % colors.length];
}
@@ -110,26 +110,20 @@ function Hilitor(id, tag)
function openSearch() {
//ensure the search term input dialog is visible and has focus:
var inputboxdiv = document.getElementById("searchinputdiv");
var inputbox = document.getElementById("searchinput");
inputboxdiv.style.display = "inline";
inputbox.style.display = "inline";
inputbox.focus();
inputbox.select();
}
function closeSearch() {
var inputboxdiv = document.getElementById("searchinputdiv");
inputboxdiv.style.display = "none";
if(myHilitor) myHilitor.remove();
}
function toggleSearch() {
var inputboxdiv = document.getElementById("searchinputdiv");
if (inputboxdiv.style.display !== "inline") {
var inputbox = document.getElementById("searchinput");
if (inputbox.style.display !== "inline") {
openSearch();
}
else {
closeSearch();
inputbox.style.display = "none";
myHilitor.remove();
}
}
@@ -138,27 +132,19 @@ function Hilitor(id, tag)
if (searchboxDirty) {
var searchstring = document.getElementById("searchinput").value;
if (searchstring === '') {
if(myHilitor) myHilitor.remove();
matchedSlides = null;
}
else {
//find the keyword amongst the slides
myHilitor = new Hilitor("slidecontent");
matchedSlides = myHilitor.apply(searchstring);
currentMatchedIndex = 0;
}
//find the keyword amongst the slides
myHilitor = new Hilitor("slidecontent");
matchedSlides = myHilitor.apply(searchstring);
currentMatchedIndex = 0;
}
if (matchedSlides) {
//navigate to the next slide that has the keyword, wrapping to the first if necessary
if (matchedSlides.length && (matchedSlides.length <= currentMatchedIndex)) {
currentMatchedIndex = 0;
}
if (matchedSlides.length > currentMatchedIndex) {
Reveal.slide(matchedSlides[currentMatchedIndex].h, matchedSlides[currentMatchedIndex].v);
currentMatchedIndex++;
}
//navigate to the next slide that has the keyword, wrapping to the first if necessary
if (matchedSlides.length && (matchedSlides.length <= currentMatchedIndex)) {
currentMatchedIndex = 0;
}
if (matchedSlides.length > currentMatchedIndex) {
Reveal.slide(matchedSlides[currentMatchedIndex].h, matchedSlides[currentMatchedIndex].v);
currentMatchedIndex++;
}
}
@@ -171,8 +157,7 @@ function Hilitor(id, tag)
searchElement.classList.add( 'searchdiv' );
searchElement.style.position = 'absolute';
searchElement.style.top = '10px';
searchElement.style.right = '10px';
searchElement.style.zIndex = 10;
searchElement.style.left = '10px';
//embedded base64 search icon Designed by Sketchdock - http://www.sketchdock.com/:
searchElement.innerHTML = '<span><input type="search" id="searchinput" class="searchinput" style="vertical-align: top;"/><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJiSURBVHjatFZNaxNBGH5md+Mmu92NVdKDRipSAyqCghgQD4L4cRe86UUtAQ+eFCxoa4/25EXBFi8eBE+eRPoDhB6KgiiixdAPCEkx2pjvTXadd9yNsflwuyUDD/O+u8PzzDPvzOwyx3EwyCZhwG3gAkp7MnpjgbopjsltcD4gjuXZZKeAR348MYLYTm3LzOs/y3j3JTfZxgXWXmTuwPHIc4VmoOmv5IrI53+AO2DdHLjkDWQ3GoEEVFXtXQOvkSnPWcyUceviLhwbDYv8/XIVj97kse7TodLvZXxYxrPUHkQ1ufXs3FEdybEIxucySOesoNvUgWU1cP3MkCBfTFdw9fGaAMVmRELq7LBw2Q3/FaAxxWIRpw+ZIr/7IouPqzUBiqmdHAv7EuhRAwf1er2Vy4x1jW3b2d5Jfvu5IPp7l2LYbcgCFFNb+FoJ7oBqEAqFMPNqFcmEgVMJDfMT+1tvN0pNjERlMS6QA5pFOKxiKVPFhakPeL3It+WGJUDxt2wFR+JhzI7v5ctkd8DXOZAkCYYxhO+lKm4+Xfqz/rIixBuNBl7eOYzkQQNzqX249mRl6zUgEcYkaJrGhUwBinVdh6IouPzwE6/DL5w4oLkH8y981aDf+uq6hlKpJESiUdNfDZi7/ehG9K6KfiA3pml0PLcsq+cSMTj2NL9ukc4UOmz7AZ3+crkC4mHujFvXNaMFB3bEr8xPS6p5O+jXxq4VZtaen7/PwzrntjcLUE0iHPS1Ud1cdiEJl/8WivZk0wXd7zWOMkeF8s0CcAmkNrC2nvXZDbbbN73ccYnZoH9bfgswAFzAe9/h3dbKAAAAAElFTkSuQmCC" id="searchbutton" class="searchicon" style="vertical-align: top; margin-top: -1px;"/></span>';
dom.wrapper.appendChild( searchElement );
@@ -194,13 +179,18 @@ function Hilitor(id, tag)
}
}, false );
// Open the search when the 's' key is hit (yes, this conflicts with the notes plugin, disabling for now)
/*
document.addEventListener( 'keydown', function( event ) {
if( event.key == "F" && (event.ctrlKey || event.metaKey) ) {//Control+Shift+f
// Disregard the event if the target is editable or a
// modifier is present
if ( document.querySelector( ':focus' ) !== null || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return;
if( event.keyCode === 83 ) {
event.preventDefault();
toggleSearch();
openSearch();
}
}, false );
if( window.Reveal ) Reveal.registerKeyboardShortcut( 'Ctrl-Shift-F', 'Search' );
closeSearch();
*/
return { open: openSearch };
})();
@@ -1,27 +1,30 @@
// Custom reveal.js integration
(function(){
var revealElement = document.querySelector( '.reveal' );
if( revealElement ) {
var isEnabled = true;
revealElement.addEventListener( 'mousedown', function( event ) {
var defaultModifier = /Linux/.test( window.navigator.platform ) ? 'ctrl' : 'alt';
document.querySelector( '.reveal .slides' ).addEventListener( 'mousedown', function( event ) {
var modifier = ( Reveal.getConfig().zoomKey ? Reveal.getConfig().zoomKey : 'alt' ) + 'Key';
var modifier = ( Reveal.getConfig().zoomKey ? Reveal.getConfig().zoomKey : defaultModifier ) + 'Key';
var zoomLevel = ( Reveal.getConfig().zoomLevel ? Reveal.getConfig().zoomLevel : 2 );
var zoomPadding = 20;
var revealScale = Reveal.getScale();
if( event[ modifier ] && !Reveal.isOverview() ) {
event.preventDefault();
if( event[ modifier ] && isEnabled ) {
event.preventDefault();
zoom.to({
x: event.clientX,
y: event.clientY,
scale: zoomLevel,
pan: false
});
}
} );
var bounds = event.target.getBoundingClientRect();
}
zoom.to({
x: ( bounds.left * revealScale ) - zoomPadding,
y: ( bounds.top * revealScale ) - zoomPadding,
width: ( bounds.width * revealScale ) + ( zoomPadding * 2 ),
height: ( bounds.height * revealScale ) + ( zoomPadding * 2 ),
pan: false
});
}
} );
Reveal.addEventListener( 'overviewshown', function() { isEnabled = false; } );
Reveal.addEventListener( 'overviewhidden', function() { isEnabled = true; } );
})();
/*!
@@ -270,3 +273,6 @@ var zoom = (function(){
}
})();
@@ -169,7 +169,7 @@
transition: 'linear',
math: {
// mathjax: 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js',
// mathjax: 'http://cdn.mathjax.org/mathjax/latest/MathJax.js',
config: 'TeX-AMS_HTML-full'
},
@@ -93,7 +93,7 @@
<h2>Video background</h2>
</section>
<section data-background-iframe="https://slides.com/news/make-better-presentations/embed?style=hidden&autoSlide=4000">
<section data-background-iframe="https://slides.com">
<h2>Iframe background</h2>
</section>
@@ -13,7 +13,7 @@
<body style="overflow: auto;">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<div id="qunit-fixture"></div>
<div class="reveal" style="display: none;">
@@ -24,11 +24,10 @@
<img data-src="fake-url.png">
<video data-src="fake-url.mp4"></video>
<audio data-src="fake-url.mp3"></audio>
<aside class="notes">speaker notes 1</aside>
</section>
<section>
<section data-background="examples/assets/image2.png" data-notes="speaker notes 2">
<section data-background="examples/assets/image2.png">
<h1>2.1</h1>
</section>
<section>
@@ -89,7 +89,7 @@ Reveal.addEventListener( 'ready', function() {
test( 'Reveal.isLastSlide after vertical slide', function() {
var lastSlideIndex = document.querySelectorAll( '.reveal .slides>section' ).length - 1;
Reveal.slide( 1, 1 );
Reveal.slide( lastSlideIndex );
strictEqual( Reveal.isLastSlide(), true, 'true after Reveal.slide( 1, 1 ) and then Reveal.slide( '+ lastSlideIndex +', 0 )' );
@@ -139,14 +139,6 @@ Reveal.addEventListener( 'ready', function() {
strictEqual( Reveal.getSlideBackground( 1, 100 ), undefined, 'undefined when out of vertical bounds' );
});
test( 'Reveal.getSlideNotes', function() {
Reveal.slide( 0, 0 );
ok( Reveal.getSlideNotes() === 'speaker notes 1', 'works with <aside class="notes">' );
Reveal.slide( 1, 0 );
ok( Reveal.getSlideNotes() === 'speaker notes 2', 'works with <section data-notes="">' );
});
test( 'Reveal.getPreviousSlide/getCurrentSlide', function() {
Reveal.slide( 0, 0 );
Reveal.slide( 1, 0 );
+69 -61
View File
@@ -10,9 +10,9 @@
"<!-- 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: **May 28, 2018**\n",
"Date: **Jun 10, 2019**\n",
"\n",
"Copyright 1999-2018, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license\n",
"Copyright 1999-2019, Morten Hjorth-Jensen. Released under CC Attribution-NonCommercial 4.0 license\n",
"\n",
"\n",
"\n",
@@ -20,14 +20,24 @@
"\n",
"## Introduction\n",
"\n",
"Statistics, data science and machine learning form important fields of\n",
"research in modern science. They describe how to learn and make\n",
"predictions from data, as well as allowing us to extract important\n",
"correlations about physical process and the underlying laws of motion\n",
"in large data sets. The latter, big data sets, appear frequently in\n",
"essentially all disciplines, from the traditional Science, Technology,\n",
"Mathematics and Engineering fields to Life Science, Law, education\n",
"research, the Humanities and the Social Sciences. \n",
"During the last two decades there has been a swift and amazing\n",
"development of Machine Learning techniques and algorithms that impact\n",
"many areas in not only Science and Technology but also the Humanities,\n",
"Social Sciences, Medicine, Law, indeed, almost all possible\n",
"disciplines. The applications are incredibly many, from self-driving\n",
"cars to solving high-dimensional differential equations or complicated\n",
"quantum mechanical many-body problems. Machine Learning is perceived\n",
"by many as one of the main disruptive techniques nowadays. \n",
"\n",
"Statistics, Data science and Machine Learning form important\n",
"fields of research in modern science. They describe how to learn and\n",
"make predictions from data, as well as allowing us to extract\n",
"important correlations about physical process and the underlying laws\n",
"of motion in large data sets. The latter, big data sets, appear\n",
"frequently in essentially all disciplines, from the traditional\n",
"Science, Technology, Mathematics and Engineering fields to Life\n",
"Science, Law, education research, the Humanities and the Social\n",
"Sciences.\n",
"\n",
"It has become more\n",
"and more common to see research projects on big data in for example\n",
@@ -87,7 +97,7 @@
"<!-- !split -->\n",
"## Learning outcomes\n",
"\n",
"These setsof lectures aim at giving you an overview of central aspects of\n",
"These sets of lectures aim at giving you an overview of central aspects of\n",
"statistical data analysis as well as some of the central algorithms\n",
"used in machine learning. We will introduce a variety of central\n",
"algorithms and methods essential for studies of data analysis and\n",
@@ -95,17 +105,17 @@
"\n",
"Hands-on projects and experimenting with data and algorithms plays a central role in\n",
"these lectures, and our hope is, through the various\n",
"projects and exercies, to expose you to fundamental\n",
"projects and exercises, to expose you to fundamental\n",
"research problems in these fields, with the aim to reproduce state of\n",
"the art scientific results. You will learn to develop and\n",
"structure large codes for studying these systems, get acquainted with\n",
"structure codes for studying these systems, get acquainted with\n",
"computing facilities and learn to handle large scientific projects. A\n",
"good scientific and ethical conduct is emphasized throughout the\n",
"course. More specifically, you will\n",
"\n",
"1. learn about basic data analysis, Bayesian statistics, Monte Carlo methods, data optimization and machine learning;\n",
"1. Learn about basic data analysis, Bayesian statistics, Monte Carlo methods, data optimization and machine learning;\n",
"\n",
"2. be capable of extending the acquired knowledge to other systems and cases;\n",
"2. Be capable of extending the acquired knowledge to other systems and cases;\n",
"\n",
"3. Have an understanding of central algorithms used in data analysis and machine learning;\n",
"\n",
@@ -117,24 +127,24 @@
"\n",
"7. Work on numerical projects to illustrate the theory. The projects play a central role and you are expected to know modern programming languages like Python or C++, in addition to a basic knowledge of linear algebra (typically taught during the first one or two years of undergraduate studies).\n",
"\n",
"There are several topics we will cover here, spanning from a\n",
"statistical data analysis and its basic concepts such expectation\n",
"There are several topics we will cover here, spanning from \n",
"statistical data analysis and its basic concepts such as expectation\n",
"values, variance, covariance, correlation functions and errors, via\n",
"well-known probability distribution functions like uniform\n",
"well-known probability distribution functions like the uniform\n",
"distribution, the binomial distribution, the Poisson distribution and\n",
"simple and multivariate normal distributions to central elements of\n",
"Bayesian statistics and modeling. We will also remind the reader about\n",
"central elements from linear algebra and standard methods based on\n",
"linear algebra used to fit functions such Cubic splines and gradient\n",
"methods for data optimization and the Singular-value decomposition and\n",
"linear algebra used to optimize (minimize) functions (the family of gradient descent methods)\n",
"and the Singular-value decomposition and\n",
"least square methods for parameterizing data.\n",
"\n",
"We will also cover Monte Carlo methods, Markov chains, well-known\n",
"algorithms for sampling stochastic events like the Metropolis-Hastings\n",
"and Gibbs sampling methods. An important aspect of all our\n",
"calculations is a proper estimation of errors. Here we will also\n",
"discuss famous resampling techniques like the blocking, bootstrapping\n",
"and jackknife methods.\n",
"discuss famous resampling techniques like the blocking, the bootstrapping\n",
"and the jackknife methods and the infamous bias-variance tradeoff. \n",
"\n",
"The second part of the material covers several algorithms used in\n",
"machine learning.\n",
@@ -169,8 +179,12 @@
"The methods we cover have three main topics in common, irrespective of\n",
"whether we deal with supervised or unsupervised learning. The first\n",
"ingredient is normally our data set (which can be subdivided into\n",
"training and test data), the second item is a model which is normally a\n",
"function of some parameters. The model reflects our knowledge of the system (or lack thereof). As an example, if we know that our data show a behavior similar to what would be predicted by a polynomial, fitting our data to a polynomial of some degree would then determin our model. \n",
"training and test data), the second item is a model which is normally\n",
"a function of some parameters. The model reflects our knowledge of\n",
"the system (or lack thereof). As an example, if we know that our data\n",
"show a behavior similar to what would be predicted by a polynomial,\n",
"fitting our data to a polynomial of some degree would then determin\n",
"our model.\n",
"\n",
"The last ingredient is a so-called **cost**\n",
"function which allows us to present an estimate on how good our model\n",
@@ -181,39 +195,32 @@
"analysis, stochastic processes etc. We will discuss the following\n",
"machine learning algorithms\n",
"\n",
"1. Linear regression and its variants, in essence polynomial regression\n",
"1. Linear regression and its variants\n",
"\n",
"2. Decision tree algorithms, from simpler to more complex ones\n",
"2. Decision tree algorithms, from single trees to random forests\n",
"\n",
"3. Nearest neighbors models\n",
"3. Bayesian statistics and regression\n",
"\n",
"4. Bayesian statistics and regression\n",
"4. Support vector machines and finally various variants of\n",
"\n",
"5. Support vector machines and finally various variants of\n",
"5. Artifical neural networks and deep learning, including convolutional neural networks and Bayesian neural networks\n",
"\n",
"6. Artifical neural networks and deep learning\n",
"\n",
"7. Networks for unsupervised learning using for example reduced Boltzmann machines.\n",
"6. Networks for unsupervised learning using for example reduced Boltzmann machines.\n",
"\n",
"## Choice of programming language\n",
"\n",
"Python plays nowadays a central role in the development of machine\n",
"learning techniques and tools for data analysis. In particular, seen\n",
"the wealth of machine learning and data analysis packages written in\n",
"the wealth of machine learning and data analysis libraries written in\n",
"Python, easy to use libraries with immediate visualization(and not the\n",
"least impressive galleries of existing example), the popularity of the\n",
"least impressive galleries of existing examples), the popularity of the\n",
"Jupyter notebook framework with the possibility to run **R** codes or\n",
"compiled programs written in C++, and much more made our choice of\n",
"programming language for this series of lectures of easy. However,\n",
"since the focus here is not only on using existing Python tools such\n",
"as **scikit-learn** or **tensorflow**, but also on developing your own\n",
"programming language for this series of lectures easy. However,\n",
"since the focus here is not only on using existing Python libraries such\n",
"as **Scikit-Learn** or **Tensorflow**, but also on developing your own\n",
"algorithms and codes, we will as far as possible present many of these\n",
"algorithms eithers a Python codes or C++ codes. Finally, we will, as\n",
"far as possible keep parallel versions of the data analysis and\n",
"machine larning programming aspects in **R** as\n",
"well. [R](https://www.r-project.org/) is a language and environment\n",
"for statistical computing and graphics which is widely used in\n",
"statistics and mathematics applications.\n",
"algorithms either as a Python codes or C++ or Fortran (or other languages) codes. \n",
"\n",
"The reason we also focus on compiled languages like C++ (or\n",
"Fortran), is that Python is still notoriously slow when we do not\n",
@@ -221,7 +228,7 @@
"[Lapack](http://www.netlib.org/lapack/) or other numerical libraries\n",
"written in compiled languages (many of these libraries are written in\n",
"Fortran). Although a project like [Numba](https://numba.pydata.org/)\n",
"holds great promise for speeding up the unrolling of lengthy loops, C+\n",
"holds great promise for speeding up the unrolling of lengthy loops, C++\n",
"and Fortran are presently still the performance winners. Numba gives\n",
"you potentially the power to speed up your applications with high\n",
"performance functions written directly in Python. In particular,\n",
@@ -242,14 +249,14 @@
"be analyzed. Most of the applications we will discuss deal with\n",
"small data sets (less than a terabyte of information) and can easily\n",
"be analyzed and tested on standard off the shelf laptops you find in general \n",
"grocery stores.\n",
"stores.\n",
"\n",
"## Data handling, machine learning and ethical aspects\n",
"\n",
"In most of the cases we will study, we will either generate the data\n",
"to analyze ourselves (both for supervised learning and unsupervised\n",
"learning) or we will recur again and again to data present in say\n",
"**scikit-learn** or **tensorflow**. Many of the examples we end up\n",
"**Scikit-Learn** or **Tensorflow**. Many of the examples we end up\n",
"dealing with are from a privacy and data protection point of view,\n",
"rather inoccuous and boring results of numerical\n",
"calculations. However, this does not hinder us from developing a sound\n",
@@ -264,7 +271,7 @@
"and data sets we have used, freely and easily accessible to a wider\n",
"community. This helps us almost automagically in making our science\n",
"reproducible. The large open-source development communities involved\n",
"in say [Scikit-learn](http://scikit-learn.org/stable/),\n",
"in say [Scikit-Learn](http://scikit-learn.org/stable/),\n",
"[Tensorflow](https://www.tensorflow.org/),\n",
"[PyTorch](http://pytorch.org/) and [Keras](https://keras.io/), are\n",
"all excellent examples of this. The codes can be tested and improved\n",
@@ -273,23 +280,23 @@
"easier today to gain traction and acceptance for making your science\n",
"reproducible. From a societal stand, this is an important element\n",
"since many of the developers are employees of large public institutions like\n",
"universities and research labs. Our taxpayer do deserve to get\n",
"universities and research labs. Our fellow taxpayers do deserve to get\n",
"something back for their bucks.\n",
"\n",
"However, this more mechanical aspect of the ethics of science (in\n",
"particular the reproducibility of scientific results) is something\n",
"which is obvious and everybody should do as part of the dialectics of\n",
"which is obvious and everybody should do so as part of the dialectics of\n",
"science. The fact that many scientists are not willing to share their codes or \n",
"data is detrimental to the scientific discourse.\n",
"\n",
"Before we proceed, we should add a disclaimer. Even though\n",
"we may dream of computers developing some kind of higher learning\n",
"capabilities, at the end (even if the artificial intelligence\n",
"community keeps touting our ears full of fancy futuristic avenues), it is we\n",
"community keeps touting our ears full of fancy futuristic avenues), it is we, yes you reading these lines,\n",
"who end up constructing and instructing, via various algorithms, the\n",
"computers. Self-driving cars for example, rely on sofisticated\n",
"machine learning approaches. Self-driving cars for example, rely on sofisticated\n",
"programs which take into account all possible situations a car can\n",
"encounter. In addition, extensive usage of training datas from GPS\n",
"encounter. In addition, extensive usage of training data from GPS\n",
"information, maps etc, are typically fed into the software for\n",
"self-driving cars. Adding to this various sensors and cameras that\n",
"feed information to the programs, there are zillions of ethical issues\n",
@@ -299,8 +306,8 @@
"learning algorithms discussed here enter into the codes, at a certain\n",
"stage we have to make choices. Yes, we , the lads and lasses who wrote\n",
"a program for a specific brand of a self-driving car. As an example,\n",
"a most carmakers have as their utmost priority the security of the\n",
"driver and the accompanying passengers. A famous carmaker, which is\n",
"all carmakers have as their utmost priority the security of the\n",
"driver and the accompanying passengers. A famous European carmaker, which is\n",
"one of the leaders in the market of self-driving cars, had **if**\n",
"statements of the following type: suppose there are two obstacles in\n",
"front of you and you cannot avoid to collide with one of them. One of\n",
@@ -310,9 +317,9 @@
"the likelihood of surving a collision with our future citizens, is\n",
"much higher.\n",
"\n",
"This brings us leads then to serious ethical aspects. Why should we\n",
"This leads to serious ethical aspects. Why should we\n",
"opt for such an option? Who decides and who is entitled to make such\n",
"choices? Keep in mind that many of the algorithms you will about in\n",
"choices? Keep in mind that many of the algorithms you will encounter in\n",
"this series of lectures or hear about later, are indeed based on\n",
"simple programming instructions. And you are very likely to be one of\n",
"the people who may end up writing such a code. Thus, developing a\n",
@@ -324,15 +331,16 @@
"not weighting some data in a particular way, perhaps because you dearly want a\n",
"specific conclusion which may support your political views?\n",
"\n",
"We do not have the answers here, but we want you think over these\n",
"topics in a more overarching way. A statistical data analysis with\n",
"its dry numbers and graphs meant to guide the eye, do not necessarily\n",
"We do not have the answers here, nor will we venture into a deeper\n",
"discussions of these aspects, but we want you think over these topics\n",
"in a more overarching way. A statistical data analysis with its dry\n",
"numbers and graphs meant to guide the eye, does not necessarily\n",
"reflect the truth, whatever that is. As a scientist, and after a\n",
"university education, you are supposedly a better citizen, with an\n",
"improved critical view and understanding of the scientific method, and\n",
"perhaps some deeper understandings of the ethics of science at\n",
"perhaps some deeper understanding of the ethics of science at\n",
"large. Use these insights. Be a critical citizen. You owe it to our\n",
"societies.\n",
"society.\n",
"\n",
"\n",
"\n",
Binary file not shown.
+2 -2
View File
@@ -11,7 +11,7 @@ DATE: today
* Thursday: First lecture: Presentation of the course, aims and content
* Thursday: Second Lecture: Start with simple linear regression and repetition of linear algebra
* Friday: Linear regression
* Computer lab: Wednesday. First time: Wednesday August 29.
* Computer lab: Wednesday. First time: Tuesday August 27.
!eblock
!split
@@ -34,7 +34,7 @@ The recommended textbooks
* Weekly exercises when not working on projects. You can hand in exercises if you want.
* First hour of each lab session may be used to discuss technicalities, address questions etc linked with projects and exercises.
* Detailed lecture notes, exercises, all programs presented, projects etc can be found at the homepage of the course.
* Computerlab: Wednesday (10am-6pm), room FV329, four groups (10am-12pm, 12pm-2pm, 2pm-4pm, 4pm-6pm).
* Computerlab: Tuesday (8am-6pm), room FV329, five groups (8am-10am, 10am-12pm, 12pm-2pm, 2pm-4pm, 4pm-6pm).
* Weekly plans and all other information are on the official webpage.
* No final exam, three projects that are graded and have to be approved.
!eblock
+64 -55
View File
@@ -6,14 +6,24 @@ DATE: today
===== Introduction =====
Statistics, data science and machine learning form important fields of
research in modern science. They describe how to learn and make
predictions from data, as well as allowing us to extract important
correlations about physical process and the underlying laws of motion
in large data sets. The latter, big data sets, appear frequently in
essentially all disciplines, from the traditional Science, Technology,
Mathematics and Engineering fields to Life Science, Law, education
research, the Humanities and the Social Sciences.
During the last two decades there has been a swift and amazing
development of Machine Learning techniques and algorithms that impact
many areas in not only Science and Technology but also the Humanities,
Social Sciences, Medicine, Law, indeed, almost all possible
disciplines. The applications are incredibly many, from self-driving
cars to solving high-dimensional differential equations or complicated
quantum mechanical many-body problems. Machine Learning is perceived
by many as one of the main disruptive techniques nowadays.
Statistics, Data science and Machine Learning form important
fields of research in modern science. They describe how to learn and
make predictions from data, as well as allowing us to extract
important correlations about physical process and the underlying laws
of motion in large data sets. The latter, big data sets, appear
frequently in essentially all disciplines, from the traditional
Science, Technology, Mathematics and Engineering fields to Life
Science, Law, education research, the Humanities and the Social
Sciences.
It has become more
and more common to see research projects on big data in for example
@@ -73,7 +83,7 @@ of algorithms and methods we will discuss.
!split
===== Learning outcomes =====
These setsof lectures aim at giving you an overview of central aspects of
These sets of lectures aim at giving you an overview of central aspects of
statistical data analysis as well as some of the central algorithms
used in machine learning. We will introduce a variety of central
algorithms and methods essential for studies of data analysis and
@@ -81,40 +91,40 @@ machine learning.
Hands-on projects and experimenting with data and algorithms plays a central role in
these lectures, and our hope is, through the various
projects and exercies, to expose you to fundamental
projects and exercises, to expose you to fundamental
research problems in these fields, with the aim to reproduce state of
the art scientific results. You will learn to develop and
structure large codes for studying these systems, get acquainted with
structure codes for studying these systems, get acquainted with
computing facilities and learn to handle large scientific projects. A
good scientific and ethical conduct is emphasized throughout the
course. More specifically, you will
o learn about basic data analysis, Bayesian statistics, Monte Carlo methods, data optimization and machine learning;
o be capable of extending the acquired knowledge to other systems and cases;
o Learn about basic data analysis, Bayesian statistics, Monte Carlo methods, data optimization and machine learning;
o Be capable of extending the acquired knowledge to other systems and cases;
o Have an understanding of central algorithms used in data analysis and machine learning;
o Gain knowledge of central aspects of Monte Carlo methods, Markov chains, Gibbs samplers and their possible applications, from numerical integration to simulation of stock markets;
o Understand methods for regression and classification;
o Learn about neural network, genetic algorithms and Boltzmann machines;
o Work on numerical projects to illustrate the theory. The projects play a central role and you are expected to know modern programming languages like Python or C++, in addition to a basic knowledge of linear algebra (typically taught during the first one or two years of undergraduate studies).
There are several topics we will cover here, spanning from a
statistical data analysis and its basic concepts such expectation
There are several topics we will cover here, spanning from
statistical data analysis and its basic concepts such as expectation
values, variance, covariance, correlation functions and errors, via
well-known probability distribution functions like uniform
well-known probability distribution functions like the uniform
distribution, the binomial distribution, the Poisson distribution and
simple and multivariate normal distributions to central elements of
Bayesian statistics and modeling. We will also remind the reader about
central elements from linear algebra and standard methods based on
linear algebra used to fit functions such Cubic splines and gradient
methods for data optimization and the Singular-value decomposition and
linear algebra used to optimize (minimize) functions (the family of gradient descent methods)
and the Singular-value decomposition and
least square methods for parameterizing data.
We will also cover Monte Carlo methods, Markov chains, well-known
algorithms for sampling stochastic events like the Metropolis-Hastings
and Gibbs sampling methods. An important aspect of all our
calculations is a proper estimation of errors. Here we will also
discuss famous resampling techniques like the blocking, bootstrapping
and jackknife methods.
discuss famous resampling techniques like the blocking, the bootstrapping
and the jackknife methods and the infamous bias-variance tradeoff.
The second part of the material covers several algorithms used in
machine learning.
@@ -150,8 +160,12 @@ desired output of a system. Some of the most common tasks are:
The methods we cover have three main topics in common, irrespective of
whether we deal with supervised or unsupervised learning. The first
ingredient is normally our data set (which can be subdivided into
training and test data), the second item is a model which is normally a
function of some parameters. The model reflects our knowledge of the system (or lack thereof). As an example, if we know that our data show a behavior similar to what would be predicted by a polynomial, fitting our data to a polynomial of some degree would then determin our model.
training and test data), the second item is a model which is normally
a function of some parameters. The model reflects our knowledge of
the system (or lack thereof). As an example, if we know that our data
show a behavior similar to what would be predicted by a polynomial,
fitting our data to a polynomial of some degree would then determin
our model.
The last ingredient is a so-called _cost_
function which allows us to present an estimate on how good our model
@@ -162,12 +176,11 @@ statistical foundation discussed above, with elements from data
analysis, stochastic processes etc. We will discuss the following
machine learning algorithms
o Linear regression and its variants, in essence polynomial regression
o Decision tree algorithms, from simpler to more complex ones
o Nearest neighbors models
o Linear regression and its variants
o Decision tree algorithms, from single trees to random forests
o Bayesian statistics and regression
o Support vector machines and finally various variants of
o Artifical neural networks and deep learning
o Artifical neural networks and deep learning, including convolutional neural networks and Bayesian neural networks
o Networks for unsupervised learning using for example reduced Boltzmann machines.
@@ -176,21 +189,16 @@ o Networks for unsupervised learning using for example reduced Boltzmann machine
Python plays nowadays a central role in the development of machine
learning techniques and tools for data analysis. In particular, seen
the wealth of machine learning and data analysis packages written in
the wealth of machine learning and data analysis libraries written in
Python, easy to use libraries with immediate visualization(and not the
least impressive galleries of existing example), the popularity of the
least impressive galleries of existing examples), the popularity of the
Jupyter notebook framework with the possibility to run _R_ codes or
compiled programs written in C++, and much more made our choice of
programming language for this series of lectures of easy. However,
since the focus here is not only on using existing Python tools such
as _scikit-learn_ or _tensorflow_, but also on developing your own
programming language for this series of lectures easy. However,
since the focus here is not only on using existing Python libraries such
as _Scikit-Learn_ or _Tensorflow_, but also on developing your own
algorithms and codes, we will as far as possible present many of these
algorithms eithers a Python codes or C++ codes. Finally, we will, as
far as possible keep parallel versions of the data analysis and
machine larning programming aspects in _R_ as
well. "R":"https://www.r-project.org/" is a language and environment
for statistical computing and graphics which is widely used in
statistics and mathematics applications.
algorithms either as a Python codes or C++ or Fortran (or other languages) codes.
The reason we also focus on compiled languages like C++ (or
Fortran), is that Python is still notoriously slow when we do not
@@ -198,7 +206,7 @@ utilize highly streamlined computational libraries like
"Lapack":"http://www.netlib.org/lapack/" or other numerical libraries
written in compiled languages (many of these libraries are written in
Fortran). Although a project like "Numba":"https://numba.pydata.org/"
holds great promise for speeding up the unrolling of lengthy loops, C+
holds great promise for speeding up the unrolling of lengthy loops, C++
and Fortran are presently still the performance winners. Numba gives
you potentially the power to speed up your applications with high
performance functions written directly in Python. In particular,
@@ -219,14 +227,14 @@ existing data files or provide code examples which produce the data to
be analyzed. Most of the applications we will discuss deal with
small data sets (less than a terabyte of information) and can easily
be analyzed and tested on standard off the shelf laptops you find in general
grocery stores.
stores.
===== Data handling, machine learning and ethical aspects =====
In most of the cases we will study, we will either generate the data
to analyze ourselves (both for supervised learning and unsupervised
learning) or we will recur again and again to data present in say
_scikit-learn_ or _tensorflow_. Many of the examples we end up
_Scikit-Learn_ or _Tensorflow_. Many of the examples we end up
dealing with are from a privacy and data protection point of view,
rather inoccuous and boring results of numerical
calculations. However, this does not hinder us from developing a sound
@@ -241,7 +249,7 @@ repositories like "Github":"https://github.com/",
and data sets we have used, freely and easily accessible to a wider
community. This helps us almost automagically in making our science
reproducible. The large open-source development communities involved
in say "Scikit-learn":"http://scikit-learn.org/stable/",
in say "Scikit-Learn":"http://scikit-learn.org/stable/",
"Tensorflow":"https://www.tensorflow.org/",
"PyTorch":"http://pytorch.org/" and "Keras":"https://keras.io/", are
all excellent examples of this. The codes can be tested and improved
@@ -250,23 +258,23 @@ developing data analysis and machine learning tools. It is much
easier today to gain traction and acceptance for making your science
reproducible. From a societal stand, this is an important element
since many of the developers are employees of large public institutions like
universities and research labs. Our taxpayer do deserve to get
universities and research labs. Our fellow taxpayers do deserve to get
something back for their bucks.
However, this more mechanical aspect of the ethics of science (in
particular the reproducibility of scientific results) is something
which is obvious and everybody should do as part of the dialectics of
which is obvious and everybody should do so as part of the dialectics of
science. The fact that many scientists are not willing to share their codes or
data is detrimental to the scientific discourse.
Before we proceed, we should add a disclaimer. Even though
we may dream of computers developing some kind of higher learning
capabilities, at the end (even if the artificial intelligence
community keeps touting our ears full of fancy futuristic avenues), it is we
community keeps touting our ears full of fancy futuristic avenues), it is we, yes you reading these lines,
who end up constructing and instructing, via various algorithms, the
computers. Self-driving cars for example, rely on sofisticated
machine learning approaches. Self-driving cars for example, rely on sofisticated
programs which take into account all possible situations a car can
encounter. In addition, extensive usage of training datas from GPS
encounter. In addition, extensive usage of training data from GPS
information, maps etc, are typically fed into the software for
self-driving cars. Adding to this various sensors and cameras that
feed information to the programs, there are zillions of ethical issues
@@ -276,8 +284,8 @@ For self-driving cars, where basically many of the standard machine
learning algorithms discussed here enter into the codes, at a certain
stage we have to make choices. Yes, we , the lads and lasses who wrote
a program for a specific brand of a self-driving car. As an example,
a most carmakers have as their utmost priority the security of the
driver and the accompanying passengers. A famous carmaker, which is
all carmakers have as their utmost priority the security of the
driver and the accompanying passengers. A famous European carmaker, which is
one of the leaders in the market of self-driving cars, had _if_
statements of the following type: suppose there are two obstacles in
front of you and you cannot avoid to collide with one of them. One of
@@ -287,9 +295,9 @@ opt for the hitting the small folks instead of the monstertruck, since
the likelihood of surving a collision with our future citizens, is
much higher.
This brings us leads then to serious ethical aspects. Why should we
This leads to serious ethical aspects. Why should we
opt for such an option? Who decides and who is entitled to make such
choices? Keep in mind that many of the algorithms you will about in
choices? Keep in mind that many of the algorithms you will encounter in
this series of lectures or hear about later, are indeed based on
simple programming instructions. And you are very likely to be one of
the people who may end up writing such a code. Thus, developing a
@@ -301,15 +309,16 @@ you analyze data on economic inequalities, who guarantees that you are
not weighting some data in a particular way, perhaps because you dearly want a
specific conclusion which may support your political views?
We do not have the answers here, but we want you think over these
topics in a more overarching way. A statistical data analysis with
its dry numbers and graphs meant to guide the eye, do not necessarily
We do not have the answers here, nor will we venture into a deeper
discussions of these aspects, but we want you think over these topics
in a more overarching way. A statistical data analysis with its dry
numbers and graphs meant to guide the eye, does not necessarily
reflect the truth, whatever that is. As a scientist, and after a
university education, you are supposedly a better citizen, with an
improved critical view and understanding of the scientific method, and
perhaps some deeper understandings of the ethics of science at
perhaps some deeper understanding of the ethics of science at
large. Use these insights. Be a critical citizen. You owe it to our
societies.
society.