mirror of
https://github.com/redoules/redoules.github.io.git
synced 2026-03-19 23:44:02 +00:00
added 2 articles
added article on random integer generation and using tensorboard with keras
This commit is contained in:
parent
a862b806bf
commit
c0aa677fc5
@ -185,7 +185,7 @@ Mean : 43117.75, Median : 44627.5, Mode : 4978
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -219,7 +219,7 @@ Q1 : 6.0, Q2 : 12, Q3 : 16.0
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -429,7 +429,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -256,7 +256,7 @@ we call B the event "a blue ball is drawn" and R the event "a red ball is drawn"
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -311,7 +311,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -331,7 +331,7 @@ Between 20 and 22 hours?</p>
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -270,7 +270,7 @@ B = 515.68
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -272,7 +272,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -277,7 +277,7 @@ $$</div>
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -275,7 +275,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -286,7 +286,7 @@ maxuploadtarget=5000
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -161,7 +161,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -142,7 +142,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
333
dl/tensorboard_keras.html
Normal file
333
dl/tensorboard_keras.html
Normal file
@ -0,0 +1,333 @@
|
|||||||
|
<!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>Using tensorboard with Keras - DL</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="Other" />
|
||||||
|
|
||||||
|
|
||||||
|
</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>
|
||||||
|
Using tensorboard with Keras
|
||||||
|
</h1>
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li>
|
||||||
|
<time class="published" datetime="2018-12-03T20:57:00+01:00">
|
||||||
|
03 décembre 2018
|
||||||
|
</time>
|
||||||
|
</li>
|
||||||
|
<li>DL</li>
|
||||||
|
<li>Other</li>
|
||||||
|
</ol>
|
||||||
|
</header>
|
||||||
|
<div class='article_content'>
|
||||||
|
<h2>general workflow</h2>
|
||||||
|
<p>Let's see how we can get tensorboard to work with a Keras-based Tensorflow code.</p>
|
||||||
|
<div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">tensorflow</span> <span class="kn">as</span> <span class="nn">tf</span>
|
||||||
|
<span class="kn">import</span> <span class="nn">keras</span>
|
||||||
|
<span class="kn">import</span> <span class="nn">numpy</span> <span class="kn">as</span> <span class="nn">np</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="highlight"><pre><span></span>Using TensorFlow backend.
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<p>In this example, we will be using the fashion MNIST dataset to do some basic computer vision, where we will train a Keras neural network to classify items of clothing.</p>
|
||||||
|
<p>In order to import the data we will be using the built in function in Keras : </p>
|
||||||
|
<div class="highlight"><pre><span></span><span class="n">keras</span><span class="o">.</span><span class="n">datasets</span><span class="o">.</span><span class="n">fashion_mnist</span><span class="o">.</span><span class="n">load_data</span><span class="p">()</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<p>The model is a very simple neural network consisting in 2 fully connected layers. The model loss function is chosen in order to have a multiclass classifier : "sparse_categorical_crossentropy"</p>
|
||||||
|
<p>Finally, let's train the model for 5 epochs</p>
|
||||||
|
<div class="highlight"><pre><span></span><span class="c1">##get and preprocess the data</span>
|
||||||
|
<span class="n">fashion_mnist</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">datasets</span><span class="o">.</span><span class="n">fashion_mnist</span>
|
||||||
|
<span class="p">(</span><span class="n">train_images</span><span class="p">,</span> <span class="n">train_labels</span><span class="p">),</span> <span class="p">(</span><span class="n">test_images</span><span class="p">,</span> <span class="n">test_labels</span><span class="p">)</span> <span class="o">=</span> <span class="n">fashion_mnist</span><span class="o">.</span><span class="n">load_data</span><span class="p">()</span>
|
||||||
|
<span class="n">train_images</span> <span class="o">=</span> <span class="n">train_images</span> <span class="o">/</span> <span class="mf">255.0</span>
|
||||||
|
<span class="n">test_images</span> <span class="o">=</span> <span class="n">test_images</span> <span class="o">/</span> <span class="mf">255.0</span>
|
||||||
|
|
||||||
|
<span class="c1">## define the model </span>
|
||||||
|
|
||||||
|
<span class="n">model</span> <span class="o">=</span> <span class="n">keras</span><span class="o">.</span><span class="n">Sequential</span><span class="p">([</span>
|
||||||
|
<span class="n">keras</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">Flatten</span><span class="p">(</span><span class="n">input_shape</span><span class="o">=</span><span class="p">(</span><span class="mi">28</span><span class="p">,</span><span class="mi">28</span><span class="p">)),</span>
|
||||||
|
<span class="n">keras</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">Dense</span><span class="p">(</span><span class="mi">128</span><span class="p">,</span> <span class="n">activation</span><span class="o">=</span><span class="s2">"relu"</span><span class="p">),</span>
|
||||||
|
<span class="n">keras</span><span class="o">.</span><span class="n">layers</span><span class="o">.</span><span class="n">Dense</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">activation</span><span class="o">=</span><span class="s2">"softmax"</span><span class="p">)</span>
|
||||||
|
<span class="p">])</span>
|
||||||
|
|
||||||
|
<span class="n">model</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="n">optimizer</span><span class="o">=</span><span class="s2">"adam"</span><span class="p">,</span>
|
||||||
|
<span class="n">loss</span> <span class="o">=</span> <span class="s2">"sparse_categorical_crossentropy"</span><span class="p">,</span>
|
||||||
|
<span class="n">metrics</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"accuracy"</span><span class="p">])</span>
|
||||||
|
|
||||||
|
|
||||||
|
<span class="n">model</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">train_images</span><span class="p">,</span> <span class="n">train_labels</span><span class="p">,</span> <span class="n">epochs</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="highlight"><pre><span></span>Epoch 1/5
|
||||||
|
60000/60000 [==============================] - 9s 143us/step - loss: 0.4939 - acc: 0.8254
|
||||||
|
Epoch 2/5
|
||||||
|
60000/60000 [==============================] - 11s 182us/step - loss: 0.3688 - acc: 0.8661
|
||||||
|
Epoch 3/5
|
||||||
|
60000/60000 [==============================] - 10s 169us/step - loss: 0.3305 - acc: 0.8798
|
||||||
|
Epoch 4/5
|
||||||
|
60000/60000 [==============================] - 21s 350us/step - loss: 0.3079 - acc: 0.8874
|
||||||
|
Epoch 5/5
|
||||||
|
60000/60000 [==============================] - 18s 302us/step - loss: 0.2889 - acc: 0.8927
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
&lt;keras.callbacks.History at 0x235c1bc1be0&gt;
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<p>During the training we can see the process, including the loss and the accuracy in the output.</p>
|
||||||
|
<div class="highlight"><pre><span></span><span class="n">test_loss</span><span class="p">,</span> <span class="n">test_acc</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">evaluate</span><span class="p">(</span><span class="n">test_images</span><span class="p">,</span> <span class="n">test_labels</span><span class="p">)</span>
|
||||||
|
<span class="k">print</span><span class="p">(</span><span class="n">f</span><span class="s2">"Test accuracy : {test_acc}"</span><span class="p">)</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="highlight"><pre><span></span>10000/10000 [==============================] - 1s 67us/step
|
||||||
|
Test accuracy : 0.8763
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<p>When the model finishes training, we get an accuracy of about 87%, and we output some sample predictions</p>
|
||||||
|
<div class="highlight"><pre><span></span><span class="n">predictions</span> <span class="o">=</span> <span class="n">model</span><span class="o">.</span><span class="n">predict</span><span class="p">(</span><span class="n">test_images</span><span class="p">)</span>
|
||||||
|
<span class="k">print</span><span class="p">(</span><span class="n">predictions</span><span class="p">[</span><span class="mi">0</span><span class="p">])</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="highlight"><pre><span></span>[1.8075149e-05 3.6810281e-08 6.3094416e-07 5.1111499e-07 1.6264809e-06
|
||||||
|
3.5973577e-04 1.0840570e-06 3.1453002e-02 1.7062060e-06 9.6816361e-01]
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<p>This kind of process only gives us minimal information during the training process. </p>
|
||||||
|
<h2>Setting up tensorboard</h2>
|
||||||
|
<p>To make it easier to understand, debug, and optimize TensorFlow programs, a suite of visualization tools called TensorBoard is included. You can use TensorBoard to visualize your TensorFlow graph, plot quantitative metrics about the execution of your graph, and show additional data like images that pass through it. When TensorBoard is fully configured, it looks like this:</p>
|
||||||
|
<p><img alt="Tensorboard preview" src="../images/tensorboard/1.png"></p>
|
||||||
|
<p>Let's start by importing the time library and tensorboard itself. It can be found in tensorflow.python.keras.callbacks.</p>
|
||||||
|
<div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">time</span> <span class="kn">import</span> <span class="n">time</span>
|
||||||
|
<span class="kn">from</span> <span class="nn">tensorflow.python.keras.callbacks</span> <span class="kn">import</span> <span class="n">TensorBoard</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<p>After having imported our data and defined our model, we specify a log directory where the training information will get written to. </p>
|
||||||
|
<div class="highlight"><pre><span></span><span class="c1">#keep in mind that we already imported the data and defined the model.</span>
|
||||||
|
|
||||||
|
<span class="n">tensorboard</span> <span class="o">=</span> <span class="n">TensorBoard</span><span class="p">(</span><span class="n">log_dir</span><span class="o">=</span><span class="n">f</span><span class="s2">"logs/{time()}"</span><span class="p">)</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<p>Finally, to tell Keras to call back to TensorBoard we refer to the instant of TensorBoard we created.</p>
|
||||||
|
<div class="highlight"><pre><span></span><span class="n">model</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="n">optimizer</span><span class="o">=</span><span class="s2">"adam"</span><span class="p">,</span>
|
||||||
|
<span class="n">loss</span> <span class="o">=</span> <span class="s2">"sparse_categorical_crossentropy"</span><span class="p">,</span>
|
||||||
|
<span class="n">metrics</span> <span class="o">=</span> <span class="p">[</span><span class="s2">"accuracy"</span><span class="p">])</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<p>Now, we need to execute the TensorBoard command pointing at the log directory previously specified.</p>
|
||||||
|
<div class="highlight"><pre><span></span>tensorboard --logdir<span class="o">=</span>logs/
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<p>TensorBoard will return a http address </p>
|
||||||
|
<div class="highlight"><pre><span></span>TensorBoard 1.12.0 at http://localhost:6006 (Press CTRL+C to quit)
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<p>Now, if we retrain again, we can take a look in TensorBoard and start investigating the loss and accuracy</p>
|
||||||
|
<div class="highlight"><pre><span></span><span class="n">model</span><span class="o">.</span><span class="n">fit</span><span class="p">(</span><span class="n">train_images</span><span class="p">,</span> <span class="n">train_labels</span><span class="p">,</span> <span class="n">epochs</span><span class="o">=</span><span class="mi">5</span><span class="p">,</span> <span class="n">callbacks</span><span class="o">=</span><span class="p">[</span><span class="n">tensorboard</span><span class="p">])</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="highlight"><pre><span></span>Epoch 1/5
|
||||||
|
60000/60000 [==============================] - 41s 684us/step - loss: 0.4990 - acc: 0.8241
|
||||||
|
Epoch 2/5
|
||||||
|
60000/60000 [==============================] - 49s 812us/step - loss: 0.3765 - acc: 0.8648
|
||||||
|
Epoch 3/5
|
||||||
|
60000/60000 [==============================] - 46s 765us/step - loss: 0.3392 - acc: 0.8766
|
||||||
|
Epoch 4/5
|
||||||
|
60000/60000 [==============================] - 48s 794us/step - loss: 0.3135 - acc: 0.8836
|
||||||
|
Epoch 5/5
|
||||||
|
60000/60000 [==============================] - 49s 813us/step - loss: 0.2971 - acc: 0.8897
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
&lt;keras.callbacks.History at 0x235be1c76d8&gt;
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<p><img alt="Tensorboard preview" src="../images/tensorboard/2.png"></p>
|
||||||
|
<p>TensorBoard also give access to a dynamic visualization of the graph</p>
|
||||||
|
<p><img alt="Tensorboard preview" src="../images/tensorboard/3.png"></p>
|
||||||
|
</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 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
|
<br/>
|
||||||
|
Copyright © 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>
|
||||||
BIN
images/tensorboard/1.png
Normal file
BIN
images/tensorboard/1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 80 KiB |
BIN
images/tensorboard/2.PNG
Normal file
BIN
images/tensorboard/2.PNG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 96 KiB |
BIN
images/tensorboard/3.PNG
Normal file
BIN
images/tensorboard/3.PNG
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 107 KiB |
@ -356,7 +356,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<ul>
|
<ul>
|
||||||
<li>Coming soon.</li>
|
<li><a href="./dl/tensorboard_keras.html">Using tensorboard with Keras</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -376,6 +376,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<ul>
|
<ul>
|
||||||
|
<li><a href="./python/randint.html">Random integer</a></li>
|
||||||
<li><a href="./python/counting.html">Counting values in an array</a></li>
|
<li><a href="./python/counting.html">Counting values in an array</a></li>
|
||||||
<li><a href="./python/dict_comprehension.html">Building a dictonnary using comprehension</a></li>
|
<li><a href="./python/dict_comprehension.html">Building a dictonnary using comprehension</a></li>
|
||||||
<li><a href="./python/unique.html">Extracting unique values from a list or an array</a></li>
|
<li><a href="./python/unique.html">Extracting unique values from a list or an array</a></li>
|
||||||
@ -714,7 +715,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -149,7 +149,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -211,7 +211,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -144,7 +144,7 @@ However, you can use the following command to do it </p>
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -143,7 +143,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -203,7 +203,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -148,7 +148,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -167,7 +167,7 @@ none 0 0 0 - /config
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -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">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -172,7 +172,7 @@ USER;PID;%CPU;%MEM;VSZ;RSS;TTY;STAT;START;TIME;COMMAND</p>
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -158,7 +158,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -151,7 +151,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -208,7 +208,7 @@ The secret number is 126
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -160,7 +160,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -234,7 +234,7 @@ Where Y=a+b*X
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -248,7 +248,7 @@ b_2\\
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -1033,7 +1033,7 @@ Top dislike features:
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -196,7 +196,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -256,7 +256,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -233,7 +233,7 @@ So :
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -195,7 +195,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -203,7 +203,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -197,7 +197,7 @@ and B are considered to be independent if event A has no effect on the probabili
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -221,7 +221,7 @@ where <span class="math">\(erf\)</span> is the error function:
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -206,7 +206,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -222,7 +222,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -223,7 +223,7 @@ $$</div>
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -145,7 +145,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -192,7 +192,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -241,7 +241,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -235,7 +235,7 @@ At line 5 there is a plum which is purple and contains 28 kcal
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -378,7 +378,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -168,7 +168,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -192,7 +192,7 @@ If you try to open a non existing file in read mode 'r', a FileNotFoundError wil
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -176,7 +176,7 @@ conda install numpy --channel intel --override-channels
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -237,7 +237,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -186,7 +186,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -171,7 +171,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -339,7 +339,7 @@ However, exporting to a sql database can prove very useful. Indeed, having a wel
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -181,7 +181,7 @@ The number 4 appears 1 times in the list
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -338,7 +338,7 @@ http://127.0.0.1:8787/status</p>
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -148,7 +148,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -232,7 +232,7 @@ The list of dependencies required to test, build and generate the doc are listed
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -164,7 +164,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -218,7 +218,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -177,7 +177,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -213,7 +213,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -248,7 +248,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
205
python/randint.html
Normal file
205
python/randint.html
Normal file
@ -0,0 +1,205 @@
|
|||||||
|
<!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>Random integer - 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>
|
||||||
|
Random integer
|
||||||
|
</h1>
|
||||||
|
<ol class="breadcrumb">
|
||||||
|
<li>
|
||||||
|
<time class="published" datetime="2018-12-03T22:17:00+01:00">
|
||||||
|
03 décembre 2018
|
||||||
|
</time>
|
||||||
|
</li>
|
||||||
|
<li>Python</li>
|
||||||
|
<li>Basics</li>
|
||||||
|
</ol>
|
||||||
|
</header>
|
||||||
|
<div class='article_content'>
|
||||||
|
<p>The random module comes with the randint function that returns a pseudo random number between 2 values :</p>
|
||||||
|
<div class="highlight"><pre><span></span><span class="c1"># Return a random integer N such that a <= N <= b.</span>
|
||||||
|
<span class="n">random</span><span class="o">.</span><span class="n">randint</span><span class="p">(</span><span class="n">a</span><span class="p">,</span> <span class="n">b</span><span class="p">)</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="highlight"><pre><span></span><span class="c1">#### import random</span>
|
||||||
|
|
||||||
|
<span class="n">min_int</span> <span class="o">=</span> <span class="mi">126</span>
|
||||||
|
<span class="n">max_int</span> <span class="o">=</span> <span class="mi">211</span>
|
||||||
|
|
||||||
|
<span class="k">print</span><span class="p">(</span><span class="n">f</span><span class="s2">"My pseudo random number between {min_int} and {max_int} : {random.randint(min_int, max_int)}"</span><span class="p">)</span>
|
||||||
|
</pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="highlight"><pre><span></span>My pseudo random number between 126 and 211 : 206
|
||||||
|
</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 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
|
<br/>
|
||||||
|
Copyright © 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>
|
||||||
@ -173,7 +173,7 @@ Reversed array : [4 3 2 1 0]
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -192,7 +192,7 @@ Sorted array : [0.13876208 0.19939047 0.40021786 0.43734158 0.46015169]
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -381,7 +381,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -171,7 +171,7 @@ Numpy array with unique values : [10 20 30 40 50 60]
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -151,7 +151,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -112,7 +112,7 @@
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
16
sitemap.xml
16
sitemap.xml
@ -5,7 +5,7 @@ xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>redoules.github.io/</loc>
|
<loc>redoules.github.io/</loc>
|
||||||
<lastmod>2018-11-28T23:03:56-00:00</lastmod>
|
<lastmod>2018-12-03T23:11:07-00:00</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
<priority>0.5</priority>
|
<priority>0.5</priority>
|
||||||
</url>
|
</url>
|
||||||
@ -17,6 +17,20 @@ xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|||||||
<priority>0.5</priority>
|
<priority>0.5</priority>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
|
<url>
|
||||||
|
<loc>redoules.github.io/python/randint.html</loc>
|
||||||
|
<lastmod>2018-12-03T22:17:00+01:00</lastmod>
|
||||||
|
<changefreq>monthly</changefreq>
|
||||||
|
<priority>0.5</priority>
|
||||||
|
</url>
|
||||||
|
|
||||||
|
<url>
|
||||||
|
<loc>redoules.github.io/dl/tensorboard_keras.html</loc>
|
||||||
|
<lastmod>2018-12-03T20:57:00+01:00</lastmod>
|
||||||
|
<changefreq>monthly</changefreq>
|
||||||
|
<priority>0.5</priority>
|
||||||
|
</url>
|
||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>redoules.github.io/dl/keras_install.html</loc>
|
<loc>redoules.github.io/dl/keras_install.html</loc>
|
||||||
<lastmod>2018-11-28T22:47:00+01:00</lastmod>
|
<lastmod>2018-11-28T22:47:00+01:00</lastmod>
|
||||||
|
|||||||
@ -344,7 +344,7 @@ Done.
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -631,7 +631,7 @@ Done.
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -216,7 +216,7 @@ Done.
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
@ -346,7 +346,7 @@ Done.
|
|||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p class="text-muted">
|
<p class="text-muted">
|
||||||
<center>This project contains 68 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
<center>This project contains 70 pages and is available on <a href="https://github.com/redoules/redoules.github.io">GitHub</a>.
|
||||||
<br/>
|
<br/>
|
||||||
Copyright © Guillaume Redoulès,
|
Copyright © Guillaume Redoulès,
|
||||||
<time datetime="2018">2018</time>.
|
<time datetime="2018">2018</time>.
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user