added an article and corrected mathjax

stat challenge day 2
This commit is contained in:
redoules 2018-11-09 23:46:12 +01:00
parent 7e8e645115
commit 5fcdcae874
55 changed files with 594 additions and 314 deletions

View File

@ -185,7 +185,7 @@ Mean : 43117.75, Median : 44627.5, Mode : 4978
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -219,7 +219,7 @@ Q1 : 6.0, Q2 : 12, Q3 : 16.0
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -0,0 +1,478 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="Data Science for Political and Social Phenomena">
<meta name="author" content="Guillaume Redoulès">
<link rel="icon" href="../favicon.ico">
<title>Day 2 - Probability, Compound Event Probability - Blog</title>
<!-- JQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
window.jQuery || document.write('<script src="../theme/js/jquery.min.js"><\/script>')
</script>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="../theme/css/bootstrap.css" />
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link rel="stylesheet" type="text/css" href="../theme/css/ie10-viewport-bug-workaround.css" />
<!-- Custom styles for this template -->
<link rel="stylesheet" type="text/css" href="../theme/css/style.css" />
<link rel="stylesheet" type="text/css" href="../theme/css/notebooks.css" />
<link href='https://fonts.googleapis.com/css?family=PT+Serif:400,700|Roboto:400,500,700' rel='stylesheet' type='text/css'>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<meta name="tags" content="Basics" />
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="..">Guillaume Redoulès</a>
</div>
<div class="navbar-collapse collapse" id="searchbar">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">About<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="../pages/about.html">About Guillaume</a></li>
<li><a href="https://github.com/redoules">GitHub</a></li>
<li><a href="https://www.linkedin.com/in/guillaume-redoul%C3%A8s-33923860/">LinkedIn</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Data Science<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="..#Blog">Blog</a></li>
<li><a href="..#Python">Python</a></li>
<li><a href="..#Bash">Bash</a></li>
<li><a href="..#SQL">SQL</a></li>
<li><a href="..#Mathematics">Mathematics</a></li>
<li><a href="..#Machine_Learning">Machine Learning</a></li>
<li><a href="..#Projects">Projects</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Projects<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="https://github.com/redoules/redoules.github.io">Notes (Github)</a></li>
</ul>
</li>
<!--<li class="dropdown">
<a href="../feeds/blog.rss.xml">Blog RSS</a>
</li>-->
</ul>
<form class="navbar-form" action="../search.html" onsubmit="return validateForm(this.elements['q'].value);">
<div class="form-group" style="display:inline;">
<div class="input-group" style="display:table;">
<span class="input-group-addon" style="width:1%;"><span class="glyphicon glyphicon-search"></span></span>
<input class="form-control search-query" name="q" id="tipue_search_input" placeholder="e.g. scikit KNN, pandas merge" required autocomplete="off" type="text">
</div>
</div>
</form>
</div>
<!--/.nav-collapse -->
</div>
</div>
<!-- end of header section -->
<div class="container">
<!-- <div class="alert alert-warning" role="alert">
Did you find this page useful? Please do me a quick favor and <a href="#" class="alert-link">endorse me for data science on LinkedIn</a>.
</div> -->
<section id="content" class="body">
<header>
<h1>
Day 2 - Probability, Compound Event Probability
</h1>
<ol class="breadcrumb">
<li>
<time class="published" datetime="2018-11-09T20:01:00+01:00">
09 novembre 2018
</time>
</li>
<li>Blog</li>
<li>Basics</li>
</ol>
</header>
<div class='article_content'>
<h2>Basic probability with dices</h2>
<h3>Problem</h3>
<p>In this challenge, we practice calculating probability. In a single toss of 2 fair (evenly-weighted) six-sided dice, find the probability that their sum will be at most 9.</p>
<h3>Mathematical explanation</h3>
<p>A nice way to think about sums-of-two-dice problems is to lay out the sums in a 6-by-6 grid in the obvious manner.
<div>
<style scoped>
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}</p>
<div class="highlight"><pre><span></span><span class="na">.dataframe</span> <span class="no">tbody</span> <span class="no">tr</span> <span class="no">th</span> <span class="err">{</span>
<span class="nl">vertical-align:</span> <span class="nf">top</span><span class="c">;</span>
<span class="err">}</span>
<span class="na">.dataframe</span> <span class="no">thead</span> <span class="no">th</span> <span class="err">{</span>
<span class="nl">text-align:</span> <span class="nf">right</span><span class="c">;</span>
<span class="err">}</span>
</pre></div>
<p></style>
<table border="1" class="dataframe">
<thead>
<tr style="text-align: right;">
<th></th>
<th>1</th>
<th>2</th>
<th>3</th>
<th>4</th>
<th>5</th>
<th>6</th>
</tr>
</thead>
<tbody>
<tr>
<th>1</th>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
</tr>
<tr>
<th>2</th>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>
</tr>
<tr>
<th>3</th>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
<tr>
<th>4</th>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>
<td>9</td>
<td>10</td>
</tr>
<tr>
<th>5</th>
<td>6</td>
<td>7</td>
<td>8</td>
<td>9</td>
<td>10</td>
<td>11</td>
</tr>
<tr>
<th>6</th>
<td>7</td>
<td>8</td>
<td>9</td>
<td>10</td>
<td>11</td>
<td>12</td>
</tr>
</tbody>
</table>
</div></p>
<p>We see that the identic values are on the same diagonal. The number of elements on the diagonal varies from 1 to 6 and then back to 1. </p>
<p>let's call A &lt; x the event : the sum all the 2 tosses is at most x.
</p>
<div class="math">$$P(A\leq9)=\sum_{i=2}^{9} P(A = i)$$</div>
<div class="math">$$P(A\leq9)=1-P(A\gt9)$$</div>
<div class="math">$$P(A\leq9)=1-\sum_{i=10}^{12} P(A = i)$$</div>
<p>The value of <span class="math">\(P(A = i) = \frac{i-1}{36}\)</span> if <span class="math">\(i \leq 7\)</span> and <span class="math">\(P(A = i) = \frac{13-i}{36}\)</span></p>
<p>hence
</p>
<div class="math">$$P(A\leq9)=1-\sum_{i=10}^{12} \frac{13-i}{36}$$</div>
<div class="math">$$P(A\leq9)= 1-\frac{6}{36}$$</div>
<div class="math">$$P(A\leq9)= \frac{5}{6}$$</div>
<h3>Let's program it</h3>
<div class="highlight"><pre><span></span><span class="nb">sum</span><span class="p">([</span><span class="mi">1</span> <span class="k">for</span> <span class="n">d1</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">7</span><span class="p">)</span> <span class="k">for</span> <span class="n">d2</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">7</span><span class="p">)</span> <span class="k">if</span> <span class="n">d1</span><span class="o">+</span><span class="n">d2</span><span class="o">&lt;=</span><span class="mi">9</span><span class="p">])</span> <span class="o">/</span> <span class="mi">36</span>
</pre></div>
<div class="highlight"><pre><span></span>0.8333333333333334
</pre></div>
<h2>More dices</h2>
<h3>Problem</h3>
<p>In a single toss of 2 fair (evenly-weighted) six-sided dice, find the probability that the values rolled by each die will be different and the two dice have a sum of 6. </p>
<h3>Mathematical explanation</h3>
<p>Let's consider 2 events : A and B. A compound event is a combination of 2 or more simple events. If A and B are simple events, then AB denotes the occurence of either A or B. A∩B denotes the occurence of A and B together.</p>
<p>We denote A the event "the values of each dice is different". The opposit event is A' "the values of each dice is the same".
</p>
<div class="math">$$P(A) = 1-P(A')$$</div>
<div class="math">$$P(A)=1-\frac{6}{36}$$</div>
<div class="math">$$P(A)=\frac{5}{6}$$</div>
<p>We denote B the event "the two dice have a sum of 6", this probability has been computed on the first part of the article :
</p>
<div class="math">$$P(B)=\frac{5}{36}$$</div>
<p>The probability of having 2 dice different of sum 6 is :</p>
<div class="math">$$P(A|B) = 4/5$$</div>
<p>The probability that both A and B occure is equal to P(A∩B).</p>
<p>Since <span class="math">\(P(A|B)=\frac{P(A∩B)}{P(B)}\)</span></p>
<div class="math">$$P(A∩B)=P(B)*P(A|B)$$</div>
<div class="math">$$P(A∩B)=5/36*4/5$$</div>
<div class="math">$$P(A∩B)=1/9$$</div>
<h3>Let's program it</h3>
<div class="highlight"><pre><span></span><span class="nb">sum</span><span class="p">([</span><span class="mi">1</span> <span class="k">for</span> <span class="n">d1</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">7</span><span class="p">)</span> <span class="k">for</span> <span class="n">d2</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="mi">7</span><span class="p">)</span> <span class="k">if</span> <span class="p">(</span><span class="n">d1</span><span class="o">+</span><span class="n">d2</span><span class="o">==</span><span class="mi">6</span><span class="p">)</span> <span class="ow">and</span> <span class="p">(</span><span class="n">d1</span><span class="o">!=</span><span class="n">d2</span><span class="p">)])</span> <span class="o">/</span> <span class="mi">36</span>
</pre></div>
<div class="highlight"><pre><span></span>0.1111111111111111
</pre></div>
<h2>Compound Event Probability</h2>
<h3>Problem</h3>
<p>There are 3 urns labeled X, Y, and Z.</p>
<ul>
<li>Urn X contains 4 red balls and 3 black balls.</li>
<li>Urn Y contains 5 red balls and 4 black balls.</li>
<li>Urn Z contains 4 red balls and 4 black balls. </li>
</ul>
<p>One ball is drawn from each of the urns. What is the probability that, of the 3 balls drawn, are 2 red and is 1 black?</p>
<h3>Mathematical explanation</h3>
<p>Let's write the different probabilities:</p>
<div>
<style scoped="">
.dataframe tbody tr th:only-of-type {
vertical-align: middle;
}
.dataframe tbody tr th {
vertical-align: top;
}
.dataframe thead th {
text-align: right;
}
</style>
<table class="dataframe" border="1">
<thead>
<tr style="text-align: right;">
<th></th>
<th>Red ball</th>
<th>Black ball</th>
</tr>
</thead>
<tbody>
<tr>
<th>Urne X</th>
<td>$$\frac{4}{7}$$</td>
<td>$$\frac{3}{7}$$</td>
</tr>
<tr>
<th>Urne Y</th>
<td>$$\frac{5}{9}$$</td>
<td>$$\frac{4}{9}$$</td>
</tr>
<tr>
<th>Urne Z</th>
<td>$$\frac{1}{2}$$</td>
<td>$$\frac{1}{2}$$</td>
</tr>
</tbody>
</table>
</div>
<h4>Addition rule</h4>
<p>A and B are said to be mutually exclusive or disjoint if they have no events in common (i.e., and A∩B=∅ and P(A∩B)=0. The probability of any of 2 or more events occurring is the union () of events. Because disjoint probabilities have no common events, the probability of the union of disjoint events is the sum of the events' individual probabilities. A and B are said to be collectively exhaustive if their union covers all events in the sample space (i.e., AB=S and P(AB)=1). This brings us to our next fundamental rule of probability: if 2 events, A and B, are disjoint, then the probability of either event is the sum of the probabilities of the 2 events (i.e., P(A or B) = P(A)+P(B))</p>
<h4>Mutliplication rule</h4>
<p>If the outcome of the first event (A) has no impact on the second event (B), then they are considered to be independent (e.g., tossing a fair coin). This brings us to the next fundamental rule of probability: the multiplication rule. It states that if two events, A and B, are independent, then the probability of both events is the product of the probabilities for each event (i.e., P(A and B)= P(A)xP(B)). The chance of all events occurring in a sequence of events is called the intersection (∩) of those events. </p>
<p>The balls drawn from the urns are independant hence : </p>
<p>p = P(2 red (R) and 1 back (B))
</p>
<div class="math">$$p = P(RRB) + P(RBR) + P(BRR)$$</div>
<p>Each of those 3 probability if equal to the product of the probability of drawing each ball
<span class="math">\(P(RRB) = P(R|X) * P(R|Y) * P(B|Z) = 4/7*5/9*1/2\)</span></p>
<ul>
<li>
<p><span class="math">\(P(RRB) = 20/126\)</span></p>
</li>
<li>
<p><span class="math">\(P(RBR) = 16/126\)</span></p>
</li>
<li>
<p><span class="math">\(P(BRR) = 15/126\)</span></p>
</li>
</ul>
<p>this leads to </p>
<ul>
<li><span class="math">\(p = 51/126\)</span></li>
</ul>
<p>and finally
</p>
<div class="math">$$p = \frac{17}{42}$$</div>
<h3>Let's program it</h3>
<div class="highlight"><pre><span></span><span class="n">X</span> <span class="o">=</span> <span class="mi">3</span><span class="o">*</span><span class="p">[</span><span class="s2">&quot;B&quot;</span><span class="p">]</span><span class="o">+</span><span class="mi">4</span><span class="o">*</span><span class="p">[</span><span class="s2">&quot;R&quot;</span><span class="p">]</span>
<span class="n">Y</span> <span class="o">=</span> <span class="mi">4</span><span class="o">*</span><span class="p">[</span><span class="s2">&quot;B&quot;</span><span class="p">]</span><span class="o">+</span><span class="mi">5</span><span class="o">*</span><span class="p">[</span><span class="s2">&quot;R&quot;</span><span class="p">]</span>
<span class="n">Z</span> <span class="o">=</span> <span class="mi">4</span><span class="o">*</span><span class="p">[</span><span class="s2">&quot;B&quot;</span><span class="p">]</span><span class="o">+</span><span class="mi">4</span><span class="o">*</span><span class="p">[</span><span class="s2">&quot;R&quot;</span><span class="p">]</span>
<span class="n">target</span> <span class="o">=</span> <span class="p">[</span><span class="s2">&quot;BRR&quot;</span><span class="p">,</span> <span class="s2">&quot;RRB&quot;</span><span class="p">,</span> <span class="s2">&quot;RBR&quot;</span><span class="p">]</span>
<span class="nb">sum</span><span class="p">([</span><span class="mi">1</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">X</span> <span class="k">for</span> <span class="n">y</span> <span class="ow">in</span> <span class="n">Y</span> <span class="k">for</span> <span class="n">z</span> <span class="ow">in</span> <span class="n">Z</span> <span class="k">if</span> <span class="n">x</span><span class="o">+</span><span class="n">y</span><span class="o">+</span><span class="n">z</span> <span class="ow">in</span> <span class="n">target</span><span class="p">])</span><span class="o">/</span><span class="nb">sum</span><span class="p">([</span><span class="mi">1</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">X</span> <span class="k">for</span> <span class="n">y</span> <span class="ow">in</span> <span class="n">Y</span> <span class="k">for</span> <span class="n">z</span> <span class="ow">in</span> <span class="n">Z</span><span class="p">])</span>
</pre></div>
<div class="highlight"><pre><span></span>0.40476190476190477
</pre></div>
<script type="text/javascript">if (!document.getElementById('mathjaxscript_pelican_#%@#$@#')) {
var align = "center",
indent = "0em",
linebreak = "false";
if (false) {
align = (screen.width < 768) ? "left" : align;
indent = (screen.width < 768) ? "0em" : indent;
linebreak = (screen.width < 768) ? 'true' : linebreak;
}
var mathjaxscript = document.createElement('script');
mathjaxscript.id = 'mathjaxscript_pelican_#%@#$@#';
mathjaxscript.type = 'text/javascript';
mathjaxscript.src = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/latest.js?config=TeX-AMS-MML_HTMLorMML';
mathjaxscript[(window.opera ? "innerHTML" : "text")] =
"MathJax.Hub.Config({" +
" config: ['MMLorHTML.js']," +
" TeX: { extensions: ['AMSmath.js','AMSsymbols.js','noErrors.js','noUndefined.js'], equationNumbers: { autoNumber: 'AMS' } }," +
" jax: ['input/TeX','input/MathML','output/HTML-CSS']," +
" extensions: ['tex2jax.js','mml2jax.js','MathMenu.js','MathZoom.js']," +
" displayAlign: '"+ align +"'," +
" displayIndent: '"+ indent +"'," +
" showMathMenu: true," +
" messageStyle: 'normal'," +
" tex2jax: { " +
" inlineMath: [ ['\\\\(','\\\\)'] ], " +
" displayMath: [ ['$$','$$'] ]," +
" processEscapes: true," +
" preview: 'TeX'," +
" }, " +
" 'HTML-CSS': { " +
" styles: { '.MathJax_Display, .MathJax .mo, .MathJax .mi, .MathJax .mn': {color: 'inherit ! important'} }," +
" linebreaks: { automatic: "+ linebreak +", width: '90% container' }," +
" }, " +
"}); " +
"if ('default' !== 'default') {" +
"MathJax.Hub.Register.StartupHook('HTML-CSS Jax Ready',function () {" +
"var VARIANT = MathJax.OutputJax['HTML-CSS'].FONTDATA.VARIANT;" +
"VARIANT['normal'].fonts.unshift('MathJax_default');" +
"VARIANT['bold'].fonts.unshift('MathJax_default-bold');" +
"VARIANT['italic'].fonts.unshift('MathJax_default-italic');" +
"VARIANT['-tex-mathit'].fonts.unshift('MathJax_default-italic');" +
"});" +
"MathJax.Hub.Register.StartupHook('SVG Jax Ready',function () {" +
"var VARIANT = MathJax.OutputJax.SVG.FONTDATA.VARIANT;" +
"VARIANT['normal'].fonts.unshift('MathJax_default');" +
"VARIANT['bold'].fonts.unshift('MathJax_default-bold');" +
"VARIANT['italic'].fonts.unshift('MathJax_default-italic');" +
"VARIANT['-tex-mathit'].fonts.unshift('MathJax_default-italic');" +
"});" +
"}";
(document.body || document.getElementsByTagName('head')[0]).appendChild(mathjaxscript);
}</script>
</div>
<aside>
<div class="bug-reporting__panel">
<h3>Find an error or bug? Have a suggestion?</h3>
<p>Everything on this site is avaliable on GitHub. Head on over and <a href='https://github.com/redoules/redoules.github.io/issues/new'>submit an issue.</a> You can also message me directly by <a href='mailto:guillaume.redoules@gadz.org'>email</a>.</p>
</div>
</aside>
</section>
</div>
<!-- start of footer section -->
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.
</center>
</p>
</div>
</footer>
<!-- This jQuery line finds any span that contains code highlighting classes and then selects the parent <pre> tag and adds a border. This is done as a workaround to visually distinguish the code inputs and outputs -->
<script>
$( ".hll, .n, .c, .err, .k, .o, .cm, .cp, .c1, .cs, .gd, .ge, .gr, .gh, .gi, .go, .gp, .gs, .gu, .gt, .kc, .kd, .kn, .kp, .kr, .kt, .m, .s, .na, .nb, .nc, .no, .nd, .ni, .ne, .nf, .nl, .nn, .nt, .nv, .ow, .w, .mf, .mh, .mi, .mo, .sb, .sc, .sd, .s2, .se, .sh, .si, .sx, .sr, .s1, .ss, .bp, .vc, .vg, .vi, .il" ).parent( "pre" ).css( "border", "1px solid #DEDEDE" );
</script>
<!-- Load Google Analytics -->
<script>
/*
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-66582-32', 'auto');
ga('send', 'pageview');
*/
</script>
<!-- End of Google Analytics -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../theme/js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="../theme/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>

View File

@ -286,7 +286,7 @@ maxuploadtarget=5000
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -161,7 +161,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -120,6 +120,7 @@
<div class="panel panel-default">
<div class="panel-body">
<ul>
<li><a href="./blog/Statistics_10days-day2.html">11/18 Day 2 - Probability, Compound Event Probability</a></li>
<li><a href="./blog/Statistics_10days-day1.html">11/18 Day 1 - Quartiles, Interquartile Range and standard deviation</a></li>
<li><a href="./blog/Statistics_10days-day0.html">11/18 Day 0 - Median, mean, mode and weighted mean</a></li>
</ul>
@ -677,7 +678,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -149,7 +149,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -211,7 +211,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -144,7 +144,7 @@ However, you can use the following command to do it </p>
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -143,7 +143,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -203,7 +203,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -148,7 +148,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -167,7 +167,7 @@ none 0 0 0 - /config
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -256,7 +256,7 @@ wifi0 Link encap:UNSPEC HWaddr 5C-51-4F-41-7A-AD-00-00-00-00-00-00-00-00-00
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -172,7 +172,7 @@ USER;PID;%CPU;%MEM;VSZ;RSS;TTY;STAT;START;TIME;COMMAND</p>
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -158,7 +158,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -151,7 +151,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -208,7 +208,7 @@ The secret number is 126
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -160,7 +160,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -1033,7 +1033,7 @@ Top dislike features:
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -125,8 +125,62 @@
</ol>
</header>
<div class='article_content'>
<p>A complete graph contains $\frac{n(n-1)}{2}$ edges where $n$ is the number of vertices (or nodes).</p>
<p>A complete graph contains <span class="math">\(\frac{n(n-1)}{2}\)</span> edges where <span class="math">\(n\)</span> is the number of vertices (or nodes).</p>
<p><img alt="Complete Graph" src="../images/Number_of_edges_in_a_Complete_graph/complete_graph.png"></p>
<script type="text/javascript">if (!document.getElementById('mathjaxscript_pelican_#%@#$@#')) {
var align = "center",
indent = "0em",
linebreak = "false";
if (false) {
align = (screen.width < 768) ? "left" : align;
indent = (screen.width < 768) ? "0em" : indent;
linebreak = (screen.width < 768) ? 'true' : linebreak;
}
var mathjaxscript = document.createElement('script');
mathjaxscript.id = 'mathjaxscript_pelican_#%@#$@#';
mathjaxscript.type = 'text/javascript';
mathjaxscript.src = 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.3/latest.js?config=TeX-AMS-MML_HTMLorMML';
mathjaxscript[(window.opera ? "innerHTML" : "text")] =
"MathJax.Hub.Config({" +
" config: ['MMLorHTML.js']," +
" TeX: { extensions: ['AMSmath.js','AMSsymbols.js','noErrors.js','noUndefined.js'], equationNumbers: { autoNumber: 'AMS' } }," +
" jax: ['input/TeX','input/MathML','output/HTML-CSS']," +
" extensions: ['tex2jax.js','mml2jax.js','MathMenu.js','MathZoom.js']," +
" displayAlign: '"+ align +"'," +
" displayIndent: '"+ indent +"'," +
" showMathMenu: true," +
" messageStyle: 'normal'," +
" tex2jax: { " +
" inlineMath: [ ['\\\\(','\\\\)'] ], " +
" displayMath: [ ['$$','$$'] ]," +
" processEscapes: true," +
" preview: 'TeX'," +
" }, " +
" 'HTML-CSS': { " +
" styles: { '.MathJax_Display, .MathJax .mo, .MathJax .mi, .MathJax .mn': {color: 'inherit ! important'} }," +
" linebreaks: { automatic: "+ linebreak +", width: '90% container' }," +
" }, " +
"}); " +
"if ('default' !== 'default') {" +
"MathJax.Hub.Register.StartupHook('HTML-CSS Jax Ready',function () {" +
"var VARIANT = MathJax.OutputJax['HTML-CSS'].FONTDATA.VARIANT;" +
"VARIANT['normal'].fonts.unshift('MathJax_default');" +
"VARIANT['bold'].fonts.unshift('MathJax_default-bold');" +
"VARIANT['italic'].fonts.unshift('MathJax_default-italic');" +
"VARIANT['-tex-mathit'].fonts.unshift('MathJax_default-italic');" +
"});" +
"MathJax.Hub.Register.StartupHook('SVG Jax Ready',function () {" +
"var VARIANT = MathJax.OutputJax.SVG.FONTDATA.VARIANT;" +
"VARIANT['normal'].fonts.unshift('MathJax_default');" +
"VARIANT['bold'].fonts.unshift('MathJax_default-bold');" +
"VARIANT['italic'].fonts.unshift('MathJax_default-italic');" +
"VARIANT['-tex-mathit'].fonts.unshift('MathJax_default-italic');" +
"});" +
"}";
(document.body || document.getElementsByTagName('head')[0]).appendChild(mathjaxscript);
}</script>
</div>
<aside>
<div class="bug-reporting__panel">
@ -141,7 +195,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -145,7 +145,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -192,7 +192,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -241,7 +241,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -235,7 +235,7 @@ At line 5 there is a plum which is purple and contains 28 kcal
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -378,7 +378,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -168,7 +168,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -192,7 +192,7 @@ If you try to open a non existing file in read mode 'r', a FileNotFoundError wil
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -176,7 +176,7 @@ conda install numpy --channel intel --override-channels
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -237,7 +237,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -186,7 +186,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -171,7 +171,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -339,7 +339,7 @@ However, exporting to a sql database can prove very useful. Indeed, having a wel
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -181,7 +181,7 @@ The number 4 appears 1 times in the list
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -338,7 +338,7 @@ http://127.0.0.1:8787/status</p>
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -148,7 +148,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -232,7 +232,7 @@ The list of dependencies required to test, build and generate the doc are listed
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -164,7 +164,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -218,7 +218,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -177,7 +177,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -213,7 +213,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -248,7 +248,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -1,260 +0,0 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="Data Science for Political and Social Phenomena">
<meta name="author" content="Guillaume Redoulès">
<link rel="icon" href="../favicon.ico">
<title>Running the notebook on a remote server - Python</title>
<!-- JQuery -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
window.jQuery || document.write('<script src="../theme/js/jquery.min.js"><\/script>')
</script>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="../theme/css/bootstrap.css" />
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<link rel="stylesheet" type="text/css" href="../theme/css/ie10-viewport-bug-workaround.css" />
<!-- Custom styles for this template -->
<link rel="stylesheet" type="text/css" href="../theme/css/style.css" />
<link rel="stylesheet" type="text/css" href="../theme/css/notebooks.css" />
<link href='https://fonts.googleapis.com/css?family=PT+Serif:400,700|Roboto:400,500,700' rel='stylesheet' type='text/css'>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<meta name="tags" content="Basics" />
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="..">Guillaume Redoulès</a>
</div>
<div class="navbar-collapse collapse" id="searchbar">
<ul class="nav navbar-nav navbar-right">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">About<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="../pages/about.html">About Guillaume</a></li>
<li><a href="https://github.com/redoules">GitHub</a></li>
<li><a href="https://www.linkedin.com/in/guillaume-redoul%C3%A8s-33923860/">LinkedIn</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Data Science<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="..#Blog">Blog</a></li>
<li><a href="..#Python">Python</a></li>
<li><a href="..#Bash">Bash</a></li>
<li><a href="..#SQL">SQL</a></li>
<li><a href="..#Mathematics">Mathematics</a></li>
<li><a href="..#Machine_Learning">Machine Learning</a></li>
<li><a href="..#Projects">Projects</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Projects<span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="https://github.com/redoules/redoules.github.io">Notes (Github)</a></li>
</ul>
</li>
<!--<li class="dropdown">
<a href="../feeds/blog.rss.xml">Blog RSS</a>
</li>-->
</ul>
<form class="navbar-form" action="../search.html" onsubmit="return validateForm(this.elements['q'].value);">
<div class="form-group" style="display:inline;">
<div class="input-group" style="display:table;">
<span class="input-group-addon" style="width:1%;"><span class="glyphicon glyphicon-search"></span></span>
<input class="form-control search-query" name="q" id="tipue_search_input" placeholder="e.g. scikit KNN, pandas merge" required autocomplete="off" type="text">
</div>
</div>
</form>
</div>
<!--/.nav-collapse -->
</div>
</div>
<!-- end of header section -->
<div class="container">
<!-- <div class="alert alert-warning" role="alert">
Did you find this page useful? Please do me a quick favor and <a href="#" class="alert-link">endorse me for data science on LinkedIn</a>.
</div> -->
<section id="content" class="body">
<header>
<h1>
Running the notebook on a remote server
</h1>
<ol class="breadcrumb">
<li>
<time class="published" datetime="2018-08-15T11:07:00+02:00">
15 août 2018
</time>
</li>
<li>Python</li>
<li>Basics</li>
</ol>
</header>
<div class='article_content'>
<h2>Jupyter hub</h2>
<p>With JupyterHub you can create a multi-user Hub which spawns, manages, and proxies multiple instances of the single-user Jupyter notebook server.</p>
<p>Project Jupyter created JupyterHub to support many users. The Hub can offer notebook servers to a class of students, a corporate data science workgroup, a scientific research project, or a high performance computing group.</p>
<p>However, if you are the only one using the server and you just want a simple way to run the notebook on your server and access it through the web interface on a light client without having to install and configure the jupyter hub, you can do the following.</p>
<h2>Problem with jupyter notebook</h2>
<p>On your server, run the command </p>
<div class="highlight"><pre><span></span>jupyter-notebook
</pre></div>
<p>you should get something like :</p>
<div class="highlight"><pre><span></span>[I 11:18:44.514 NotebookApp] Serving notebooks from local directory: /volume2/homes/admin
[I 11:18:44.515 NotebookApp] 0 active kernels
[I 11:18:44.516 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/?token=357587e3269b0f20f2b7e1918492890ae7573ac7ef1d2023
[I 11:18:44.516 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 11:18:44.519 NotebookApp] No web browser found: could not locate runnable browser.
[C 11:18:44.520 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=357587e3269b0f20f2b7e1918492890ae7573ac7ef1d2023
</pre></div>
<p>and if you try to connect to your server ip (in my example : http://192.168.1.2:8888/?token=357587e3269b0f20f2b7e1918492890ae7573ac7ef1d2023) you will get an "ERR_CONNECTION_REFUSED" error. This is because, by default, Jupyter Notebook only accepts connections from localhost.</p>
<h2>Allowing connexions from other sources</h2>
<h3>From any IP</h3>
<p>The simplest way to avoid the connection error is to allow the notebook to accept connections from any ip </p>
<div class="highlight"><pre><span></span>jupyter-notebook --ip<span class="o">=</span>*
</pre></div>
<p>you will get something like </p>
<div class="highlight"><pre><span></span>[W 11:26:45.285 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 11:26:45.342 NotebookApp] Serving notebooks from local directory: /volume2/homes/admin
[I 11:26:45.342 NotebookApp] 0 active kernels
[I 11:26:45.343 NotebookApp] The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/?token=52af33d628881824968b4031967e8541a27cc28b1720c199
[I 11:26:45.343 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 11:26:45.346 NotebookApp] No web browser found: could not locate runnable browser.
[C 11:26:45.347 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://localhost:8888/?token=52af33d628881824968b4031967e8541a27cc28b1720c199
</pre></div>
<p>and if you connect form a remote client (192.168.1.1 in my example), the following line will be added to the output :</p>
<div class="highlight"><pre><span></span>[I 11:26:54.798 NotebookApp] 302 GET /?token=52af33d628881824968b4031967e8541a27cc28b1720c199 (192.168.1.1) 111.17ms
</pre></div>
<p>note that you should only do that if you are the only one using the server because the connection is not encypted.</p>
<h3>From a specific IP</h3>
<p>You can also, explicitly specify the ip of the client</p>
<div class="highlight"><pre><span></span>jupyter-notebook --ip<span class="o">=</span><span class="m">192</span>.168.1.1
</pre></div>
<div class="highlight"><pre><span></span>[I 11:44:58.104 NotebookApp] JupyterLab extension loaded from C:\Users\Guillaume\Miniconda3\lib\site-packages\jupyterlab
[I 11:44:58.104 NotebookApp] JupyterLab application directory is C:\Users\Guillaume\Miniconda3\share\jupyter\lab
[I 11:44:58.244 NotebookApp] Serving notebooks from local directory: C:\Users\Guillaume
[I 11:44:58.245 NotebookApp] 0 active kernels
[I 11:44:58.245 NotebookApp] The Jupyter Notebook is running at: http://192.168.1.1:8888/?token=503576dd8fa87d1f2c416df307e9b900e520b4942e317b32
[I 11:44:58.245 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 11:44:58.258 NotebookApp]
Copy/paste this URL into your browser when you connect for the first time,
to login with a token:
http://192.168.1.1:8888/?token=503576dd8fa87d1f2c416df307e9b900e520b4942e317b32
[I 11:44:59.083 NotebookApp] Accepting one-time-token-authenticated connection from 192.168.1.1
</pre></div>
</div>
<aside>
<div class="bug-reporting__panel">
<h3>Find an error or bug? Have a suggestion?</h3>
<p>Everything on this site is avaliable on GitHub. Head on over and <a href='https://github.com/redoules/redoules.github.io/issues/new'>submit an issue.</a> You can also message me directly by <a href='mailto:guillaume.redoules@gadz.org'>email</a>.</p>
</div>
</aside>
</section>
</div>
<!-- start of footer section -->
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 36 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.
</center>
</p>
</div>
</footer>
<!-- This jQuery line finds any span that contains code highlighting classes and then selects the parent <pre> tag and adds a border. This is done as a workaround to visually distinguish the code inputs and outputs -->
<script>
$( ".hll, .n, .c, .err, .k, .o, .cm, .cp, .c1, .cs, .gd, .ge, .gr, .gh, .gi, .go, .gp, .gs, .gu, .gt, .kc, .kd, .kn, .kp, .kr, .kt, .m, .s, .na, .nb, .nc, .no, .nd, .ni, .ne, .nf, .nl, .nn, .nt, .nv, .ow, .w, .mf, .mh, .mi, .mo, .sb, .sc, .sd, .s2, .se, .sh, .si, .sx, .sr, .s1, .ss, .bp, .vc, .vg, .vi, .il" ).parent( "pre" ).css( "border", "1px solid #DEDEDE" );
</script>
<!-- Load Google Analytics -->
<script>
/*
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function() {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-66582-32', 'auto');
ga('send', 'pageview');
*/
</script>
<!-- End of Google Analytics -->
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="../theme/js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="../theme/js/ie10-viewport-bug-workaround.js"></script>
</body>
</html>

View File

@ -173,7 +173,7 @@ Reversed array : [4 3 2 1 0]
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -192,7 +192,7 @@ Sorted array : [0.13876208 0.19939047 0.40021786 0.43734158 0.46015169]
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -381,7 +381,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -171,7 +171,7 @@ Numpy array with unique values : [10 20 30 40 50 60]
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -151,7 +151,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -112,7 +112,7 @@
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -5,7 +5,7 @@ xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>redoules.github.io/</loc>
<lastmod>2018-11-08T23:40:41-00:00</lastmod>
<lastmod>2018-11-09T23:45:16-00:00</lastmod>
<changefreq>daily</changefreq>
<priority>0.5</priority>
</url>
@ -17,6 +17,13 @@ xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<priority>0.5</priority>
</url>
<url>
<loc>redoules.github.io/blog/Statistics_10days-day2.html</loc>
<lastmod>2018-11-09T20:01:00+01:00</lastmod>
<changefreq>monthly</changefreq>
<priority>0.5</priority>
</url>
<url>
<loc>redoules.github.io/blog/Statistics_10days-day1.html</loc>
<lastmod>2018-11-08T22:22:00+01:00</lastmod>

View File

@ -344,7 +344,7 @@ Done.
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -631,7 +631,7 @@ Done.
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -216,7 +216,7 @@ Done.
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

View File

@ -346,7 +346,7 @@ Done.
<footer class="footer">
<div class="container">
<p class="text-muted">
<center>This project contains 48 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<center>This project contains 49 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
<br/>
Copyright &copy; Guillaume Redoulès,
<time datetime="2018">2018</time>.

File diff suppressed because one or more lines are too long