decision tree not added properly
This commit is contained in:
+83
-986
File diff suppressed because it is too large
Load Diff
+62
-885
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
+56
-904
File diff suppressed because it is too large
Load Diff
+36
-969
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,101 @@
|
||||
aardvark,1,0,0,1,0,0,1,1,1,1,0,0,4,0,0,1,1
|
||||
antelope,1,0,0,1,0,0,0,1,1,1,0,0,4,1,0,1,1
|
||||
bass,0,0,1,0,0,1,1,1,1,0,0,1,0,1,0,0,4
|
||||
bear,1,0,0,1,0,0,1,1,1,1,0,0,4,0,0,1,1
|
||||
boar,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
buffalo,1,0,0,1,0,0,0,1,1,1,0,0,4,1,0,1,1
|
||||
calf,1,0,0,1,0,0,0,1,1,1,0,0,4,1,1,1,1
|
||||
carp,0,0,1,0,0,1,0,1,1,0,0,1,0,1,1,0,4
|
||||
catfish,0,0,1,0,0,1,1,1,1,0,0,1,0,1,0,0,4
|
||||
cavy,1,0,0,1,0,0,0,1,1,1,0,0,4,0,1,0,1
|
||||
cheetah,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
chicken,0,1,1,0,1,0,0,0,1,1,0,0,2,1,1,0,2
|
||||
chub,0,0,1,0,0,1,1,1,1,0,0,1,0,1,0,0,4
|
||||
clam,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,7
|
||||
crab,0,0,1,0,0,1,1,0,0,0,0,0,4,0,0,0,7
|
||||
crayfish,0,0,1,0,0,1,1,0,0,0,0,0,6,0,0,0,7
|
||||
crow,0,1,1,0,1,0,1,0,1,1,0,0,2,1,0,0,2
|
||||
deer,1,0,0,1,0,0,0,1,1,1,0,0,4,1,0,1,1
|
||||
dogfish,0,0,1,0,0,1,1,1,1,0,0,1,0,1,0,1,4
|
||||
dolphin,0,0,0,1,0,1,1,1,1,1,0,1,0,1,0,1,1
|
||||
dove,0,1,1,0,1,0,0,0,1,1,0,0,2,1,1,0,2
|
||||
duck,0,1,1,0,1,1,0,0,1,1,0,0,2,1,0,0,2
|
||||
elephant,1,0,0,1,0,0,0,1,1,1,0,0,4,1,0,1,1
|
||||
flamingo,0,1,1,0,1,0,0,0,1,1,0,0,2,1,0,1,2
|
||||
flea,0,0,1,0,0,0,0,0,0,1,0,0,6,0,0,0,6
|
||||
frog,0,0,1,0,0,1,1,1,1,1,0,0,4,0,0,0,5
|
||||
frog,0,0,1,0,0,1,1,1,1,1,1,0,4,0,0,0,5
|
||||
fruitbat,1,0,0,1,1,0,0,1,1,1,0,0,2,1,0,0,1
|
||||
giraffe,1,0,0,1,0,0,0,1,1,1,0,0,4,1,0,1,1
|
||||
girl,1,0,0,1,0,0,1,1,1,1,0,0,2,0,1,1,1
|
||||
gnat,0,0,1,0,1,0,0,0,0,1,0,0,6,0,0,0,6
|
||||
goat,1,0,0,1,0,0,0,1,1,1,0,0,4,1,1,1,1
|
||||
gorilla,1,0,0,1,0,0,0,1,1,1,0,0,2,0,0,1,1
|
||||
gull,0,1,1,0,1,1,1,0,1,1,0,0,2,1,0,0,2
|
||||
haddock,0,0,1,0,0,1,0,1,1,0,0,1,0,1,0,0,4
|
||||
hamster,1,0,0,1,0,0,0,1,1,1,0,0,4,1,1,0,1
|
||||
hare,1,0,0,1,0,0,0,1,1,1,0,0,4,1,0,0,1
|
||||
hawk,0,1,1,0,1,0,1,0,1,1,0,0,2,1,0,0,2
|
||||
herring,0,0,1,0,0,1,1,1,1,0,0,1,0,1,0,0,4
|
||||
honeybee,1,0,1,0,1,0,0,0,0,1,1,0,6,0,1,0,6
|
||||
housefly,1,0,1,0,1,0,0,0,0,1,0,0,6,0,0,0,6
|
||||
kiwi,0,1,1,0,0,0,1,0,1,1,0,0,2,1,0,0,2
|
||||
ladybird,0,0,1,0,1,0,1,0,0,1,0,0,6,0,0,0,6
|
||||
lark,0,1,1,0,1,0,0,0,1,1,0,0,2,1,0,0,2
|
||||
leopard,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
lion,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
lobster,0,0,1,0,0,1,1,0,0,0,0,0,6,0,0,0,7
|
||||
lynx,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
mink,1,0,0,1,0,1,1,1,1,1,0,0,4,1,0,1,1
|
||||
mole,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,0,1
|
||||
mongoose,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
moth,1,0,1,0,1,0,0,0,0,1,0,0,6,0,0,0,6
|
||||
newt,0,0,1,0,0,1,1,1,1,1,0,0,4,1,0,0,5
|
||||
octopus,0,0,1,0,0,1,1,0,0,0,0,0,8,0,0,1,7
|
||||
opossum,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,0,1
|
||||
oryx,1,0,0,1,0,0,0,1,1,1,0,0,4,1,0,1,1
|
||||
ostrich,0,1,1,0,0,0,0,0,1,1,0,0,2,1,0,1,2
|
||||
parakeet,0,1,1,0,1,0,0,0,1,1,0,0,2,1,1,0,2
|
||||
penguin,0,1,1,0,0,1,1,0,1,1,0,0,2,1,0,1,2
|
||||
pheasant,0,1,1,0,1,0,0,0,1,1,0,0,2,1,0,0,2
|
||||
pike,0,0,1,0,0,1,1,1,1,0,0,1,0,1,0,1,4
|
||||
piranha,0,0,1,0,0,1,1,1,1,0,0,1,0,1,0,0,4
|
||||
pitviper,0,0,1,0,0,0,1,1,1,1,1,0,0,1,0,0,3
|
||||
platypus,1,0,1,1,0,1,1,0,1,1,0,0,4,1,0,1,1
|
||||
polecat,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
pony,1,0,0,1,0,0,0,1,1,1,0,0,4,1,1,1,1
|
||||
porpoise,0,0,0,1,0,1,1,1,1,1,0,1,0,1,0,1,1
|
||||
puma,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
pussycat,1,0,0,1,0,0,1,1,1,1,0,0,4,1,1,1,1
|
||||
raccoon,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
reindeer,1,0,0,1,0,0,0,1,1,1,0,0,4,1,1,1,1
|
||||
rhea,0,1,1,0,0,0,1,0,1,1,0,0,2,1,0,1,2
|
||||
scorpion,0,0,0,0,0,0,1,0,0,1,1,0,8,1,0,0,7
|
||||
seahorse,0,0,1,0,0,1,0,1,1,0,0,1,0,1,0,0,4
|
||||
seal,1,0,0,1,0,1,1,1,1,1,0,1,0,0,0,1,1
|
||||
sealion,1,0,0,1,0,1,1,1,1,1,0,1,2,1,0,1,1
|
||||
seasnake,0,0,0,0,0,1,1,1,1,0,1,0,0,1,0,0,3
|
||||
seawasp,0,0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,7
|
||||
skimmer,0,1,1,0,1,1,1,0,1,1,0,0,2,1,0,0,2
|
||||
skua,0,1,1,0,1,1,1,0,1,1,0,0,2,1,0,0,2
|
||||
slowworm,0,0,1,0,0,0,1,1,1,1,0,0,0,1,0,0,3
|
||||
slug,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,7
|
||||
sole,0,0,1,0,0,1,0,1,1,0,0,1,0,1,0,0,4
|
||||
sparrow,0,1,1,0,1,0,0,0,1,1,0,0,2,1,0,0,2
|
||||
squirrel,1,0,0,1,0,0,0,1,1,1,0,0,2,1,0,0,1
|
||||
starfish,0,0,1,0,0,1,1,0,0,0,0,0,5,0,0,0,7
|
||||
stingray,0,0,1,0,0,1,1,1,1,0,1,1,0,1,0,1,4
|
||||
swan,0,1,1,0,1,1,0,0,1,1,0,0,2,1,0,1,2
|
||||
termite,0,0,1,0,0,0,0,0,0,1,0,0,6,0,0,0,6
|
||||
toad,0,0,1,0,0,1,0,1,1,1,0,0,4,0,0,0,5
|
||||
tortoise,0,0,1,0,0,0,0,0,1,1,0,0,4,1,0,1,3
|
||||
tuatara,0,0,1,0,0,0,1,1,1,1,0,0,4,1,0,0,3
|
||||
tuna,0,0,1,0,0,1,1,1,1,0,0,1,0,1,0,1,4
|
||||
vampire,1,0,0,1,1,0,0,1,1,1,0,0,2,1,0,0,1
|
||||
vole,1,0,0,1,0,0,0,1,1,1,0,0,4,1,0,0,1
|
||||
vulture,0,1,1,0,1,0,1,0,1,1,0,0,2,1,0,1,2
|
||||
wallaby,1,0,0,1,0,0,0,1,1,1,0,0,2,1,0,1,1
|
||||
wasp,1,0,1,0,1,0,0,0,0,1,1,0,6,0,0,0,6
|
||||
wolf,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
worm,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,7
|
||||
wren,0,1,1,0,1,0,0,0,1,1,0,0,2,1,0,0,2
|
||||
|
@@ -0,0 +1,29 @@
|
||||
@mixin vertical-gradient( $top, $bottom ) {
|
||||
background: $top;
|
||||
background: -moz-linear-gradient( top, $top 0%, $bottom 100% );
|
||||
background: -webkit-gradient( linear, left top, left bottom, color-stop(0%,$top), color-stop(100%,$bottom) );
|
||||
background: -webkit-linear-gradient( top, $top 0%, $bottom 100% );
|
||||
background: -o-linear-gradient( top, $top 0%, $bottom 100% );
|
||||
background: -ms-linear-gradient( top, $top 0%, $bottom 100% );
|
||||
background: linear-gradient( top, $top 0%, $bottom 100% );
|
||||
}
|
||||
|
||||
@mixin horizontal-gradient( $top, $bottom ) {
|
||||
background: $top;
|
||||
background: -moz-linear-gradient( left, $top 0%, $bottom 100% );
|
||||
background: -webkit-gradient( linear, left top, right top, color-stop(0%,$top), color-stop(100%,$bottom) );
|
||||
background: -webkit-linear-gradient( left, $top 0%, $bottom 100% );
|
||||
background: -o-linear-gradient( left, $top 0%, $bottom 100% );
|
||||
background: -ms-linear-gradient( left, $top 0%, $bottom 100% );
|
||||
background: linear-gradient( left, $top 0%, $bottom 100% );
|
||||
}
|
||||
|
||||
@mixin radial-gradient( $outer, $inner, $type: circle ) {
|
||||
background: $outer;
|
||||
background: -moz-radial-gradient( center, $type cover, $inner 0%, $outer 100% );
|
||||
background: -webkit-gradient( radial, center center, 0px, center center, 100%, color-stop(0%,$inner), color-stop(100%,$outer) );
|
||||
background: -webkit-radial-gradient( center, $type cover, $inner 0%, $outer 100% );
|
||||
background: -o-radial-gradient( center, $type cover, $inner 0%, $outer 100% );
|
||||
background: -ms-radial-gradient( center, $type cover, $inner 0%, $outer 100% );
|
||||
background: radial-gradient( center, $type cover, $inner 0%, $outer 100% );
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// Base settings for all themes that can optionally be
|
||||
// overridden by the super-theme
|
||||
|
||||
// Background of the presentation
|
||||
$backgroundColor: #2b2b2b;
|
||||
|
||||
// Primary/body text
|
||||
$mainFont: 'Lato', sans-serif;
|
||||
$mainFontSize: 30px; /* changed (by hpl) from 36px; */
|
||||
$mainColor: #eee;
|
||||
|
||||
// Headings
|
||||
$headingMargin: 0 0 20px 0;
|
||||
$headingFont: 'League Gothic', Impact, sans-serif;
|
||||
$headingColor: #eee;
|
||||
$headingLineHeight: 0.9em;
|
||||
$headingLetterSpacing: 0.02em;
|
||||
$headingTextTransform: none; /* changed (by hpl) from uppercase; */
|
||||
$headingTextShadow: 0px 0px 6px rgba(0,0,0,0.2);
|
||||
$heading1TextShadow: $headingTextShadow;
|
||||
|
||||
// Links and actions
|
||||
$linkColor: #13DAEC;
|
||||
$linkColorHover: lighten( $linkColor, 20% );
|
||||
|
||||
// Text selection
|
||||
$selectionBackgroundColor: #FF5E99;
|
||||
$selectionColor: #fff;
|
||||
|
||||
// Generates the presentation background, can be overridden
|
||||
// to return a background image or gradient
|
||||
@mixin bodyBackground() {
|
||||
background: $backgroundColor;
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
// Base theme template for reveal.js
|
||||
|
||||
/*********************************************
|
||||
* GLOBAL STYLES
|
||||
*********************************************/
|
||||
|
||||
body {
|
||||
@include bodyBackground();
|
||||
background-color: $backgroundColor;
|
||||
}
|
||||
|
||||
.reveal {
|
||||
font-family: $mainFont;
|
||||
font-size: $mainFontSize;
|
||||
font-weight: normal;
|
||||
letter-spacing: -0.02em;
|
||||
color: $mainColor;
|
||||
}
|
||||
|
||||
::selection {
|
||||
color: $selectionColor;
|
||||
background: $selectionBackgroundColor;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
/*********************************************
|
||||
* HEADERS
|
||||
*********************************************/
|
||||
|
||||
.reveal h1,
|
||||
.reveal h2,
|
||||
.reveal h3,
|
||||
.reveal h4,
|
||||
.reveal h5,
|
||||
.reveal h6 {
|
||||
margin: $headingMargin;
|
||||
color: $headingColor;
|
||||
|
||||
font-family: $headingFont;
|
||||
line-height: $headingLineHeight;
|
||||
letter-spacing: $headingLetterSpacing;
|
||||
|
||||
text-transform: $headingTextTransform;
|
||||
text-shadow: $headingTextShadow;
|
||||
}
|
||||
|
||||
.reveal h1 {
|
||||
line-height: 1.2em; /* added by hpl */
|
||||
text-shadow: $heading1TextShadow;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************
|
||||
* LINKS
|
||||
*********************************************/
|
||||
|
||||
.reveal a:not(.image) {
|
||||
color: $linkColor;
|
||||
text-decoration: none;
|
||||
|
||||
-webkit-transition: color .15s ease;
|
||||
-moz-transition: color .15s ease;
|
||||
-ms-transition: color .15s ease;
|
||||
-o-transition: color .15s ease;
|
||||
transition: color .15s ease;
|
||||
}
|
||||
.reveal a:not(.image):hover {
|
||||
color: $linkColorHover;
|
||||
|
||||
text-shadow: none;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.reveal .roll span:after {
|
||||
color: #fff;
|
||||
background: darken( $linkColor, 15% );
|
||||
}
|
||||
|
||||
|
||||
/*********************************************
|
||||
* IMAGES
|
||||
*********************************************/
|
||||
|
||||
.reveal section img {
|
||||
margin: 15px 0px;
|
||||
background: rgba(255,255,255,0.12);
|
||||
border: 4px solid $mainColor;
|
||||
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
|
||||
|
||||
-webkit-transition: all .2s linear;
|
||||
-moz-transition: all .2s linear;
|
||||
-ms-transition: all .2s linear;
|
||||
-o-transition: all .2s linear;
|
||||
transition: all .2s linear;
|
||||
}
|
||||
|
||||
.reveal a:hover img {
|
||||
background: rgba(255,255,255,0.2);
|
||||
border-color: $linkColor;
|
||||
|
||||
box-shadow: 0 0 20px rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
|
||||
/*********************************************
|
||||
* NAVIGATION CONTROLS
|
||||
*********************************************/
|
||||
|
||||
.reveal .controls div.navigate-left,
|
||||
.reveal .controls div.navigate-left.enabled {
|
||||
border-right-color: $linkColor;
|
||||
}
|
||||
|
||||
.reveal .controls div.navigate-right,
|
||||
.reveal .controls div.navigate-right.enabled {
|
||||
border-left-color: $linkColor;
|
||||
}
|
||||
|
||||
.reveal .controls div.navigate-up,
|
||||
.reveal .controls div.navigate-up.enabled {
|
||||
border-bottom-color: $linkColor;
|
||||
}
|
||||
|
||||
.reveal .controls div.navigate-down,
|
||||
.reveal .controls div.navigate-down.enabled {
|
||||
border-top-color: $linkColor;
|
||||
}
|
||||
|
||||
.reveal .controls div.navigate-left.enabled:hover {
|
||||
border-right-color: $linkColorHover;
|
||||
}
|
||||
|
||||
.reveal .controls div.navigate-right.enabled:hover {
|
||||
border-left-color: $linkColorHover;
|
||||
}
|
||||
|
||||
.reveal .controls div.navigate-up.enabled:hover {
|
||||
border-bottom-color: $linkColorHover;
|
||||
}
|
||||
|
||||
.reveal .controls div.navigate-down.enabled:hover {
|
||||
border-top-color: $linkColorHover;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************
|
||||
* PROGRESS BAR
|
||||
*********************************************/
|
||||
|
||||
.reveal .progress {
|
||||
background: rgba(0,0,0,0.2);
|
||||
}
|
||||
.reveal .progress span {
|
||||
background: $linkColor;
|
||||
|
||||
-webkit-transition: width 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
|
||||
-moz-transition: width 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
|
||||
-ms-transition: width 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
|
||||
-o-transition: width 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
|
||||
transition: width 800ms cubic-bezier(0.260, 0.860, 0.440, 0.985);
|
||||
}
|
||||
|
||||
/*********************************************
|
||||
* SLIDE NUMBER
|
||||
*********************************************/
|
||||
.reveal .slide-number {
|
||||
color: $linkColor;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,410 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<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">
|
||||
|
||||
<link rel="stylesheet" href="css/reveal.css">
|
||||
<link rel="stylesheet" href="css/theme/black.css" id="theme">
|
||||
|
||||
<!-- Theme used for syntax highlighting of code -->
|
||||
<link rel="stylesheet" href="lib/css/zenburn.css">
|
||||
|
||||
<!-- Printing and PDF exports -->
|
||||
<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>
|
||||
|
||||
<!--[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>
|
||||
<h1>Reveal.js</h1>
|
||||
<h3>The HTML Presentation Framework</h3>
|
||||
<p>
|
||||
<small>Created by <a href="http://hakim.se">Hakim El Hattab</a> and <a href="https://github.com/hakimel/reveal.js/graphs/contributors">contributors</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="https://slides.com" target="_blank">https://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 fade-up">fade-up (also down, left and right!)</p>
|
||||
<p class="fragment current-visible">current-visible</p>
|
||||
<p>Highlight <span class="fragment highlight-red">red</span> <span class="fragment highlight-blue">blue</span> <span class="fragment highlight-green">green</span></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 class="hljs"><section data-background="image.png"></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 class="hljs" style="word-wrap: break-word;"><section data-background="image.png" data-background-repeat="repeat" data-background-size="100px"></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 class="hljs" style="word-wrap: break-word;"><section data-background-video="video.mp4,video.webm"></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 class="hljs">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 class="hljs" style="word-wrap: break-word;"><section data-background-transition="zoom"></code></pre>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Pretty Code</h2>
|
||||
<pre><code class="hljs" data-trim contenteditable>
|
||||
function linkify( selector ) {
|
||||
if( supports3DTransforms ) {
|
||||
|
||||
var nodes = document.querySelectorAll( selector );
|
||||
|
||||
for( var i = 0, len = nodes.length; i < 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">The nice thing about standards is that there are so many to choose from</q> and block:
|
||||
</p>
|
||||
<blockquote cite="http://searchservervirtualization.techtarget.com/definition/Our-Favorite-Technology-Quotations">
|
||||
“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.”
|
||||
</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 data-src="https://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="https://slides.com">Try the online editor</a> <br>
|
||||
- <a href="https://github.com/hakimel/reveal.js">Source code & documentation</a>
|
||||
</p>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="lib/js/head.min.js"></script>
|
||||
<script src="js/reveal.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
// More info 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
|
||||
|
||||
// More info https://github.com/hakimel/reveal.js#dependencies
|
||||
dependencies: [
|
||||
{ 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, callback: function() { hljs.initHighlightingOnLoad(); } },
|
||||
{ src: 'plugin/search/search.js', async: true },
|
||||
{ src: 'plugin/zoom-js/zoom.js', async: true },
|
||||
{ src: 'plugin/notes/notes.js', async: true }
|
||||
]
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "reveal-js-multiplex",
|
||||
"version": "1.0.0",
|
||||
"description": "reveal.js multiplex server",
|
||||
"homepage": "http://revealjs.com",
|
||||
"scripts": {
|
||||
"start": "node index.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": "~4.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "~4.13.3",
|
||||
"grunt-cli": "~0.1.13",
|
||||
"mustache": "~2.2.1",
|
||||
"socket.io": "~1.3.7"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
## Slide 1.1
|
||||
|
||||
```js
|
||||
var a = 1;
|
||||
```
|
||||
|
||||
|
||||
## Slide 1.2
|
||||
|
||||
|
||||
|
||||
## Slide 2
|
||||
@@ -0,0 +1,36 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>reveal.js - Test Markdown</title>
|
||||
|
||||
<link rel="stylesheet" href="../css/reveal.css">
|
||||
<link rel="stylesheet" href="qunit-1.12.0.css">
|
||||
</head>
|
||||
|
||||
<body style="overflow: auto;">
|
||||
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
|
||||
<div class="reveal" style="display: none;">
|
||||
|
||||
<div class="slides">
|
||||
<section data-markdown="simple.md" data-separator="^\n\n\n" data-separator-vertical="^\n\n"></section>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="../lib/js/head.min.js"></script>
|
||||
<script src="../js/reveal.js"></script>
|
||||
<script src="../plugin/highlight/highlight.js"></script>
|
||||
<script src="../plugin/markdown/marked.js"></script>
|
||||
<script src="../plugin/markdown/markdown.js"></script>
|
||||
<script src="qunit-1.12.0.js"></script>
|
||||
|
||||
<script src="test-markdown-external.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
Reveal.addEventListener( 'ready', function() {
|
||||
|
||||
QUnit.module( 'Markdown' );
|
||||
|
||||
test( 'Vertical separator', function() {
|
||||
strictEqual( document.querySelectorAll( '.reveal .slides>section>section' ).length, 2, 'found two slides' );
|
||||
});
|
||||
|
||||
test( 'Horizontal separator', function() {
|
||||
strictEqual( document.querySelectorAll( '.reveal .slides>section' ).length, 2, 'found two slides' );
|
||||
});
|
||||
|
||||
test( 'Language highlighter', function() {
|
||||
strictEqual( document.querySelectorAll( '.hljs-keyword' ).length, 1, 'got rendered highlight tag.' );
|
||||
strictEqual( document.querySelector( '.hljs-keyword' ).innerHTML, 'var', 'the same keyword: var.' );
|
||||
});
|
||||
|
||||
|
||||
} );
|
||||
|
||||
Reveal.initialize();
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>reveal.js - Test Markdown Options</title>
|
||||
|
||||
<link rel="stylesheet" href="../css/reveal.css">
|
||||
<link rel="stylesheet" href="qunit-1.12.0.css">
|
||||
</head>
|
||||
|
||||
<body style="overflow: auto;">
|
||||
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
|
||||
<div class="reveal" style="display: none;">
|
||||
|
||||
<div class="slides">
|
||||
|
||||
<section data-markdown>
|
||||
<script type="text/template">
|
||||
## Testing Markdown Options
|
||||
|
||||
This "slide" should contain 'smart' quotes.
|
||||
</script>
|
||||
</section>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="../lib/js/head.min.js"></script>
|
||||
<script src="../js/reveal.js"></script>
|
||||
<script src="qunit-1.12.0.js"></script>
|
||||
|
||||
<script src="test-markdown-options.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,26 @@
|
||||
Reveal.addEventListener( 'ready', function() {
|
||||
|
||||
QUnit.module( 'Markdown' );
|
||||
|
||||
test( 'Options are set', function() {
|
||||
strictEqual( marked.defaults.smartypants, true );
|
||||
});
|
||||
|
||||
test( 'Smart quotes are activated', function() {
|
||||
var text = document.querySelector( '.reveal .slides>section>p' ).textContent;
|
||||
|
||||
strictEqual( /['"]/.test( text ), false );
|
||||
strictEqual( /[“”‘’]/.test( text ), true );
|
||||
});
|
||||
|
||||
} );
|
||||
|
||||
Reveal.initialize({
|
||||
dependencies: [
|
||||
{ src: '../plugin/markdown/marked.js' },
|
||||
{ src: '../plugin/markdown/markdown.js' },
|
||||
],
|
||||
markdown: {
|
||||
smartypants: true
|
||||
}
|
||||
});
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,101 @@
|
||||
aardvark,1,0,0,1,0,0,1,1,1,1,0,0,4,0,0,1,1
|
||||
antelope,1,0,0,1,0,0,0,1,1,1,0,0,4,1,0,1,1
|
||||
bass,0,0,1,0,0,1,1,1,1,0,0,1,0,1,0,0,4
|
||||
bear,1,0,0,1,0,0,1,1,1,1,0,0,4,0,0,1,1
|
||||
boar,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
buffalo,1,0,0,1,0,0,0,1,1,1,0,0,4,1,0,1,1
|
||||
calf,1,0,0,1,0,0,0,1,1,1,0,0,4,1,1,1,1
|
||||
carp,0,0,1,0,0,1,0,1,1,0,0,1,0,1,1,0,4
|
||||
catfish,0,0,1,0,0,1,1,1,1,0,0,1,0,1,0,0,4
|
||||
cavy,1,0,0,1,0,0,0,1,1,1,0,0,4,0,1,0,1
|
||||
cheetah,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
chicken,0,1,1,0,1,0,0,0,1,1,0,0,2,1,1,0,2
|
||||
chub,0,0,1,0,0,1,1,1,1,0,0,1,0,1,0,0,4
|
||||
clam,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,7
|
||||
crab,0,0,1,0,0,1,1,0,0,0,0,0,4,0,0,0,7
|
||||
crayfish,0,0,1,0,0,1,1,0,0,0,0,0,6,0,0,0,7
|
||||
crow,0,1,1,0,1,0,1,0,1,1,0,0,2,1,0,0,2
|
||||
deer,1,0,0,1,0,0,0,1,1,1,0,0,4,1,0,1,1
|
||||
dogfish,0,0,1,0,0,1,1,1,1,0,0,1,0,1,0,1,4
|
||||
dolphin,0,0,0,1,0,1,1,1,1,1,0,1,0,1,0,1,1
|
||||
dove,0,1,1,0,1,0,0,0,1,1,0,0,2,1,1,0,2
|
||||
duck,0,1,1,0,1,1,0,0,1,1,0,0,2,1,0,0,2
|
||||
elephant,1,0,0,1,0,0,0,1,1,1,0,0,4,1,0,1,1
|
||||
flamingo,0,1,1,0,1,0,0,0,1,1,0,0,2,1,0,1,2
|
||||
flea,0,0,1,0,0,0,0,0,0,1,0,0,6,0,0,0,6
|
||||
frog,0,0,1,0,0,1,1,1,1,1,0,0,4,0,0,0,5
|
||||
frog,0,0,1,0,0,1,1,1,1,1,1,0,4,0,0,0,5
|
||||
fruitbat,1,0,0,1,1,0,0,1,1,1,0,0,2,1,0,0,1
|
||||
giraffe,1,0,0,1,0,0,0,1,1,1,0,0,4,1,0,1,1
|
||||
girl,1,0,0,1,0,0,1,1,1,1,0,0,2,0,1,1,1
|
||||
gnat,0,0,1,0,1,0,0,0,0,1,0,0,6,0,0,0,6
|
||||
goat,1,0,0,1,0,0,0,1,1,1,0,0,4,1,1,1,1
|
||||
gorilla,1,0,0,1,0,0,0,1,1,1,0,0,2,0,0,1,1
|
||||
gull,0,1,1,0,1,1,1,0,1,1,0,0,2,1,0,0,2
|
||||
haddock,0,0,1,0,0,1,0,1,1,0,0,1,0,1,0,0,4
|
||||
hamster,1,0,0,1,0,0,0,1,1,1,0,0,4,1,1,0,1
|
||||
hare,1,0,0,1,0,0,0,1,1,1,0,0,4,1,0,0,1
|
||||
hawk,0,1,1,0,1,0,1,0,1,1,0,0,2,1,0,0,2
|
||||
herring,0,0,1,0,0,1,1,1,1,0,0,1,0,1,0,0,4
|
||||
honeybee,1,0,1,0,1,0,0,0,0,1,1,0,6,0,1,0,6
|
||||
housefly,1,0,1,0,1,0,0,0,0,1,0,0,6,0,0,0,6
|
||||
kiwi,0,1,1,0,0,0,1,0,1,1,0,0,2,1,0,0,2
|
||||
ladybird,0,0,1,0,1,0,1,0,0,1,0,0,6,0,0,0,6
|
||||
lark,0,1,1,0,1,0,0,0,1,1,0,0,2,1,0,0,2
|
||||
leopard,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
lion,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
lobster,0,0,1,0,0,1,1,0,0,0,0,0,6,0,0,0,7
|
||||
lynx,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
mink,1,0,0,1,0,1,1,1,1,1,0,0,4,1,0,1,1
|
||||
mole,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,0,1
|
||||
mongoose,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
moth,1,0,1,0,1,0,0,0,0,1,0,0,6,0,0,0,6
|
||||
newt,0,0,1,0,0,1,1,1,1,1,0,0,4,1,0,0,5
|
||||
octopus,0,0,1,0,0,1,1,0,0,0,0,0,8,0,0,1,7
|
||||
opossum,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,0,1
|
||||
oryx,1,0,0,1,0,0,0,1,1,1,0,0,4,1,0,1,1
|
||||
ostrich,0,1,1,0,0,0,0,0,1,1,0,0,2,1,0,1,2
|
||||
parakeet,0,1,1,0,1,0,0,0,1,1,0,0,2,1,1,0,2
|
||||
penguin,0,1,1,0,0,1,1,0,1,1,0,0,2,1,0,1,2
|
||||
pheasant,0,1,1,0,1,0,0,0,1,1,0,0,2,1,0,0,2
|
||||
pike,0,0,1,0,0,1,1,1,1,0,0,1,0,1,0,1,4
|
||||
piranha,0,0,1,0,0,1,1,1,1,0,0,1,0,1,0,0,4
|
||||
pitviper,0,0,1,0,0,0,1,1,1,1,1,0,0,1,0,0,3
|
||||
platypus,1,0,1,1,0,1,1,0,1,1,0,0,4,1,0,1,1
|
||||
polecat,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
pony,1,0,0,1,0,0,0,1,1,1,0,0,4,1,1,1,1
|
||||
porpoise,0,0,0,1,0,1,1,1,1,1,0,1,0,1,0,1,1
|
||||
puma,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
pussycat,1,0,0,1,0,0,1,1,1,1,0,0,4,1,1,1,1
|
||||
raccoon,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
reindeer,1,0,0,1,0,0,0,1,1,1,0,0,4,1,1,1,1
|
||||
rhea,0,1,1,0,0,0,1,0,1,1,0,0,2,1,0,1,2
|
||||
scorpion,0,0,0,0,0,0,1,0,0,1,1,0,8,1,0,0,7
|
||||
seahorse,0,0,1,0,0,1,0,1,1,0,0,1,0,1,0,0,4
|
||||
seal,1,0,0,1,0,1,1,1,1,1,0,1,0,0,0,1,1
|
||||
sealion,1,0,0,1,0,1,1,1,1,1,0,1,2,1,0,1,1
|
||||
seasnake,0,0,0,0,0,1,1,1,1,0,1,0,0,1,0,0,3
|
||||
seawasp,0,0,1,0,0,1,1,0,0,0,1,0,0,0,0,0,7
|
||||
skimmer,0,1,1,0,1,1,1,0,1,1,0,0,2,1,0,0,2
|
||||
skua,0,1,1,0,1,1,1,0,1,1,0,0,2,1,0,0,2
|
||||
slowworm,0,0,1,0,0,0,1,1,1,1,0,0,0,1,0,0,3
|
||||
slug,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,7
|
||||
sole,0,0,1,0,0,1,0,1,1,0,0,1,0,1,0,0,4
|
||||
sparrow,0,1,1,0,1,0,0,0,1,1,0,0,2,1,0,0,2
|
||||
squirrel,1,0,0,1,0,0,0,1,1,1,0,0,2,1,0,0,1
|
||||
starfish,0,0,1,0,0,1,1,0,0,0,0,0,5,0,0,0,7
|
||||
stingray,0,0,1,0,0,1,1,1,1,0,1,1,0,1,0,1,4
|
||||
swan,0,1,1,0,1,1,0,0,1,1,0,0,2,1,0,1,2
|
||||
termite,0,0,1,0,0,0,0,0,0,1,0,0,6,0,0,0,6
|
||||
toad,0,0,1,0,0,1,0,1,1,1,0,0,4,0,0,0,5
|
||||
tortoise,0,0,1,0,0,0,0,0,1,1,0,0,4,1,0,1,3
|
||||
tuatara,0,0,1,0,0,0,1,1,1,1,0,0,4,1,0,0,3
|
||||
tuna,0,0,1,0,0,1,1,1,1,0,0,1,0,1,0,1,4
|
||||
vampire,1,0,0,1,1,0,0,1,1,1,0,0,2,1,0,0,1
|
||||
vole,1,0,0,1,0,0,0,1,1,1,0,0,4,1,0,0,1
|
||||
vulture,0,1,1,0,1,0,1,0,1,1,0,0,2,1,0,1,2
|
||||
wallaby,1,0,0,1,0,0,0,1,1,1,0,0,2,1,0,1,1
|
||||
wasp,1,0,1,0,1,0,0,0,0,1,1,0,6,0,0,0,6
|
||||
wolf,1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1,1
|
||||
worm,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,7
|
||||
wren,0,1,1,0,1,0,0,0,1,1,0,0,2,1,0,0,2
|
||||
|
@@ -1,139 +1,16 @@
|
||||
TITLE: Solving quantum mechanical problems with Machine Learning and Boltzmann machines
|
||||
TITLE: Machine Learning and Boltzmann machines
|
||||
AUTHOR: Morten Hjorth-Jensen {copyright, 1999-present|CC BY-NC} at Department of Physics and Astronomy and National Superconducting Cyclotron Laboratory, Michigan State University and Department of Physics, University of Oslo, Norway
|
||||
DATE: today
|
||||
|
||||
|
||||
!split
|
||||
===== What is this talk about? =====
|
||||
===== Unsupervised learning, ovrarching aims =====
|
||||
!bblock
|
||||
The main aim is to give you a short and pedestrian introduction to how we can use Machine Learning methods
|
||||
to solve quantum mechanical many-body problems. And why this could be of interest.
|
||||
|
||||
The hope is that after this talk you have gotten the basic ideas to get you started. Peeping into URL:"https://github.com/mhjensenseminars/MachineLearningTalk", you'll find a Jupyter notebook, slides, codes etc that will allow you to reproduce the simulations discussed here, and perhaps run your own very first calculations.
|
||||
|
||||
Furthermore, since we will also talk about Monte Carlo simulations, the exciting idea of Monte Carlo optimization and Machine Learning can be used to mesh strategies for reducing the curse of dimensionality.
|
||||
|
||||
!eblock
|
||||
|
||||
|
||||
!split
|
||||
===== Why? =====
|
||||
|
||||
How can we avoid the dimensionality curse? Many possibilities
|
||||
o smarter basis functions
|
||||
o resummation of specific correlations
|
||||
o stochastic sampling of high-lying states (stochastic FCI, CC and soon SRG)
|
||||
o many more
|
||||
|
||||
Machine Learning and Quantum Computing hold also great promise in tackling the
|
||||
ever increasing dimensionalities. Here we will focus on Machine Learning.
|
||||
|
||||
|
||||
!split
|
||||
===== Overview =====
|
||||
!bblock
|
||||
* Short intro to Machine Learning
|
||||
* Variational Monte Carlo (Markov Chain Monte Carlo, $\mathrm{MC}^2$) and two-electron quantum dots, solving quantum mechanical problems in a stochastic way. It will serve as our motivation for switching to Machine Learning.
|
||||
* From Variational Monte Carlo to Boltzmann Machines and Machine Learning
|
||||
!eblock
|
||||
|
||||
!split
|
||||
===== What are the Machine Learning calculations here based on? =====
|
||||
|
||||
This work is inspired by the idea of representing the wave function with
|
||||
a restricted Boltzmann machine (RBM), presented recently by "G. Carleo and M. Troyer, Science _355_, Issue 6325, pp. 602-606 (2017)":"http://science.sciencemag.org/content/355/6325/602". They
|
||||
named such a wave function/network a *neural network quantum state* (NQS). In their article they apply it to the quantum mechanical
|
||||
spin lattice systems of the Ising model and Heisenberg model, with
|
||||
encouraging results.
|
||||
|
||||
Thanks to Vilde Flugsrud and Alfred Alocias Mariadason for many discussions and interpretations of the above paper.
|
||||
|
||||
|
||||
!split
|
||||
===== A new world =====
|
||||
!bblock
|
||||
Machine learning (ML) is an extremely rich field, in spite of its young age. The
|
||||
increases we have seen during the last three decades in computational
|
||||
capabilities have been followed by developments of methods and
|
||||
techniques for analyzing and handling large date sets, relying heavily
|
||||
on statistics, computer science and mathematics. The field is rather
|
||||
new and developing rapidly.
|
||||
|
||||
Popular software packages written in Python for ML are
|
||||
|
||||
* "Scikit-learn":"http://scikit-learn.org/stable/",
|
||||
* "Tensorflow":"https://www.tensorflow.org/",
|
||||
* "PyTorch":"http://pytorch.org/" and
|
||||
* "Keras":"https://keras.io/".
|
||||
These are all freely available at their respective GitHub sites. They
|
||||
encompass communities of developers in the thousands or more. And the number
|
||||
of code developers and contributors keeps increasing.
|
||||
!eblock
|
||||
|
||||
!split
|
||||
===== Lots of room for creativity =====
|
||||
!bblock
|
||||
Not all the
|
||||
algorithms and methods can be given a rigorous mathematical
|
||||
justification, opening up thereby for experimenting
|
||||
and trial and error and thereby exciting new developments.
|
||||
!eblock
|
||||
|
||||
!bblock
|
||||
A solid command of linear algebra, multivariate theory,
|
||||
probability theory, statistical data analysis,
|
||||
understanding errors and Monte Carlo methods is important in order to understand many of the
|
||||
various algorithms and methods.
|
||||
!eblock
|
||||
|
||||
!bblock _Job market, a personal statement_
|
||||
A familiarity with ML is almost becoming a prerequisite for many of the most exciting employment
|
||||
opportunities. Add quantum computing and there you are.
|
||||
!eblock
|
||||
|
||||
!split
|
||||
===== Some members of the ML family =====
|
||||
|
||||
!bblock
|
||||
o Linear regression and its variants, in essence polynomial regression
|
||||
o Decision tree algorithms, from simpler to more complex ones like random forests
|
||||
o Nearest neighbors models
|
||||
o Bayesian statistics and regression
|
||||
o Support vector machines and finally various variants of
|
||||
o Artifical neural networks and deep learning
|
||||
o ....
|
||||
!eblock
|
||||
|
||||
!split
|
||||
===== What are the basic ingredients? =====
|
||||
!bblock
|
||||
Almost every problem in ML and data science starts with the same ingredients:
|
||||
* The dataset $\mathbf{x}$ (could be some observable quantity of the system we are studying)
|
||||
* A model which is a function of a set of parameters $\mathbf{\alpha}$ that relates to the dataset, say a likelihood function $p(\mathbf{x}\vert \mathbf{\alpha})$ or just a simple model $f(\mathbf{\alpha})$
|
||||
* A so-called _cost_ function $\mathcal{C} (\mathbf{x}, f(\mathbf{\alpha}))$ which allows us to decide how well our model represents the dataset.
|
||||
|
||||
We seek to minimize the function $\mathcal{C} (\mathbf{x}, f(\mathbf{\alpha}))$ by finding the parameter values which minimize $\mathcal{C}$. This leads to various minimization algorithms.
|
||||
!eblock
|
||||
|
||||
!split
|
||||
===== What is Machine Learning? =====
|
||||
!bblock
|
||||
Machine learning is the science of giving computers the ability to
|
||||
learn without being explicitly programmed. The idea is that there
|
||||
exist generic algorithms which can be used to find patterns in a broad
|
||||
class of data sets without having to write code specifically for each
|
||||
problem. The algorithm will build its own logic based on the data.
|
||||
|
||||
Machine learning is a subfield of computer science, and is closely
|
||||
related to computational statistics. It evolved from the study of
|
||||
pattern recognition in artificial intelligence (AI) research, and has
|
||||
made contributions to AI tasks like computer vision, natural language
|
||||
processing and speech recognition. It has also, especially in later
|
||||
years, found applications in a wide variety of other areas, including
|
||||
bioinformatics, economy, physics, finance and marketing.
|
||||
|
||||
You will notice however that many of the basic ideas discussed do come from Physics!
|
||||
!eblock
|
||||
|
||||
!split
|
||||
===== Types of Machine Learning =====
|
||||
@@ -158,531 +35,6 @@ Some of the most common tasks are:
|
||||
!eblock
|
||||
|
||||
|
||||
!split
|
||||
===== References =====
|
||||
!bblock
|
||||
* An excellent reference, "Mehta *et al.*, arXiv:1803.08823 and Physics Reports in press (2018)":"https://arxiv.org/abs/1803.08823"
|
||||
* A cute paper by "Utama and Piekarewicz, Validating neural-network refinements of nuclear mass models, Phys. Rev. C 97, 014306 ":"https://journals.aps.org/prc/abstract/10.1103/PhysRevC.97.014306"
|
||||
* "Every issue of Physical Review Letters has now one or more articles on ML":"https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.120.156001"
|
||||
* "Books and lectures notes":"https://github.com/CompPhysics/MachineLearning"
|
||||
* See also Metha and Schwab, arXiv.1410.3831, how to link Variational renormalization group theory with deep learning (recommended read)
|
||||
!eblock
|
||||
|
||||
|
||||
!split
|
||||
===== Another interesting article =====
|
||||
|
||||
Here we will use so-called _reduced Boltzmann Machines_ to simulate quantum many-body problems. For Monte Carlo aficionados, there is a very close similarity with what are called _shadow wave functions_, see the work of "Pederiva and Kalos and collaborators, Phys Rev. E 90, 053304 (2014)":"https://journals.aps.org/pre/abstract/10.1103/PhysRevE.90.053304".
|
||||
|
||||
!split
|
||||
===== Just for fun illustration of scikit-learn: Hudson bay data =====
|
||||
!bblock
|
||||
Most mammalian predators rely on a variety of prey, which complicates mathematical modeling; however, a few predators have become highly specialized and seek almost exclusively a single prey species. An example of this simplified predator-prey interaction is seen in Canadian northern forests, where the populations of the lynx and the snowshoe hare are intertwined in a life and death struggle.
|
||||
|
||||
One reason that this particular system has been so extensively studied is that the Hudson Bay company kept careful records of all furs from the early 1800s into the 1900s. The records for the furs collected by the Hudson Bay company showed distinct oscillations (approximately 12 year periods), suggesting that these species caused almost periodic fluctuations of each other's populations. The table here shows data from 1900 to 1920.
|
||||
|
||||
!eblock
|
||||
|
||||
|
||||
!split
|
||||
===== Hares and lynx in Hudson bay from 1900 to 1920 =====
|
||||
|
||||
FIGURE: [figures/Hudson_Bay_data, width=700 frac=0.9]
|
||||
|
||||
|
||||
!split
|
||||
===== Linear regression in Python =====
|
||||
!bblock
|
||||
!bc pycod
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from IPython.display import display
|
||||
import sklearn
|
||||
from sklearn.linear_model import LinearRegression
|
||||
from sklearn.tree import DecisionTreeRegressor
|
||||
|
||||
|
||||
data = np.loadtxt('src/Hudson_Bay.csv', delimiter=',', skiprows=1)
|
||||
x = data[:,0]
|
||||
y = data[:,1]
|
||||
line = np.linspace(1900,1920,1000,endpoint=False).reshape(-1,1)
|
||||
reg = DecisionTreeRegressor(min_samples_split=3).fit(x.reshape(-1,1),y.reshape(-1,1))
|
||||
plt.plot(line, reg.predict(line), label="decision tree")
|
||||
regline = LinearRegression().fit(x.reshape(-1,1),y.reshape(-1,1))
|
||||
plt.plot(line, regline.predict(line), label= "Linear Regression")
|
||||
plt.plot(x, y, label= "Linear Regression")
|
||||
plt.show()
|
||||
!ec
|
||||
!eblock
|
||||
|
||||
|
||||
|
||||
!split
|
||||
===== Artificial neurons =====
|
||||
!bblock
|
||||
|
||||
The field of artificial neural networks has a long history of
|
||||
development, and is closely connected with the advancement of computer
|
||||
science and computers in general. A model of artificial neurons was
|
||||
first developed by McCulloch and Pitts in 1943 to study signal
|
||||
processing in the brain and has later been refined by others. The
|
||||
general idea is to mimic neural networks in the human brain, which is
|
||||
composed of billions of neurons that communicate with each other by
|
||||
sending electrical signals. Each neuron accumulates its incoming
|
||||
signals, which must exceed an activation threshold to yield an
|
||||
output. If the threshold is not overcome, the neuron remains inactive,
|
||||
i.e. has zero output.
|
||||
|
||||
This behaviour has inspired a simple mathematical model for an artificial neuron.
|
||||
|
||||
!bt
|
||||
\[
|
||||
y = f\left(\sum_{i=1}^n w_ix_i\right) = f(u)
|
||||
\]
|
||||
!et
|
||||
Here, the output $y$ of the neuron is the value of its activation function, which have as input
|
||||
a weighted sum of signals $x_i, \dots ,x_n$ received by $n$ other neurons.
|
||||
!eblock
|
||||
|
||||
!split
|
||||
===== A simple perceptron model =====
|
||||
|
||||
FIGURE: [figures/perceptron.png, width=700 frac=0.9]
|
||||
|
||||
|
||||
!split
|
||||
===== Neural network types =====
|
||||
!bblock
|
||||
An artificial neural network (NN), is a computational model that consists of layers of connected neurons, or *nodes*.
|
||||
It is supposed to mimic a biological nervous system by letting each neuron interact with other neurons
|
||||
by sending signals in the form of mathematical functions between layers.
|
||||
A wide variety of different NNs have
|
||||
been developed, but most of them consist of an input layer, an output layer and eventual layers in-between, called
|
||||
*hidden layers*. All layers can contain an arbitrary number of nodes, and each connection between two nodes
|
||||
is associated with a weight variable.
|
||||
|
||||
FIGURE: [figures/dnn.png, width=500 frac=0.6]
|
||||
!eblock
|
||||
|
||||
|
||||
|
||||
!split
|
||||
===== The system: two electrons in a harmonic oscillator trap in two dimensions =====
|
||||
|
||||
The Hamiltonian of the quantum dot is given by
|
||||
!bt
|
||||
\[ \hat{H} = \hat{H}_0 + \hat{V},
|
||||
\]
|
||||
!et
|
||||
where $\hat{H}_0$ is the many-body HO Hamiltonian, and $\hat{V}$ is the
|
||||
inter-electron Coulomb interactions. In dimensionless units,
|
||||
!bt
|
||||
\[ \hat{V}= \sum_{i<j}^N \frac{1}{r_{ij}},
|
||||
\]
|
||||
!et
|
||||
with $r_{ij}=\sqrt{\mathbf{r}_i^2 - \mathbf{r}_j^2}$.
|
||||
|
||||
This leads to the separable Hamiltonian, with the relative motion part given by ($r_{ij}=r$)
|
||||
!bt
|
||||
\[
|
||||
\hat{H}_r=-\nabla^2_r + \frac{1}{4}\omega^2r^2+ \frac{1}{r},
|
||||
\]
|
||||
!et
|
||||
plus a standard Harmonic Oscillator problem for the center-of-mass motion.
|
||||
This system has analytical solutions in two and three dimensions ("M. Taut 1993 and 1994":"https://journals.aps.org/pra/abstract/10.1103/PhysRevA.48.3561").
|
||||
|
||||
!split
|
||||
===== Quantum Monte Carlo Motivation =====
|
||||
!bblock
|
||||
Given a hamiltonian $H$ and a trial wave function $\Psi_T$, the variational principle states that the expectation value of $\langle H \rangle$, defined through
|
||||
!bt
|
||||
\[
|
||||
\langle E \rangle =
|
||||
\frac{\int d\bm{R}\Psi^{\ast}_T(\bm{R})H(\bm{R})\Psi_T(\bm{R})}
|
||||
{\int d\bm{R}\Psi^{\ast}_T(\bm{R})\Psi_T(\bm{R})},
|
||||
\]
|
||||
!et
|
||||
is an upper bound to the ground state energy $E_0$ of the hamiltonian $H$, that is
|
||||
!bt
|
||||
\[
|
||||
E_0 \le \langle H \rangle .
|
||||
\]
|
||||
!et
|
||||
In general, the integrals involved in the calculation of various expectation values are multi-dimensional ones. Traditional integration methods such as the Gauss-Legendre will not be adequate for say the computation of the energy of a many-body system.
|
||||
!eblock
|
||||
|
||||
|
||||
!split
|
||||
===== Quantum Monte Carlo Motivation =====
|
||||
!bblock Basic steps
|
||||
Choose a trial wave function
|
||||
$\psi_T(\bm{R})$.
|
||||
!bt
|
||||
\[
|
||||
P(\bm{R},\bm{\alpha})= \frac{\left|\psi_T(\bm{R},\bm{\alpha})\right|^2}{\int \left|\psi_T(\bm{R},\bm{\alpha})\right|^2d\bm{R}}.
|
||||
\]
|
||||
!et
|
||||
This is our model, or likelihood/probability distribution function (PDF). It depends on some variational parameters $\bm{\alpha}$.
|
||||
The approximation to the expectation value of the Hamiltonian is now
|
||||
!bt
|
||||
\[
|
||||
\langle E[\bm{\alpha}] \rangle =
|
||||
\frac{\int d\bm{R}\Psi^{\ast}_T(\bm{R},\bm{\alpha})H(\bm{R})\Psi_T(\bm{R},\bm{\alpha})}
|
||||
{\int d\bm{R}\Psi^{\ast}_T(\bm{R},\bm{\alpha})\Psi_T(\bm{R},\bm{\alpha})}.
|
||||
\]
|
||||
!et
|
||||
!eblock
|
||||
|
||||
|
||||
!split
|
||||
===== Quantum Monte Carlo Motivation =====
|
||||
!bblock Define a new quantity
|
||||
!bt
|
||||
\[
|
||||
E_L(\bm{R},\bm{\alpha})=\frac{1}{\psi_T(\bm{R},\bm{\alpha})}H\psi_T(\bm{R},\bm{\alpha}),
|
||||
\]
|
||||
!et
|
||||
called the local energy, which, together with our trial PDF yields
|
||||
!bt
|
||||
\[
|
||||
E[\bm{\alpha}]=\int P(\bm{R})E_L(\bm{R},\bm{\alpha}) d\bm{R}\approx \frac{1}{N}\sum_{i=1}^NE_L(\bm{R_i},\bm{\alpha})
|
||||
\]
|
||||
!et
|
||||
with $N$ being the number of Monte Carlo samples.
|
||||
!eblock
|
||||
|
||||
|
||||
!split
|
||||
===== Quantum Monte Carlo =====
|
||||
!bblock
|
||||
The Algorithm for performing a variational Monte Carlo calculations runs thus as this
|
||||
|
||||
* Initialisation: Fix the number of Monte Carlo steps. Choose an initial $\bm{R}$ and variational parameters $\alpha$ and calculate $\left|\psi_T(\bm{R},\bm{\alpha})\right|^2$.
|
||||
* Initialise the energy and the variance and start the Monte Carlo calculation by looping over trials.
|
||||
* Calculate a trial position $\bm{R}_p=\bm{R}+r*step$ where $r$ is a random variable $r \in [0,1]$.
|
||||
* Metropolis algorithm to accept or reject this move $w = P(\bm{R}_p,\bm{\alpha})/P(\bm{R},\bm{\alpha})$.
|
||||
* If the step is accepted, then we set $\bm{R}=\bm{R}_p$.
|
||||
* Update averages
|
||||
* Finish and compute final averages.
|
||||
|
||||
Observe that the jumping in space is governed by the variable *step*. This is often called brute-force sampling.
|
||||
Need importance sampling to get more relevant sampling.
|
||||
!eblock
|
||||
|
||||
!split
|
||||
===== The trial wave function =====
|
||||
!bblock
|
||||
We want to perform a Variational Monte Carlo calculation of the ground state of two electrons in a quantum dot well with different oscillator energies, assuming total spin $S=0$.
|
||||
Our trial wave function has the following form
|
||||
!bt
|
||||
\begin{equation}
|
||||
\psi_{T}(\bm{r}_1,\bm{r}_2) =
|
||||
C\exp{\left(-\alpha_1\omega(r_1^2+r_2^2)/2\right)}
|
||||
\exp{\left(\frac{r_{12}}{(1+\alpha_2 r_{12})}\right)},
|
||||
label{eq:trial}
|
||||
\end{equation}
|
||||
!et
|
||||
where the $\alpha$s represent our variational parameters, two in this case.
|
||||
|
||||
Why does the trial function look like this? How did we get there? _This will be our main motivation_ for switching to
|
||||
Machine Learning.
|
||||
|
||||
!eblock
|
||||
|
||||
!split
|
||||
===== The correlation part of the wave function =====
|
||||
|
||||
To find an ansatz for the correlated part of the wave function, it is useful to rewrite the two-particle
|
||||
local energy in terms of the relative and center-of-mass motion.
|
||||
Let us denote the distance between the two electrons as
|
||||
$r_{12}$. We omit the center-of-mass motion since we are only interested in the case when
|
||||
$r_{12} \rightarrow 0$. The contribution from the center-of-mass (CoM) variable ${\bf R}_{\mathrm{CoM}}$
|
||||
gives only a finite contribution.
|
||||
We focus only on the terms that are relevant for $r_{12}$ and for three dimensions. The relevant local energy becomes then
|
||||
!bt
|
||||
\[
|
||||
\lim_{r_{12} \rightarrow 0}E_L(R)=
|
||||
\frac{1}{{\cal R}_T(r_{12})}\left(2\frac{d^2}{dr_{ij}^2}+\frac{4}{r_{ij}}\frac{d}{dr_{ij}}+
|
||||
\frac{2}{r_{ij}}-\frac{l(l+1)}{r_{ij}^2}+2E
|
||||
\right){\cal R}_T(r_{12}) = 0.
|
||||
\]
|
||||
!et
|
||||
Set $l=0$ and we have the so-called _cusp_ condition
|
||||
!bt
|
||||
\[
|
||||
\frac{d {\cal R}_T(r_{12})}{dr_{12}} = -\frac{1}{2(l+1)}
|
||||
{\cal R}_T(r_{12})\qquad r_{12}\to 0
|
||||
\]
|
||||
!et
|
||||
|
||||
!split
|
||||
===== Resulting ansatz =====
|
||||
The above results in
|
||||
!bt
|
||||
\[
|
||||
{\cal R}_T \propto \exp{(r_{ij}/2)},
|
||||
\]
|
||||
!et
|
||||
for anti-parallel spins and
|
||||
!bt
|
||||
\[
|
||||
{\cal R}_T \propto \exp{(r_{ij}/4)},
|
||||
\]
|
||||
!et
|
||||
for anti-parallel spins.
|
||||
This is the so-called cusp condition for the relative motion, resulting in a minimal requirement
|
||||
for the correlation part of the wave fuction.
|
||||
For general systems containing more than say two electrons, we have this
|
||||
condition for each electron pair $ij$.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
!split
|
||||
===== The VMC code =====
|
||||
|
||||
!bc pycod
|
||||
# Importing various packages
|
||||
from math import exp, sqrt
|
||||
from random import random, seed
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from mpl_toolkits.mplot3d import Axes3D
|
||||
from matplotlib import cm
|
||||
from matplotlib.ticker import LinearLocator, FormatStrFormatter
|
||||
import sys
|
||||
|
||||
#Trial wave function for quantum dots in two dims
|
||||
def WaveFunction(r,alpha,beta):
|
||||
r1 = r[0,0]**2 + r[0,1]**2
|
||||
r2 = r[1,0]**2 + r[1,1]**2
|
||||
r12 = sqrt((r[0,0]-r[1,0])**2 + (r[0,1]-r[1,1])**2)
|
||||
deno = r12/(1+beta*r12)
|
||||
return exp(-0.5*alpha*(r1+r2)+deno)
|
||||
|
||||
#Local energy for quantum dots in two dims, using analytical local energy
|
||||
def LocalEnergy(r,alpha,beta):
|
||||
|
||||
r1 = (r[0,0]**2 + r[0,1]**2)
|
||||
r2 = (r[1,0]**2 + r[1,1]**2)
|
||||
r12 = sqrt((r[0,0]-r[1,0])**2 + (r[0,1]-r[1,1])**2)
|
||||
deno = 1.0/(1+beta*r12)
|
||||
deno2 = deno*deno
|
||||
return 0.5*(1-alpha*alpha)*(r1 + r2) +2.0*alpha + 1.0/r12+deno2*(alpha*r12-deno2+2*beta*deno-1.0/r12)
|
||||
|
||||
# The Monte Carlo sampling with the Metropolis algo
|
||||
def MonteCarloSampling():
|
||||
|
||||
NumberMCcycles= 100000
|
||||
StepSize = 1.0
|
||||
# positions
|
||||
PositionOld = np.zeros((NumberParticles,Dimension), np.double)
|
||||
PositionNew = np.zeros((NumberParticles,Dimension), np.double)
|
||||
# seed for rng generator
|
||||
seed()
|
||||
# start variational parameter
|
||||
alpha = 0.9
|
||||
for ia in range(MaxVariations):
|
||||
alpha += .025
|
||||
AlphaValues[ia] = alpha
|
||||
beta = 0.2
|
||||
for jb in range(MaxVariations):
|
||||
beta += .01
|
||||
BetaValues[jb] = beta
|
||||
energy = energy2 = 0.0
|
||||
DeltaE = 0.0
|
||||
#Initial position
|
||||
for i in range(NumberParticles):
|
||||
for j in range(Dimension):
|
||||
PositionOld[i,j] = StepSize * (random() - .5)
|
||||
wfold = WaveFunction(PositionOld,alpha,beta)
|
||||
|
||||
#Loop over MC MCcycles
|
||||
for MCcycle in range(NumberMCcycles):
|
||||
#Trial position
|
||||
for i in range(NumberParticles):
|
||||
for j in range(Dimension):
|
||||
PositionNew[i,j] = PositionOld[i,j] + StepSize * (random() - .5)
|
||||
wfnew = WaveFunction(PositionNew,alpha,beta)
|
||||
|
||||
#Metropolis test to see whether we accept the move
|
||||
if random() < wfnew**2 / wfold**2:
|
||||
PositionOld = PositionNew.copy()
|
||||
wfold = wfnew
|
||||
DeltaE = LocalEnergy(PositionOld,alpha,beta)
|
||||
energy += DeltaE
|
||||
energy2 += DeltaE**2
|
||||
|
||||
#We calculate mean, variance and error ...
|
||||
energy /= NumberMCcycles
|
||||
energy2 /= NumberMCcycles
|
||||
variance = energy2 - energy**2
|
||||
error = sqrt(variance/NumberMCcycles)
|
||||
Energies[ia,jb] = energy
|
||||
return Energies, AlphaValues, BetaValues
|
||||
|
||||
|
||||
#Here starts the main program with variable declarations
|
||||
NumberParticles = 2
|
||||
Dimension = 2
|
||||
MaxVariations = 10
|
||||
Energies = np.zeros((MaxVariations,MaxVariations))
|
||||
AlphaValues = np.zeros(MaxVariations)
|
||||
BetaValues = np.zeros(MaxVariations)
|
||||
(Energies, AlphaValues, BetaValues) = MonteCarloSampling()
|
||||
|
||||
# Prepare for plots
|
||||
fig = plt.figure()
|
||||
ax = fig.gca(projection='3d')
|
||||
# Plot the surface.
|
||||
X, Y = np.meshgrid(AlphaValues, BetaValues)
|
||||
surf = ax.plot_surface(X, Y, Energies,cmap=cm.coolwarm,linewidth=0, antialiased=False)
|
||||
# Customize the z axis.
|
||||
zmin = np.matrix(Energies).min()
|
||||
zmax = np.matrix(Energies).max()
|
||||
ax.set_zlim(zmin, zmax)
|
||||
ax.set_xlabel(r'$\alpha$')
|
||||
ax.set_ylabel(r'$\beta$')
|
||||
ax.set_zlabel(r'$\langle E \rangle$')
|
||||
ax.zaxis.set_major_locator(LinearLocator(10))
|
||||
ax.zaxis.set_major_formatter(FormatStrFormatter('%.02f'))
|
||||
# Add a color bar which maps values to colors.
|
||||
fig.colorbar(surf, shrink=0.5, aspect=5)
|
||||
plt.show()
|
||||
|
||||
!ec
|
||||
|
||||
|
||||
!split
|
||||
===== Technical aspect, improvements and how to define the cost function =====
|
||||
!bblock
|
||||
|
||||
_The above procedure is not the smartest one_. Looping over all variational parameters becomes expensive.
|
||||
Also, we don't use importance sampling and optimizations of the standard deviation (blocking, bootstrap, jackknife).
|
||||
Such codes are included in the above Github address.
|
||||
|
||||
|
||||
We can also be smarter and use minimization methods to find the _optimal_ variational parameters with fewer Monte Carlo cycles and then
|
||||
fire up our heavy artillery.
|
||||
|
||||
One way to achieve this is to minimize the energy as function of the variational parameters.
|
||||
|
||||
!eblock
|
||||
|
||||
!split
|
||||
===== Energy derivatives =====
|
||||
!bblock
|
||||
To find the derivatives of the local energy expectation value as function of the variational parameters, we can use the chain rule and the hermiticity of the Hamiltonian.
|
||||
|
||||
Let us define
|
||||
!bt
|
||||
\[
|
||||
\bar{E}_{\alpha_i}=\frac{d\langle E_L\rangle}{d\alpha_i}.
|
||||
\]
|
||||
!et
|
||||
as the derivative of the energy with respect to the variational parameter $\alpha_i$
|
||||
We define also the derivative of the trial function (skipping the subindex $T$) as
|
||||
!bt
|
||||
\[
|
||||
\bar{\Psi}_{i}=\frac{d\Psi}{d\alpha_i}.
|
||||
\]
|
||||
!et
|
||||
!eblock
|
||||
|
||||
|
||||
!split
|
||||
===== Derivatives of the local energy =====
|
||||
!bblock
|
||||
The elements of the gradient of the local energy are then (using the chain rule and the hermiticity of the Hamiltonian)
|
||||
!bt
|
||||
\[
|
||||
\bar{E}_{i}= 2\left( \langle \frac{\bar{\Psi}_{i}}{\Psi}E_L\rangle -\langle \frac{\bar{\Psi}_{i}}{\Psi}\rangle\langle E_L \rangle\right).
|
||||
\]
|
||||
!et
|
||||
From a computational point of view it means that you need to compute the expectation values of
|
||||
!bt
|
||||
\[
|
||||
\langle \frac{\bar{\Psi}_{i}}{\Psi}E_L\rangle,
|
||||
\]
|
||||
!et
|
||||
and
|
||||
!bt
|
||||
\[
|
||||
\langle \frac{\bar{\Psi}_{i}}{\Psi}\rangle\langle E_L\rangle
|
||||
\]
|
||||
!et
|
||||
These integrals are evaluted using MC intergration (with all its possible error sources).
|
||||
We can then use methods like stochastic gradient or other minimization methods to find the optimal variational parameters (I don't discuss this topic here, but these methods are very important in ML).
|
||||
!eblock
|
||||
|
||||
!split
|
||||
===== How do we define our cost function? =====
|
||||
!bblock
|
||||
We have a model, our likelihood function.
|
||||
|
||||
How should we define the cost function?
|
||||
|
||||
!eblock
|
||||
|
||||
!split
|
||||
===== Meet the variance and its derivatives =====
|
||||
!bblock Why the variance?
|
||||
Suppose the trial function (our model) is the exact wave function. The action of the hamiltionan
|
||||
on the wave function
|
||||
!bt
|
||||
\[
|
||||
H\Psi = \mathrm{constant}\times \Psi,
|
||||
\]
|
||||
!et
|
||||
The integral which defines various
|
||||
expectation values involving moments of the hamiltonian becomes then
|
||||
!bt
|
||||
\[
|
||||
\langle E^n \rangle = \langle H^n \rangle =
|
||||
\frac{\int d\bm{R}\Psi^{\ast}(\bm{R})H^n(\bm{R})\Psi(\bm{R})}
|
||||
{\int d\bm{R}\Psi^{\ast}(\bm{R})\Psi(\bm{R})}=
|
||||
\mathrm{constant}\times\frac{\int d\bm{R}\Psi^{\ast}(\bm{R})\Psi(\bm{R})}
|
||||
{\int d\bm{R}\Psi^{\ast}(\bm{R})\Psi(\bm{R})}=\mathrm{constant}.
|
||||
\]
|
||||
!et
|
||||
_This gives an important information: If I want the variance, the exact wave function leads to zero variance!_
|
||||
The variance is defined as
|
||||
!bt
|
||||
\[
|
||||
\sigma_E = \langle E^2\rangle - \langle E\rangle^2.
|
||||
\]
|
||||
!et
|
||||
Variation is then performed by minimizing both the energy and the variance.
|
||||
|
||||
!eblock
|
||||
|
||||
|
||||
!split
|
||||
===== The variance defines the cost function =====
|
||||
!bblock
|
||||
We can then take the derivatives of
|
||||
!bt
|
||||
\[
|
||||
\sigma_E = \langle E^2\rangle - \langle E\rangle^2,
|
||||
\]
|
||||
!et
|
||||
with respect to the variational parameters. The derivatives of the variance can then be used to defined the
|
||||
so-called Hessian matrix, which in turn allows us to use minimization methods like Newton's method or
|
||||
standard gradient methods.
|
||||
|
||||
This leads to however a more complicated expression, with obvious errors when evaluating integrals by Monte Carlo integration. Less used, see however "Filippi and Umrigar":"https://journals.aps.org/prl/abstract/10.1103/PhysRevLett.94.150201". The expression becomes complicated
|
||||
!bt
|
||||
\[
|
||||
\bar{E}_{ij} = 2\left[ \langle (\frac{\bar{\Psi}_{ij}}{\Psi}+\frac{\bar{\Psi}_{j}}{\Psi}\frac{\bar{\Psi}_{i}}{\Psi})(E_L-\langle E\rangle)\rangle -\langle \frac{\bar{\Psi}_{i}}{\Psi}\rangle\bar{E}_j-\langle \frac{\bar{\Psi}_{j}}{\Psi}\rangle\bar{E}_i\right] +\langle \frac{\bar{\Psi}_{i}}{\Psi}E_L{_j}\rangle +\langle \frac{\bar{\Psi}_{j}}{\Psi}E_L{_i}\rangle -\langle \frac{\bar{\Psi}_{i}}{\Psi}\rangle\langle E_L{_j}\rangle \langle \frac{\bar{\Psi}_{j}}{\Psi}\rangle\langle E_L{_i}\rangle.
|
||||
\]
|
||||
!et
|
||||
|
||||
Evaluating the cost function means having to evaluate the above second derivative of the energy.
|
||||
|
||||
!eblock
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user