<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>algorithms Archivi - Paola Elefante</title>
	<atom:link href="https://paolaelefante.com/category/algorithms/feed/" rel="self" type="application/rss+xml" />
	<link>https://paolaelefante.com/category/algorithms/</link>
	<description>Helping you reconnect with your direction and move forward with confidence</description>
	<lastBuildDate>Wed, 17 Jan 2018 07:23:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.5</generator>
	<item>
		<title>An Advent Calendar for Developers: day 19 to 24</title>
		<link>https://paolaelefante.com/2018/01/advent-calendar-developers-day-19-24/</link>
					<comments>https://paolaelefante.com/2018/01/advent-calendar-developers-day-19-24/#respond</comments>
		
		<dc:creator><![CDATA[Paola Elefante]]></dc:creator>
		<pubDate>Wed, 17 Jan 2018 07:23:08 +0000</pubDate>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[communication]]></category>
		<category><![CDATA[media]]></category>
		<category><![CDATA[teaching]]></category>
		<category><![CDATA[working culture]]></category>
		<guid isPermaLink="false">https://paolaelefante.com/?p=1062</guid>

					<description><![CDATA[<p>I spent the past year or so accumulating nice resources for data scientists and developers, and I've decided to collect them for everyone to enjoy. If you want to get one in your feed every&#8230;</p>
<p>L'articolo <a href="https://paolaelefante.com/2018/01/advent-calendar-developers-day-19-24/">An Advent Calendar for Developers: day 19 to 24</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I spent the past year or so accumulating nice resources for data scientists and developers, and I've decided to collect them for everyone to enjoy. If you want to get one in your feed every day during the Christmas period, make sure to follow my <a href="https://twitter.com/paolaelefante">Twitter</a> or my <a href="https://www.linkedin.com/in/paola-elefante-76062739/">LinkedIn</a> profile. In any case, I'll be collecting them in four batches here on my blog. Find the <a href="https://paolaelefante.com/2017/12/an-advent-calendar-for-developers-1/">first here</a>,  the <a href="https://paolaelefante.com/2017/12/advent-calendar-developers-day-7-12/">second here</a>, the third here, and enjoy here the <a href="https://paolaelefante.com/2017/12/advent-calendar-developers-day-13-18/">last</a>. I hope you all had a wonderful Christmas!</p>
<p><a href="https://www.catalysts.cc/en/wissenswertes/intellij-idea-and-eclipse-shortcuts/"><img fetchpriority="high" decoding="async" class="alignleft wp-image-1069 size-medium" src="https://paolaelefante.com/wp-content/uploads/2018/01/19-300x300.png" alt="" width="300" height="300" data-wp-pid="1069" srcset="https://paolaelefante.com/wp-content/uploads/2018/01/19-300x300.png 300w, https://paolaelefante.com/wp-content/uploads/2018/01/19-150x150.png 150w, https://paolaelefante.com/wp-content/uploads/2018/01/19-768x768.png 768w, https://paolaelefante.com/wp-content/uploads/2018/01/19-60x60.png 60w, https://paolaelefante.com/wp-content/uploads/2018/01/19.png 800w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p><a href="http://books.goalkicker.com/JavaBook/"><img decoding="async" class="alignleft wp-image-1068 size-medium" src="https://paolaelefante.com/wp-content/uploads/2018/01/20-300x300.png" alt="" width="300" height="300" data-wp-pid="1068" srcset="https://paolaelefante.com/wp-content/uploads/2018/01/20-300x300.png 300w, https://paolaelefante.com/wp-content/uploads/2018/01/20-150x150.png 150w, https://paolaelefante.com/wp-content/uploads/2018/01/20-768x768.png 768w, https://paolaelefante.com/wp-content/uploads/2018/01/20-60x60.png 60w, https://paolaelefante.com/wp-content/uploads/2018/01/20.png 800w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p><a href="http://www.devhumor.com/"><img decoding="async" class="alignleft wp-image-1067 size-medium" src="https://paolaelefante.com/wp-content/uploads/2018/01/21-300x300.png" alt="" width="300" height="300" data-wp-pid="1067" srcset="https://paolaelefante.com/wp-content/uploads/2018/01/21-300x300.png 300w, https://paolaelefante.com/wp-content/uploads/2018/01/21-150x150.png 150w, https://paolaelefante.com/wp-content/uploads/2018/01/21-768x768.png 768w, https://paolaelefante.com/wp-content/uploads/2018/01/21-60x60.png 60w, https://paolaelefante.com/wp-content/uploads/2018/01/21.png 800w" sizes="(max-width: 300px) 100vw, 300px" /></a><a href="https://itunes.apple.com/us/podcast/stackify-developer-things/id1322586878?mt=2"><img decoding="async" class="alignleft wp-image-1066 size-medium" src="https://paolaelefante.com/wp-content/uploads/2018/01/22-300x300.png" alt="" width="300" height="300" data-wp-pid="1066" srcset="https://paolaelefante.com/wp-content/uploads/2018/01/22-300x300.png 300w, https://paolaelefante.com/wp-content/uploads/2018/01/22-150x150.png 150w, https://paolaelefante.com/wp-content/uploads/2018/01/22-768x768.png 768w, https://paolaelefante.com/wp-content/uploads/2018/01/22-60x60.png 60w, https://paolaelefante.com/wp-content/uploads/2018/01/22.png 800w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p><a href="https://scrapy.org "><img decoding="async" class="alignleft wp-image-1065 size-medium" src="https://paolaelefante.com/wp-content/uploads/2018/01/23-300x300.png" alt="" width="300" height="300" data-wp-pid="1065" srcset="https://paolaelefante.com/wp-content/uploads/2018/01/23-300x300.png 300w, https://paolaelefante.com/wp-content/uploads/2018/01/23-150x150.png 150w, https://paolaelefante.com/wp-content/uploads/2018/01/23-768x768.png 768w, https://paolaelefante.com/wp-content/uploads/2018/01/23-60x60.png 60w, https://paolaelefante.com/wp-content/uploads/2018/01/23.png 800w" sizes="(max-width: 300px) 100vw, 300px" /></a><a href="http://www.oreilly.com/free/reports.html"><img decoding="async" class="alignleft wp-image-1064 size-medium" src="https://paolaelefante.com/wp-content/uploads/2018/01/24-300x300.png" alt="" width="300" height="300" data-wp-pid="1064" srcset="https://paolaelefante.com/wp-content/uploads/2018/01/24-300x300.png 300w, https://paolaelefante.com/wp-content/uploads/2018/01/24-150x150.png 150w, https://paolaelefante.com/wp-content/uploads/2018/01/24-768x768.png 768w, https://paolaelefante.com/wp-content/uploads/2018/01/24-60x60.png 60w, https://paolaelefante.com/wp-content/uploads/2018/01/24.png 800w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>L'articolo <a href="https://paolaelefante.com/2018/01/advent-calendar-developers-day-19-24/">An Advent Calendar for Developers: day 19 to 24</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://paolaelefante.com/2018/01/advent-calendar-developers-day-19-24/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>An Advent Calendar for Developers: day 13 to 18</title>
		<link>https://paolaelefante.com/2017/12/advent-calendar-developers-day-13-18/</link>
					<comments>https://paolaelefante.com/2017/12/advent-calendar-developers-day-13-18/#respond</comments>
		
		<dc:creator><![CDATA[Paola Elefante]]></dc:creator>
		<pubDate>Tue, 19 Dec 2017 18:04:30 +0000</pubDate>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[communication]]></category>
		<category><![CDATA[data science]]></category>
		<category><![CDATA[neural networks]]></category>
		<category><![CDATA[people]]></category>
		<category><![CDATA[teaching]]></category>
		<category><![CDATA[working culture]]></category>
		<guid isPermaLink="false">https://paolaelefante.com/?p=1049</guid>

					<description><![CDATA[<p>I spent the past year or so accumulating nice resources for data scientists and developers, and I've decided to collect them for everyone to enjoy. If you want to get one in your feed every&#8230;</p>
<p>L'articolo <a href="https://paolaelefante.com/2017/12/advent-calendar-developers-day-13-18/">An Advent Calendar for Developers: day 13 to 18</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I spent the past year or so accumulating nice resources for data scientists and developers, and I've decided to collect them for everyone to enjoy. If you want to get one in your feed every day during the Christmas period, make sure to follow my <a href="https://twitter.com/paolaelefante">Twitter</a> or my <a href="https://www.linkedin.com/in/paola-elefante-76062739/">LinkedIn</a> profile. In any case, I'll be collecting them in four batches here on my blog. Find the <a href="https://paolaelefante.com/2017/12/an-advent-calendar-for-developers-1/">first here</a>,  the <a href="https://paolaelefante.com/2017/12/advent-calendar-developers-day-7-12/">second here</a> and enjoy here the third, Merry Christmas!</p>
<p><a href="http://learnyouahaskell.com"><img decoding="async" class="alignleft wp-image-1055 size-medium" src="https://paolaelefante.com/wp-content/uploads/2017/12/13-300x300.png" alt="" width="300" height="300" data-wp-pid="1055" srcset="https://paolaelefante.com/wp-content/uploads/2017/12/13-300x300.png 300w, https://paolaelefante.com/wp-content/uploads/2017/12/13-150x150.png 150w, https://paolaelefante.com/wp-content/uploads/2017/12/13-768x768.png 768w, https://paolaelefante.com/wp-content/uploads/2017/12/13-60x60.png 60w, https://paolaelefante.com/wp-content/uploads/2017/12/13.png 800w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p><a href="https://www.networkworld.com/article/2926630/linux/11-pointless-but-awesome-linux-terminal-tricks.html#slide1"><img decoding="async" class="alignleft wp-image-1056 size-medium" src="https://paolaelefante.com/wp-content/uploads/2017/12/14-300x300.png" alt="" width="300" height="300" data-wp-pid="1056" srcset="https://paolaelefante.com/wp-content/uploads/2017/12/14-300x300.png 300w, https://paolaelefante.com/wp-content/uploads/2017/12/14-150x150.png 150w, https://paolaelefante.com/wp-content/uploads/2017/12/14-768x768.png 768w, https://paolaelefante.com/wp-content/uploads/2017/12/14-60x60.png 60w, https://paolaelefante.com/wp-content/uploads/2017/12/14.png 800w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="https://www.toptal.com/developers/sorting-algorithms"><img decoding="async" class="alignleft wp-image-1054 size-medium" src="https://paolaelefante.com/wp-content/uploads/2017/12/15-300x300.png" alt="" width="300" height="300" data-wp-pid="1054" srcset="https://paolaelefante.com/wp-content/uploads/2017/12/15-300x300.png 300w, https://paolaelefante.com/wp-content/uploads/2017/12/15-150x150.png 150w, https://paolaelefante.com/wp-content/uploads/2017/12/15-768x768.png 768w, https://paolaelefante.com/wp-content/uploads/2017/12/15-60x60.png 60w, https://paolaelefante.com/wp-content/uploads/2017/12/15.png 800w" sizes="(max-width: 300px) 100vw, 300px" /></a><a href="http://www.tylerlhobbs.com/"><img decoding="async" class="alignleft wp-image-1053 size-medium" src="https://paolaelefante.com/wp-content/uploads/2017/12/16-300x300.png" alt="" width="300" height="300" data-wp-pid="1053" srcset="https://paolaelefante.com/wp-content/uploads/2017/12/16-300x300.png 300w, https://paolaelefante.com/wp-content/uploads/2017/12/16-150x150.png 150w, https://paolaelefante.com/wp-content/uploads/2017/12/16-768x768.png 768w, https://paolaelefante.com/wp-content/uploads/2017/12/16-60x60.png 60w, https://paolaelefante.com/wp-content/uploads/2017/12/16.png 800w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p><a href="https://deeplearning4j.org/opendata"><img decoding="async" class="alignleft wp-image-1057 size-medium" src="https://paolaelefante.com/wp-content/uploads/2017/12/17-1-300x300.png" alt="" width="300" height="300" data-wp-pid="1057" srcset="https://paolaelefante.com/wp-content/uploads/2017/12/17-1-300x300.png 300w, https://paolaelefante.com/wp-content/uploads/2017/12/17-1-150x150.png 150w, https://paolaelefante.com/wp-content/uploads/2017/12/17-1-768x768.png 768w, https://paolaelefante.com/wp-content/uploads/2017/12/17-1-60x60.png 60w, https://paolaelefante.com/wp-content/uploads/2017/12/17-1.png 800w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="http://classicprogrammerpaintings.com/"><img decoding="async" class="alignleft wp-image-1051 size-medium" src="https://paolaelefante.com/wp-content/uploads/2017/12/18-300x300.png" alt="" width="300" height="300" data-wp-pid="1051" srcset="https://paolaelefante.com/wp-content/uploads/2017/12/18-300x300.png 300w, https://paolaelefante.com/wp-content/uploads/2017/12/18-150x150.png 150w, https://paolaelefante.com/wp-content/uploads/2017/12/18-768x768.png 768w, https://paolaelefante.com/wp-content/uploads/2017/12/18-60x60.png 60w, https://paolaelefante.com/wp-content/uploads/2017/12/18.png 800w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>L'articolo <a href="https://paolaelefante.com/2017/12/advent-calendar-developers-day-13-18/">An Advent Calendar for Developers: day 13 to 18</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://paolaelefante.com/2017/12/advent-calendar-developers-day-13-18/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>A small guide to Random Forest - part 2</title>
		<link>https://paolaelefante.com/2016/03/a-small-guide-to-random-forest-part-2/</link>
					<comments>https://paolaelefante.com/2016/03/a-small-guide-to-random-forest-part-2/#comments</comments>
		
		<dc:creator><![CDATA[Paola Elefante]]></dc:creator>
		<pubDate>Thu, 17 Mar 2016 13:04:51 +0000</pubDate>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[experimental math]]></category>
		<category><![CDATA[inverse problems]]></category>
		<category><![CDATA[mathematics]]></category>
		<category><![CDATA[research]]></category>
		<guid isPermaLink="false">https://paolaelefante.com/?p=840</guid>

					<description><![CDATA[<p>This is the second part of a simple and brief guide to the Random Forest algorithm and its implementation in R. If you missed Part I, you can find it here. randomForest in R R&#8230;</p>
<p>L'articolo <a href="https://paolaelefante.com/2016/03/a-small-guide-to-random-forest-part-2/">A small guide to Random Forest - part 2</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>This is the second part of a simple and brief guide to the Random Forest algorithm and its implementation in R. If you missed Part I, you can find it <a href="https://paolaelefante.com/2016/03/random-forest-part1/" target="_blank">here</a>.</p>
<h4>randomForest in R</h4>
<p>R has a <a href="https://cran.r-project.org/web/packages/randomForest/randomForest.pdf" target="_blank">package called randomForest</a> which contains a randomForest function. If you want to explore in depth this implementation, I suggest to read <a href="https://www.stat.berkeley.edu/~breiman/RandomForests/cc_home.htm" target="_blank">the support webpage</a>. Here I'd like to show the use of few parameters in the R function. I will here use the <a href="https://www.kaggle.com/c/titanic/data" target="_blank">Titanic dataset</a> from <a href="http://www.kaggle.com" target="_blank">Kaggle</a> to explore some functions and parameters in randomForest. The problem consists in predicting the survival of passengers, based on some data about them.</p>
<pre>library(randomForest)
my_formula &lt;- factor(Survived) ~ Sex + Pclass + Parch + SibSp + Embarked
my_forest &lt;- randomForest(my_formula, data = train, ntree = 400, mtry = 3 )</pre>
<p>Here I tuned the number of tree to grow with <em>ntree</em> (standard value is 500). The variable <em>mtry</em> specifies how many random features will be selected to grow a single tree. Here I chose <em>mtry = 3</em>, meaning that three features in the set {<em>Sex</em>, <em>Pclass</em>, <em>Parch</em>, <em>SibSp</em>, <em>Embarked</em>} will be randomly chosen every time a tree is grown. If I type:</p>
<pre>my_forest</pre>
<p>I get a briefing of the variables and the trained model:</p>
<pre>Call:
 randomForest(formula = my_formula, data = train, ntree = 400, mtry = 3) 
 Type of random forest: classification
 Number of trees: 400
No. of variables tried at each split: 3</pre>
<pre>OOB estimate of error rate: 19.85%
Confusion matrix:
 0 1 class.error
0 442 47 0.09611452
1 110 192 0.36423841</pre>
<p>The OOB (out-of-bag) error is complementary to the accuracy, and it's here calculated as the ratio: <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_5ecc38a605e00460435e1db9249bcb7a.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>. Look at the confusion matrix, which summarise how many cases were guessed right from our model. On the principal diagonal we can see the cases which are predicted well from <em>my_forest</em>. Indeed, we get: <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_c32d6823074be23a1b087b37794c54df.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script> which corresponds to the OOB error of <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_22a592413cedb07f61fccd2510bec021.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>. This is equivalent to saying that the accuracy of our model is <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_9ddf69f2ed89bf88bb6454ddaffb7c51.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>. OOB error is calculated for each tree and you can access to such values by typing:</p>
<pre>my_forest$err.rate</pre>
<p>Nerdy note: notice that the OOB error of the model is not the mean of <em>my_forest$err.rate</em>. They are calculated differently!<br />
Another nice parameter is <em>sampsize</em>, meaning controlling how many rows of the dataframe will get selected to build a single tree:</p>
<pre>my_forest &lt;- randomForest(my_formula, data = train, ntree = 1000, mtry = 2, sampsize = (0.9*nrow(train)), replace=TRUE )</pre>
<p>Here I asked that <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_e695a8421cc7f79ac872e765ffa31bd9.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script> of data is used for each tree. In addition, I set <em>replace = TRUE</em>, meaning that one row may be chosen more than once.</p>
<p>One nice aspect of randomForest is the variable importance, which can turn out very useful in feature engineering. If you type, for instance:</p>
<pre>my_forest &lt;- randomForest(my_formula, data = train, ntree = 400, importance = TRUE) 
varImpPlot(my_forest)</pre>
<p>you'll get a plot as follows.</p>
<p><a href="https://paolaelefante.com/wp-content/uploads/2016/03/my_varImpPlot.png"><img decoding="async" class="aligncenter wp-image-859 size-large" src="https://paolaelefante.com/wp-content/uploads/2016/03/my_varImpPlot-1024x511.png" alt="my_varImpPlot" width="648" height="323" srcset="https://paolaelefante.com/wp-content/uploads/2016/03/my_varImpPlot-1024x511.png 1024w, https://paolaelefante.com/wp-content/uploads/2016/03/my_varImpPlot-300x150.png 300w, https://paolaelefante.com/wp-content/uploads/2016/03/my_varImpPlot-800x399.png 800w, https://paolaelefante.com/wp-content/uploads/2016/03/my_varImpPlot-1200x599.png 1200w, https://paolaelefante.com/wp-content/uploads/2016/03/my_varImpPlot.png 1499w" sizes="(max-width: 648px) 100vw, 648px" /></a></p>
<p>&nbsp;</p>
<p>The importance of each feature is measured in two ways, as described by <a href="https://cran.r-project.org/web/packages/randomForest/randomForest.pdf" target="_blank">documentation</a>:</p>
<div class="page" title="Page 6">
<div class="layoutArea">
<div class="column">
<blockquote><p>Here are the definitions of the variable importance measures. The first measure is computed from permuting OOB data: For each tree, the prediction error on the out-of-bag portion of the data is recorded (error rate for classification, MSE for regression). Then the same is done after permuting each predictor variable. The difference between the two are then averaged over all trees, and nor- malized by the standard deviation of the differences. If the standard deviation of the differences is equal to 0 for a variable, the division is not done (but the average is almost always equal to 0 in that case).</p>
<p>The second measure is the total decrease in node impurities from splitting on the variable, averaged over all trees. For classification, the node impurity is measured by the <a href="https://en.wikipedia.org/wiki/Gini_coefficient" target="_blank">Gini index</a>. For regression, it is measured by residual sum of squares.</p></blockquote>
<p>Another possible choice is to set <em>localImp = TRUE</em>, and see how much each feature influenced the output of each single row. For example, here is the importance of <em>Sex</em> in our model:</p>
<p><a href="https://paolaelefante.com/wp-content/uploads/2016/03/localImpSex.png"><img decoding="async" class="aligncenter size-medium wp-image-861" src="https://paolaelefante.com/wp-content/uploads/2016/03/localImpSex-300x150.png" alt="localImpSex" width="300" height="150" srcset="https://paolaelefante.com/wp-content/uploads/2016/03/localImpSex-300x150.png 300w, https://paolaelefante.com/wp-content/uploads/2016/03/localImpSex-1024x511.png 1024w, https://paolaelefante.com/wp-content/uploads/2016/03/localImpSex-800x399.png 800w, https://paolaelefante.com/wp-content/uploads/2016/03/localImpSex-1200x599.png 1200w, https://paolaelefante.com/wp-content/uploads/2016/03/localImpSex.png 1499w" sizes="(max-width: 300px) 100vw, 300px" /></a></p>
<p>&nbsp;</p>
</div>
</div>
</div>
<h4>Things to keep in mind</h4>
<p>The R package randomForest allows to evaluate variable importance (in randomForest, set the parameter importance = TRUE, save the function output and pass it to varImpPlot()). However, keep in mind the following:</p>
<blockquote><p>For data including categorical variables with different number of levels, random forests are biased in favor of those attributes with more levels. Methods such as partial permutations and growing unbiased trees can be used to solve the problem. (source: <a href="https://en.wikipedia.org/wiki/Random_forest" target="_blank">Wikipedia</a>)</p></blockquote>
<p>How many trees should one grow? In principle, the more the merrier. However, the information gain after a certain number is not worth the additional computational cost. The <a href="http://www.amazon.com/gp/product/0123748569?keywords=Data%20Mining%20by%20Witten&amp;qid=1458217272&amp;ref_=sr_1_1&amp;sr=8-1" target="_blank">computational complexity</a> of Random Forest is <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_da399f21ca9990c6da26a253cd276f5b.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>, where <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_69691c7bdcc3ce6d5d8a1361f22d04ac.gif' style='vertical-align: middle; border: none; padding-bottom:1px;' class='tex' alt="" /></span><script type='math/tex'></script> is <em>ntree</em>, <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_6f8f57715090da2632453988d9a1501b.gif' style='vertical-align: middle; border: none; padding-bottom:2px;' class='tex' alt="" /></span><script type='math/tex'></script> is <em>mtry</em> and <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_7b8b965ad4bca0e41ab51de7b31363a1.gif' style='vertical-align: middle; border: none; padding-bottom:2px;' class='tex' alt="" /></span><script type='math/tex'></script> is <em>sampsize</em>.</p>
<figure id="attachment_857" aria-describedby="caption-attachment-857" style="width: 648px" class="wp-caption aligncenter"><a href="https://paolaelefante.com/wp-content/uploads/2016/03/Ntree_plot.png"><img decoding="async" class="size-large wp-image-857" src="https://paolaelefante.com/wp-content/uploads/2016/03/Ntree_plot-1024x511.png" alt="I ran randomForest, changing ntree from 100 to 20 000, with a step of 100. After ntree = 5000 the OOB error has a 0.5% oscillation, showing that computational cost is too big compared to a gain in accuracy." width="648" height="323" srcset="https://paolaelefante.com/wp-content/uploads/2016/03/Ntree_plot-1024x511.png 1024w, https://paolaelefante.com/wp-content/uploads/2016/03/Ntree_plot-300x150.png 300w, https://paolaelefante.com/wp-content/uploads/2016/03/Ntree_plot-800x399.png 800w, https://paolaelefante.com/wp-content/uploads/2016/03/Ntree_plot-1200x599.png 1200w, https://paolaelefante.com/wp-content/uploads/2016/03/Ntree_plot.png 1499w" sizes="(max-width: 648px) 100vw, 648px" /></a><figcaption id="caption-attachment-857" class="wp-caption-text">I ran randomForest, changing ntree from 100 to 20 000, with a step of 100. After ntree = 5000 the OOB error has a 0.5% oscillation, showing that computational cost is too big compared to a gain in accuracy.</figcaption></figure>
<p>Another question is: how deep should I grow a tree? This is an interesting issue. Growing a superficial tree may lead to underfitting, while a too deep tree may cause overfitting. One idea to test the optimal value is to experiment with some very deep trees and observe how the accuracy behaves on its subsets.</p>
<figure id="attachment_862" aria-describedby="caption-attachment-862" style="width: 648px" class="wp-caption aligncenter"><a href="https://paolaelefante.com/wp-content/uploads/2016/03/nodesize_plot.png"><img decoding="async" class="size-large wp-image-862" src="https://paolaelefante.com/wp-content/uploads/2016/03/nodesize_plot-1024x511.png" alt="Here I experimented with nodesize = 1, 2, ..., 30 and checked the corresponding OOB error." width="648" height="323" srcset="https://paolaelefante.com/wp-content/uploads/2016/03/nodesize_plot-1024x511.png 1024w, https://paolaelefante.com/wp-content/uploads/2016/03/nodesize_plot-300x150.png 300w, https://paolaelefante.com/wp-content/uploads/2016/03/nodesize_plot-1200x599.png 1200w, https://paolaelefante.com/wp-content/uploads/2016/03/nodesize_plot-800x399.png 800w, https://paolaelefante.com/wp-content/uploads/2016/03/nodesize_plot.png 1499w" sizes="(max-width: 648px) 100vw, 648px" /></a><figcaption id="caption-attachment-862" class="wp-caption-text">Here I experimented with nodesize = 1, 2, ..., 30 and checked the corresponding OOB error. The minimum is attained at nodesize = 25. Given the oscillations, this is a less trivial choice than the number of trees, but experimenting takes less computational time.</figcaption></figure>
<p><span style="color: #808080;">The featured image was found <a style="color: #808080;" href="http://luc.devroye.org/lucsforest2008/" target="_blank">on this webpage</a>.</span></p>
<p>L'articolo <a href="https://paolaelefante.com/2016/03/a-small-guide-to-random-forest-part-2/">A small guide to Random Forest - part 2</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://paolaelefante.com/2016/03/a-small-guide-to-random-forest-part-2/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>A small guide to Random Forest - part 1</title>
		<link>https://paolaelefante.com/2016/03/random-forest-part1/</link>
					<comments>https://paolaelefante.com/2016/03/random-forest-part1/#comments</comments>
		
		<dc:creator><![CDATA[Paola Elefante]]></dc:creator>
		<pubDate>Fri, 11 Mar 2016 10:23:22 +0000</pubDate>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[experimental math]]></category>
		<category><![CDATA[inverse problems]]></category>
		<category><![CDATA[mathematics]]></category>
		<category><![CDATA[research]]></category>
		<guid isPermaLink="false">https://paolaelefante.com/?p=809</guid>

					<description><![CDATA[<p>I've recently started playing with Kaggle and got curious about one of the most famous classification/regression framework, Random Forest. In a problem of classification or regression, several random decision trees (a "forest") are built and&#8230;</p>
<p>L'articolo <a href="https://paolaelefante.com/2016/03/random-forest-part1/">A small guide to Random Forest - part 1</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>I've recently started playing with Kaggle and got curious about one of the most famous classification/regression framework, <a href="https://en.wikipedia.org/wiki/Random_forest" target="_blank">Random Forest</a>. In a problem of classification or regression, several random decision trees (a "forest") are built and at the end the outputs are combined ("<em><a href="https://en.wikipedia.org/wiki/Bootstrap_aggregating" target="_blank">bagging</a></em>"). The intuition is that randomness and a meaningful quantity of trees will avoid over- and underfitting. One possible bagging technique is the majority vote. Take the case of predicting a binary outcome, say a random variable Y which can assume only values in <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_61134e14c74e988c00b65fd7785c9984.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>, with respect to some features <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_83086b608f74ceffa6b0f5764743fca1.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script> (occurred events). We assume there exist a correct answer - the "right model" - which we have to predict. The intuition of the majority vote is that if such "divine truth" exists and we build several "quite reasonable" models, <em>most</em> of them will give the right prediction. If the right value is <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_70834fa19d2b7e7068b7403f87acf573.gif' style='vertical-align: middle; border: none; padding-bottom:1px;' class='tex' alt="" /></span><script type='math/tex'></script> and we make <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_7b8b965ad4bca0e41ab51de7b31363a1.gif' style='vertical-align: middle; border: none; padding-bottom:2px;' class='tex' alt="" /></span><script type='math/tex'></script> "reasonable" predictions <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_b55ceca0bf0f99b0783951f797815152.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>, most of them will be equal to 1 and only a minority will be equal to -1. In mathematical terms, we'll choose the following prediction:</p>
<p>(1)<span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_147a753c53b4a4df52cc9675a1fc0a35.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script></p>
<p>Bagging is done in other ways, but to me the majority vote example is an easy way to understand the fundamental concept.<br />
The Random Forest framework was introduced by statistician <a href="https://en.wikipedia.org/wiki/Leo_Breiman" target="_blank">Leo Breiman</a> in 2001 in <a href="https://dx.doi.org/10.1023%2FA%3A1010933404324" target="_blank">his seminal paper</a>. Even though implementations have been released in many languages (<a href="https://cran.r-project.org/web/packages/randomForest/randomForest.pdf" target="_blank">R</a>, <a href="http://www.mathworks.com/matlabcentral/fileexchange/31036-random-forest" target="_blank">MatLab</a>, <a href="http://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html" target="_blank">Python</a>, <a href="http://java-ml.sourceforge.net/api/0.1.0/net/sf/javaml/classification/tree/RandomForest.html" target="_blank">Java</a>...), it's important to learn the basics, to be able to tune the parameters well.</p>
<h4>Decision trees</h4>
<p>The elements of a Random Forest are usually decision trees (there are variants of the framework, though). Assume we have the following database:<br />
training data =<span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_c8563dc20b23058ec69d762661f0636c.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script><br />
Each column is a sample, each row corresponds to a feature. We consider a binary output: <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_6605b7cda935a656aa7b259d8edce720.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>. We now will choose <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_9db69d5e593037ce789f9befbb30b353.gif' style='vertical-align: middle; border: none; padding-bottom:1px;' class='tex' alt="" /></span><script type='math/tex'></script> random features (to be able to represent the problem in the plane) and will start building a decision tree. Assume our random sample is:<br />
random sample =<span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_757dc14f0878187aadb7b774dc8da25a.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script><br />
meaning that we randomly selected the features 1 and 3. Let's represent these points on a plane, assigning a different color on the base of the associate output.</p>
<p><a href="https://paolaelefante.com/wp-content/uploads/2016/03/DecTree_firstplot.png"><img decoding="async" class="aligncenter size-large wp-image-821" src="https://paolaelefante.com/wp-content/uploads/2016/03/DecTree_firstplot-1024x511.png" alt="DecTree_firstplot" width="648" height="323" srcset="https://paolaelefante.com/wp-content/uploads/2016/03/DecTree_firstplot-1024x511.png 1024w, https://paolaelefante.com/wp-content/uploads/2016/03/DecTree_firstplot-300x150.png 300w, https://paolaelefante.com/wp-content/uploads/2016/03/DecTree_firstplot-800x399.png 800w, https://paolaelefante.com/wp-content/uploads/2016/03/DecTree_firstplot-1200x599.png 1200w, https://paolaelefante.com/wp-content/uploads/2016/03/DecTree_firstplot.png 1499w" sizes="(max-width: 648px) 100vw, 648px" /></a></p>
<p>&nbsp;</p>
<p>Notice the distribution of points in this universal region:</p>
<figure id="attachment_830" aria-describedby="caption-attachment-830" style="width: 300px" class="wp-caption aligncenter"><a href="https://paolaelefante.com/wp-content/uploads/2016/03/FirstDist1.png"><img decoding="async" class="size-medium wp-image-830" src="https://paolaelefante.com/wp-content/uploads/2016/03/FirstDist1-300x150.png" alt="Frequency of output value in the universal region: red corresponds to value 0, blue to 1." width="300" height="150" srcset="https://paolaelefante.com/wp-content/uploads/2016/03/FirstDist1-300x150.png 300w, https://paolaelefante.com/wp-content/uploads/2016/03/FirstDist1-1024x511.png 1024w, https://paolaelefante.com/wp-content/uploads/2016/03/FirstDist1-800x399.png 800w, https://paolaelefante.com/wp-content/uploads/2016/03/FirstDist1-1200x599.png 1200w, https://paolaelefante.com/wp-content/uploads/2016/03/FirstDist1.png 1499w" sizes="(max-width: 300px) 100vw, 300px" /></a><figcaption id="caption-attachment-830" class="wp-caption-text">Frequency of output value in the universal region: red corresponds to value 0, blue to 1.</figcaption></figure>
<p>Now an hyperplane <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_8b475aba0115f67a9c0f88a51222f71d.gif' style='vertical-align: middle; border: none; padding-bottom:1px;' class='tex' alt="" /></span><script type='math/tex'></script> is selected (randomly or with some criteria, for instance maximising information gain) and the points are separated into two regions:</p>
<p><a href="https://paolaelefante.com/wp-content/uploads/2016/03/FirstLine.png"><img decoding="async" class="aligncenter size-large wp-image-828" src="https://paolaelefante.com/wp-content/uploads/2016/03/FirstLine-1024x511.png" alt="FirstLine" width="648" height="323" srcset="https://paolaelefante.com/wp-content/uploads/2016/03/FirstLine-1024x511.png 1024w, https://paolaelefante.com/wp-content/uploads/2016/03/FirstLine-300x150.png 300w, https://paolaelefante.com/wp-content/uploads/2016/03/FirstLine-800x399.png 800w, https://paolaelefante.com/wp-content/uploads/2016/03/FirstLine-1200x599.png 1200w, https://paolaelefante.com/wp-content/uploads/2016/03/FirstLine.png 1499w" sizes="(max-width: 648px) 100vw, 648px" /></a></p>
<p style="text-align: left;">Our decision tree starts and we have the following split and new frequency distributions in the two new regions:</p>
<p style="text-align: center;"><strong>START</strong></p>

<a href='https://paolaelefante.com/2016/03/random-forest-part1/region1_dist/'><img decoding="async" width="300" height="150" src="https://paolaelefante.com/wp-content/uploads/2016/03/Region1_Dist-300x150.png" class="attachment-medium size-medium" alt="" srcset="https://paolaelefante.com/wp-content/uploads/2016/03/Region1_Dist-300x150.png 300w, https://paolaelefante.com/wp-content/uploads/2016/03/Region1_Dist-1024x511.png 1024w, https://paolaelefante.com/wp-content/uploads/2016/03/Region1_Dist-800x399.png 800w, https://paolaelefante.com/wp-content/uploads/2016/03/Region1_Dist-1200x599.png 1200w, https://paolaelefante.com/wp-content/uploads/2016/03/Region1_Dist.png 1499w" sizes="(max-width: 300px) 100vw, 300px" /></a>
<a href='https://paolaelefante.com/2016/03/random-forest-part1/region2_dist/'><img decoding="async" width="300" height="150" src="https://paolaelefante.com/wp-content/uploads/2016/03/Region2_dist-300x150.png" class="attachment-medium size-medium" alt="" srcset="https://paolaelefante.com/wp-content/uploads/2016/03/Region2_dist-300x150.png 300w, https://paolaelefante.com/wp-content/uploads/2016/03/Region2_dist-1024x511.png 1024w, https://paolaelefante.com/wp-content/uploads/2016/03/Region2_dist-800x399.png 800w, https://paolaelefante.com/wp-content/uploads/2016/03/Region2_dist-1200x599.png 1200w, https://paolaelefante.com/wp-content/uploads/2016/03/Region2_dist.png 1499w" sizes="(max-width: 300px) 100vw, 300px" /></a>

<p>Now the idea is to iterate this procedure separately on each branch. For instance, we consider only Region 1 (<span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_10a6699ab786fb34e81f63a8414c0cf8.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>) and draw another hyperplane, say <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_7c7d08f807a92b34206de46693612f43.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>:</p>
<p><a href="https://paolaelefante.com/wp-content/uploads/2016/03/SecondSplit.png"><img decoding="async" class="aligncenter wp-image-834 size-large" src="https://paolaelefante.com/wp-content/uploads/2016/03/SecondSplit-1024x511.png" alt="SecondSplit" width="648" height="323" srcset="https://paolaelefante.com/wp-content/uploads/2016/03/SecondSplit-1024x511.png 1024w, https://paolaelefante.com/wp-content/uploads/2016/03/SecondSplit-300x150.png 300w, https://paolaelefante.com/wp-content/uploads/2016/03/SecondSplit-800x399.png 800w, https://paolaelefante.com/wp-content/uploads/2016/03/SecondSplit-1200x599.png 1200w, https://paolaelefante.com/wp-content/uploads/2016/03/SecondSplit.png 1499w" sizes="(max-width: 648px) 100vw, 648px" /></a></p>
<p>&nbsp;</p>
<p>On the other branch, we draw another hyperplane <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_2ffcb0d7ef633be0124c366b71242f7b.gif' style='vertical-align: middle; border: none; padding-bottom:1px;' class='tex' alt="" /></span><script type='math/tex'></script>:<br />
<a href="https://paolaelefante.com/wp-content/uploads/2016/03/ThirdSplit.png"><img decoding="async" class="aligncenter size-large wp-image-835" src="https://paolaelefante.com/wp-content/uploads/2016/03/ThirdSplit-1024x511.png" alt="ThirdSplit" width="648" height="323" srcset="https://paolaelefante.com/wp-content/uploads/2016/03/ThirdSplit-1024x511.png 1024w, https://paolaelefante.com/wp-content/uploads/2016/03/ThirdSplit-300x150.png 300w, https://paolaelefante.com/wp-content/uploads/2016/03/ThirdSplit-800x399.png 800w, https://paolaelefante.com/wp-content/uploads/2016/03/ThirdSplit-1200x599.png 1200w, https://paolaelefante.com/wp-content/uploads/2016/03/ThirdSplit.png 1499w" sizes="(max-width: 648px) 100vw, 648px" /></a></p>
<p>&nbsp;</p>
<p>Summing up, we built the following tree.</p>
<p>&nbsp;</p>
<p><a href="https://paolaelefante.com/wp-content/uploads/2016/03/Decision_Tree.png"><img decoding="async" class="aligncenter size-full wp-image-837" src="https://paolaelefante.com/wp-content/uploads/2016/03/Decision_Tree.png" alt="Decision_Tree" width="866" height="472" srcset="https://paolaelefante.com/wp-content/uploads/2016/03/Decision_Tree.png 866w, https://paolaelefante.com/wp-content/uploads/2016/03/Decision_Tree-300x164.png 300w, https://paolaelefante.com/wp-content/uploads/2016/03/Decision_Tree-750x410.png 750w, https://paolaelefante.com/wp-content/uploads/2016/03/Decision_Tree-800x436.png 800w" sizes="(max-width: 866px) 100vw, 866px" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>At this point clearly we can stop. We divided the plane in regions which completely classify our training data.<br />
To summarise, here are the steps of Random Forest:</p>
<ol>
<li>For k = 1, 2, ..., Ntrees:<br />
--&gt; select a bootstrap sample S from training data<br />
--&gt; grow a decision tree <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_8b0f55b15c05710c97a6c3df6649d3a7.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script> (with a stopping criterion for the depth)</li>
<li>Bagging on <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_07489d372d49673a93896e3eb8a19d62.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script></li>
</ol>
<p>Next, I plan to show the use of some variables and features of the randomForest R package and to make some observations on the algorithm. For instance, how to choose Ntrees? How to determine a reasonable stopping criterion for the tree depth?</p>
<p><span style="color: #808080;">The featured image is an excuse to introduce a great visualisation resource for Random Forests: <a style="color: #808080;" href="http://www.rhaensch.de/vrf.html" target="_blank">check it out</a>.</span></p>
<p>L'articolo <a href="https://paolaelefante.com/2016/03/random-forest-part1/">A small guide to Random Forest - part 1</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://paolaelefante.com/2016/03/random-forest-part1/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>Open Data: CT datasets and prototypes</title>
		<link>https://paolaelefante.com/2016/02/open-data-ct-prototypes/</link>
					<comments>https://paolaelefante.com/2016/02/open-data-ct-prototypes/#respond</comments>
		
		<dc:creator><![CDATA[Paola Elefante]]></dc:creator>
		<pubDate>Mon, 22 Feb 2016 18:41:22 +0000</pubDate>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[experimental math]]></category>
		<category><![CDATA[inverse problems]]></category>
		<category><![CDATA[mathematics]]></category>
		<category><![CDATA[measurements]]></category>
		<category><![CDATA[physics]]></category>
		<category><![CDATA[research]]></category>
		<guid isPermaLink="false">https://paolaelefante.com/?p=780</guid>

					<description><![CDATA[<p>In my research work, I often find it difficult to get datasets for X-ray CT for method validation, neither simulated and real data. Of course, there's the classic Shepp-Logan phantom, but in many cases it would&#8230;</p>
<p>L'articolo <a href="https://paolaelefante.com/2016/02/open-data-ct-prototypes/">Open Data: CT datasets and prototypes</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In my research work, I often find it difficult to get datasets for X-ray CT for method validation, neither simulated and real data. Of course, there's the classic <a href="https://en.wikipedia.org/wiki/Shepp–Logan_phantom" target="_blank">Shepp-Logan phantom</a>, but in many cases it would save a lot of work to download datasets to test one's methods. As for my knowledge, there is no broad known repository. In the image processing community there are the classical Lena, Barbara pictures, but I am not aware of similar common testing grounds in the X-ray CT one. In many cases the final goal is to apply the developed methods to a particular application case, so datasets are available from a company or a hospital repository. However, I think it would be useful to have a "middle step" and test on simpler phantoms before getting to the real deal. Many applied mathematicians often stop at this middle step, since going further would be out of scope for them. I hope this collection will be useful to others.</p>
<p>Since 3D printing is quite easy and inexpensive nowadays (can be done even in public libraries often), I used a the free software <a href="http://www.123dapp.com" target="_blank">Autodesk 123D</a> to design some 3D printable prototypes for static and dynamic CT. I am here sharing both the ready-made STL file (ready to be printed) and the 123D-project file, in case someone wants to do some personal edits. Anything can be freely use, just please quote the author and the source.</p>
<p>If you are aware of other open data repositories for CT or would like to share suggestions, feel free to comment below. I will update this post and the shared repositories in the future (<span style="color: #3366ff;">last update: Feb 22nd, 2016</span>).</p>
<h3>Static CT open data</h3>
<p><span style="color: #ff6600;">[real data]</span> <a href="http://www.fips.fi/dataset.php" target="_blank">Tomographic data of a walnut</a>: open dataset from FIPS, authors are indicated at the webpage.</p>
<p><span style="color: #ff6600;">[real data]</span> <a href="https://drive.google.com/folderview?id=0B6lIDeNkQfBwT2ZpNURGbnh0NzQ&amp;usp=sharing" target="_blank">3D printable simple phantom prototype</a>: to test contrast agents, geometry preservation of reconstruction method, how different attenuation values are reconstructed. Please quote the author (Paola Elefante) and the link to this post as a source.</p>
<p><span style="color: #ff6600;">[real data]</span> <a href="https://drive.google.com/folderview?id=0B6lIDeNkQfBwblB3N2lBNG1YOTg&amp;usp=sharing" target="_blank">3D printable blood vessels prototype</a>: to test a realistic static geometry of blood vessels splitting in capillaries. Please quote the author (Paola Elefante) and the link to this post as a source.</p>
<figure id="attachment_781" aria-describedby="caption-attachment-781" style="width: 300px" class="wp-caption aligncenter"><a href="https://paolaelefante.com/wp-content/uploads/2016/02/veins_static_CT_pic.png"><img decoding="async" class="wp-image-781 size-medium" src="https://paolaelefante.com/wp-content/uploads/2016/02/veins_static_CT_pic-300x281.png" alt="veins_static_CT_pic" width="300" height="281" srcset="https://paolaelefante.com/wp-content/uploads/2016/02/veins_static_CT_pic-300x281.png 300w, https://paolaelefante.com/wp-content/uploads/2016/02/veins_static_CT_pic.png 579w" sizes="(max-width: 300px) 100vw, 300px" /></a><figcaption id="caption-attachment-781" class="wp-caption-text">The static CT blood vessels prototype.</figcaption></figure>
<h3>Dynamic CT open data</h3>
<p><span style="color: #ff6600;">[real data]</span> <a href="http://dir-lab.com" target="_blank">DirLab repository</a>: a open data repository, mostly for image registration researchers.</p>
<p><span style="color: #ff6600;">[real data]</span> <a href="https://drive.google.com/folderview?id=0B6lIDeNkQfBwNjlQM1lpdzVTMTQ&amp;usp=sharing" target="_blank">3D printable dynamic blood vessels prototype</a>:  to test a realistic dynamic simulation of blood or fluid flowing. In the featured picture you can spot an old version of this prototype. I made some major edits in the design, but I still did not test it. Please quote the author (Paola Elefante) and the link to this post as a source.</p>
<figure id="attachment_786" aria-describedby="caption-attachment-786" style="width: 252px" class="wp-caption aligncenter"><a href="https://paolaelefante.com/wp-content/uploads/2016/02/dyn_blood_vessels.png"><img decoding="async" class="size-medium wp-image-786" src="https://paolaelefante.com/wp-content/uploads/2016/02/dyn_blood_vessels-252x300.png" alt="Design of the prototype for 2D dynamic CT." width="252" height="300" srcset="https://paolaelefante.com/wp-content/uploads/2016/02/dyn_blood_vessels-252x300.png 252w, https://paolaelefante.com/wp-content/uploads/2016/02/dyn_blood_vessels.png 552w" sizes="(max-width: 252px) 100vw, 252px" /></a><figcaption id="caption-attachment-786" class="wp-caption-text">Design of the prototype for 2D dynamic CT.</figcaption></figure>
<p><span style="color: #3366ff;">[simulated data]</span> <a href="https://drive.google.com/folderview?id=0B6lIDeNkQfBwY3dXOTV1NWN5YXM&amp;usp=sharing" target="_blank">2D dynamic "Y-phantom"</a>: a binary phantom where meaningful topological changes happen, good for interface detection methods (level-set, etc.).</p>
<p>L'articolo <a href="https://paolaelefante.com/2016/02/open-data-ct-prototypes/">Open Data: CT datasets and prototypes</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://paolaelefante.com/2016/02/open-data-ct-prototypes/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Mathematicians Go Hollywood</title>
		<link>https://paolaelefante.com/2015/11/level-set-methods/</link>
					<comments>https://paolaelefante.com/2015/11/level-set-methods/#respond</comments>
		
		<dc:creator><![CDATA[Paola Elefante]]></dc:creator>
		<pubDate>Fri, 27 Nov 2015 07:31:57 +0000</pubDate>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[experimental math]]></category>
		<category><![CDATA[mathematics]]></category>
		<category><![CDATA[physics]]></category>
		<category><![CDATA[research]]></category>
		<category><![CDATA[talks]]></category>
		<guid isPermaLink="false">https://paolaelefante.com/?p=705</guid>

					<description><![CDATA[<p>Did you know that in 2008 a mathematician won an Academy Award? Do you know how to model realistic hair for animation movies or a bomb deflagrating for an action movie? Or you simply need&#8230;</p>
<p>L'articolo <a href="https://paolaelefante.com/2015/11/level-set-methods/">Mathematicians Go Hollywood</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Did you know that in 2008 a mathematician won an Academy Award? Do you know how to model realistic hair for animation movies or a bomb deflagrating for an action movie? Or you simply need some effective active contour segmentation method? All these questions have in common an effective, yet intuitive, mathematical framework: level set methods. I came to know them through my own X-ray tomography research project, which gives you a hint of how wide and inclusive such methods are. Yesterday I gave an introductory and informal talk at the Students' Seminar about them. This post comes as an integration to the slides that you may download <a href="https://paolaelefante.com/publications-talks/" target="_blank">from this page</a>.</p>
<p>Let's start from defining what an <strong>interface</strong> is. I could not find a rigorous definition, but the concept is very intuitive. It is a "boundary" which clearly splits the space in two subsets ("inside" and "outside"). You can imagine a closed (even self-intersecting) curve on the plane, for instance. Or the surface of a ball or a torus in <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_a6bcd1eddcf2923b077bd5e08d5731c6.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>. From now on, let's work with planar interfaces, for better visual intuition. However, everything I will discuss here can be extended to any <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_cf048f74f71721abd7b8df49453d1310.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>. Now, imagine we are working with a dynamic interface, meaning that our closed curve, for instance, changes in time.</p>
<figure id="attachment_708" aria-describedby="caption-attachment-708" style="width: 719px" class="wp-caption aligncenter"><a href="https://paolaelefante.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-27-at-08.18.36.png"><img decoding="async" class="wp-image-708 size-full" src="https://paolaelefante.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-27-at-08.18.36.png" alt="Dynamic_interface" width="719" height="431" srcset="https://paolaelefante.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-27-at-08.18.36.png 719w, https://paolaelefante.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-27-at-08.18.36-300x180.png 300w" sizes="(max-width: 719px) 100vw, 719px" /></a><figcaption id="caption-attachment-708" class="wp-caption-text">Representation of our dynamic interface: the red arrows represent the velocity field, which gives information of how the curve will change.</figcaption></figure>
<p>Rigorously speaking, we are given an initial curve, <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_2d8ea12a026b1282821301d4c92ed22c.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script> and a velocity field <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_9dc831dad0881dd0104c37dfda3ba5e7.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script> which we assume is normal to the curve at any instant <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_e358efa489f58062f10dd7316b65649e.gif' style='vertical-align: middle; border: none; padding-bottom:1px;' class='tex' alt="" /></span><script type='math/tex'></script>. We would like to determine and parametrise the evolution of the curve, that is <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_6bb2c16cdf85300ca8a969befcc246c3.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>. One intuitive idea is the following: let's choose some ordered points on our curve <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_0adf693cefecc59bc727e3a0762c10d4.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script> (Fig. A), let's follow their evolution (<span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_fb16e3e3f18c15edc61e1f2c0fa972ba.gif' style='vertical-align: middle; border: none; padding-bottom:2px;' class='tex' alt="" /></span><script type='math/tex'></script> will tell us where they are going) and let's complete the curve between any subsequent points <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_7f57ce5c29b329529f4e3f9a3765b114.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script> and <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_39020092eda15822927af91de857b0cb.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script> by interpolation. However, it may happen that our curve will split under the action of <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_fb16e3e3f18c15edc61e1f2c0fa972ba.gif' style='vertical-align: middle; border: none; padding-bottom:2px;' class='tex' alt="" /></span><script type='math/tex'></script> and Fig. B shows how our method would fail, because we told our algorithm to connect <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_20868fa29dfc38ac154b8ef762766b41.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script> with <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_2d70da379b3ffb56bd104b348ba21c55.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script> and <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_7f57ce5c29b329529f4e3f9a3765b114.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script> with <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_39020092eda15822927af91de857b0cb.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>.</p>

<a href='https://paolaelefante.com/2015/11/level-set-methods/screen-shot-2015-11-27-at-08-27-32/'><img decoding="async" width="527" height="297" src="https://paolaelefante.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-27-at-08.27.32.png" class="attachment-full size-full" alt="" srcset="https://paolaelefante.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-27-at-08.27.32.png 527w, https://paolaelefante.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-27-at-08.27.32-300x169.png 300w" sizes="(max-width: 527px) 100vw, 527px" /></a>
<a href='https://paolaelefante.com/2015/11/level-set-methods/screen-shot-2015-11-27-at-08-27-47/'><img decoding="async" width="627" height="319" src="https://paolaelefante.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-27-at-08.27.47.png" class="attachment-full size-full" alt="" srcset="https://paolaelefante.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-27-at-08.27.47.png 627w, https://paolaelefante.com/wp-content/uploads/2015/11/Screen-Shot-2015-11-27-at-08.27.47-300x153.png 300w" sizes="(max-width: 627px) 100vw, 627px" /></a>

<p>How could we explain to our algorithms when the curve splits or merges? It's hard, especially since we are searching for a general method. This is where level set methods come to the rescue.</p>
<p>The idea is very intuitive: what if we would add one extra-dimension (time) and "record" the evolution with a surface? For instance, if our curve is a disc expanding, one candidate surface could be a truncated cone. If our disc would evolve in a "8-shape" and then split, one candidate surface would be some sort of 3-dimensional "Y". In other words, we are looking for a function <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_48f70263c8e4d01e698f9d992fd3978c.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script> such that:</p>
<p><span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_35a072a3c2d619f2bfbbe5c2684b9069.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script></p>
<p>Here I denote the "inside" region at the time <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_e358efa489f58062f10dd7316b65649e.gif' style='vertical-align: middle; border: none; padding-bottom:1px;' class='tex' alt="" /></span><script type='math/tex'></script> by <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_3b59c29c58b6c2e8549037e1100b5354.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>. At any time, the zero level set of <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_1ed346930917426bc46d41e22cc525ec.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script> will detect the interface. In addition, its sign will detect the inside and outside regions. Now, observe that from the previous equation:</p>
<p><span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_9fc64c470c83539a0db61b93f4f1704b.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script></p>
<p>By applying the chain rule, we get <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_1bd1d219c288a6aec397d4c1a82c266d.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>. We assumed that our velocity field was orthogonal to the interface at any instant. In other words,</p>
<p><span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_2b80090eb9468130824870d7ebf06e79.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>.</p>
<p>Hence, we can write the following evolution equation:</p>
<p><span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_611595f4f0124ce0407337a7f0193a5f.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>.</p>
<p>This, in addition to the given initial condition <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_2d8ea12a026b1282821301d4c92ed22c.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>, will define <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_1ed346930917426bc46d41e22cc525ec.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script> and consequently the interface at any time. Suddenly we are in front of a PDE problem, for which there are many well-developed theoretical and numerical tools. Also, this approach handles perfectly topological changes, such as splitting and merging. Plus, it makes it really easy to compute geometric quantities as the curvature of the interface (simply differentiate <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_1ed346930917426bc46d41e22cc525ec.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>).</p>
<p>This new framework was introduced in 1987 by <a href="http://www.math.ucla.edu/~sjo/" target="_blank">Stanley Osher</a> and <a href="https://math.berkeley.edu/people/faculty/james-sethian" target="_blank">James Sethian</a>. Since then, it has been a thriving topic of research: just know that <a href="https://math.berkeley.edu/~sethian/Papers/sethian.osher.88.pdf" target="_blank">their seminal paper</a> to date has been cited more than 11 500 times! Level set methods have been applied to an incredible variety of problems and settings: medical imaging, computer vision, image denoising, active contour segmentation, scattering, obstacle detection, and more. It has been widely explored both theoretically and numerically. One its richest areas of application is computer graphics. One of Osher's students, <a href="http://physbam.stanford.edu/~fedkiw/" target="_blank">Ron Fedkiw</a>, now full professor at Stanford,<a href="http://abc7news.com/entertainment/stanford-professor-wins-oscar-for-science-of-destroying-things/527926/" target="_blank"> won an Academy Scientific and Technical Award</a> in 2008. Fedkiw is a consultant for <a href="http://www.ilm.com" target="_blank">Industrial Light and Magic</a>, a big name in the special effects industry. He worked on blockbusters as <a href="https://youtu.be/b2QX9FNWvww" target="_blank">Terminator III</a>, Star Wars Episode III, the Pirates of the Caribbean's saga and some Harry Potter movies. Level set methods are widely used in fluid, fire, hair simulations in animation movies. Think of water, with all his splashes (=topological changes): this framework works very well. One drawback is that this approach does not conserve some physical quantities as the volume. However, there are nowadays many tricks to work around this. For instance, there are hybrid methods that mix level set and volume tracking methods or sometime rendering techniques that fill up for the missing physical properties. You can see many animations at the <a href="http://physbam.stanford.edu" target="_blank">PhysBAM project page</a>.</p>
<p>If you got curios, I include a selection of references:</p>
<p>Osher – Paragios, “Geometric Level Set Methods in Imaging, Vision and Graphics”, Springer 2003.</p>
<p>Osher – Fedkiw, “Level Set Methods and Dynamic Implicit Surfaces”, Springer 2003.</p>
<p>Links:</p>
<p><a href="http://step.polymtl.ca/~rv101/levelset/%20explanations">http://</a><a href="http://step.polymtl.ca/~rv101/levelset/%20explanations">step.polymtl.ca</a><a href="http://step.polymtl.ca/~rv101/levelset/%20explanations">/~rv101/</a><a href="http://step.polymtl.ca/~rv101/levelset/%20explanations">levelset</a><a href="http://step.polymtl.ca/~rv101/levelset/%20explanations">/ </a><a href="http://step.polymtl.ca/~rv101/levelset/%20explanations">explanations </a></p>
<p><a href="http://www.ams.org/notices/201005/rtx100500614p.pdf">http://www.ams.org/notices/201005/</a><a href="http://www.ams.org/notices/201005/rtx100500614p.pdf">rtx100500614p.pdf</a></p>
<p><a href="http://physbam.stanford.edu/~fedkiw/papers/stanford2003-04.pdf">http://physbam.stanford.edu/~fedkiw/papers/stanford2003-04.pdf</a></p>
<p>L'articolo <a href="https://paolaelefante.com/2015/11/level-set-methods/">Mathematicians Go Hollywood</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://paolaelefante.com/2015/11/level-set-methods/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Coding coding coding</title>
		<link>https://paolaelefante.com/2015/10/coding-coding-coding/</link>
					<comments>https://paolaelefante.com/2015/10/coding-coding-coding/#comments</comments>
		
		<dc:creator><![CDATA[Paola Elefante]]></dc:creator>
		<pubDate>Thu, 08 Oct 2015 06:54:22 +0000</pubDate>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[experimental math]]></category>
		<category><![CDATA[inverse problems]]></category>
		<category><![CDATA[mathematics]]></category>
		<category><![CDATA[research]]></category>
		<guid isPermaLink="false">https://paolaelefante.com/?p=653</guid>

					<description><![CDATA[<p>Despite the confusing title, in the past days I have been coding. A lot. Even though I am dying to leak information about what exactly I am working on, I still need to wait few weeks&#8230;</p>
<p>L'articolo <a href="https://paolaelefante.com/2015/10/coding-coding-coding/">Coding coding coding</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Despite the confusing title, in the past days I have been coding. A lot. Even though I am dying to leak information about what exactly I am working on, I still need to wait few weeks to reveal.</p>
<p>I thought anyway to write something about programming from the perspective of an applied mathematician. Research forces you to be humble, since failures - ideas that will not work, rejected papers, etc. - are definitely more frequent than achievements, especially for a junior researcher as myself. Coding has the special power - called debugging - to finish crushing your self-esteem.</p>
<p>However, programming is a skill that most mathematicians should have. A lot of current job positions - academic and not - require some programming skills and they can be useful also in teaching. The most popular coding tool among mathematicians - also in many industries - is <a href="http://se.mathworks.com/products/matlab/" target="_blank">MatLab</a>. Its name comes from "<strong>Mat</strong>rix <strong>Lab</strong>oratory" since all its variables are considered arrays. It is a fourth-generation programming language, that means it is very user-friendly. MatLab is currently <em>the</em> tool from numerical computing. The fact that it is so popular, make it easier for the n00b user to learn it, since many online resources are available. For instance, every time I get an error I cannot understand, I google it and it never occurred that someone did not ask the same question before on the <a href="http://se.mathworks.com/matlabcentral/?s_tid=gn_mlc_logo" target="_blank">MathWorks forum</a>.</p>
<p>Let me open a small parenthesis of life coaching right here. For "softcore programmers" like myself and most mathematicians, it is very important to adopt the most mainstream programming tools. Do <em>not</em> take any advice from computer scientists regarding this choice (*). <a href="http://insights.dice.com/2014/10/09/5-programming-languages-marked-for-death/" target="_blank">This article</a> showing booming languages that miserably died can explain. You need to choose a language that:</p>
<ul>
<li>it's easy to learn, user-friendly and not bond to die soon,</li>
<li>it's widely used, that means there's plenty of debugging and learning resources online,</li>
<li>other mathematicians use or can easily understand.</li>
</ul>
<p>Going back to MatLab,... When I think of it, I remember of one inscription carved in my <a href="http://www.unibo.it/en" target="_blank">home university</a> elevator, "I hate MatLab" (true story). We all do, mate. It's a love-hate relationship. Anyway, MatLab can be a powerful tool for learning, teaching and researching.</p>
<p>License is expensive but education institutions get great discounts. If you plan to self-learn it, I suggest to start from the <a href="http://se.mathworks.com/academia/student_center/tutorials/launchpad.html" target="_blank">official tutorials</a>. Your best tools will then be Google, the MathWorks forum and the function "help" (to know what that is, type "help help" in the command window). Many universities offer MatLab basic courses (sometime embedded in Numerical Analysis courses). You can find also some online courses, for instance <a href="https://www.youtube.com/user/MIT" target="_blank">one by MIT </a>or <a href="https://www.coursera.org/course/matlab" target="_blank">one in Coursera</a>.</p>
<p>MatLab can be frustrating, but luckily software engineers included some funny easter eggs. Try typing "<em>why</em>" in the command window. I got the following answers so far:</p>
<blockquote>
<pre>&gt;&gt; why
Because Nausheen obeyed some terrified young not excessively terrified engineer.
&gt;&gt; why
Because the hamster obeyed a bald mathematician.
&gt;&gt; why
Because he told me to.
&gt;&gt; why
Because he insisted on it.
&gt;&gt; why
They suggested it.
&gt;&gt; why
You wanted it that way.
&gt;&gt; why
The devil made me do it.
&gt;&gt; why
Some good and good and young and rich system manager wanted it that way.
&gt;&gt; why
Joe wanted it that way.
&gt;&gt; why
Cleve wanted it.</pre>
</blockquote>
<p>If you type "<em>life</em>", a simulation of <a href="https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life" target="_blank">Conway's Game of Life</a> appears in a new window.</p>
<p>As far as I know, the most popular programming languages for mathematicians nowadays are: <a href="http://se.mathworks.com/products/matlab/" target="_blank">MatLab</a>, <a href="https://www.r-project.org/about.html" target="_blank">R</a>, <a href="https://en.wikipedia.org/wiki/C_(programming_language)" target="_blank">C</a>, <a href="https://en.wikipedia.org/wiki/C%2B%2B" target="_blank">C++</a>, <a href="https://www.wolfram.com/mathematica/" target="_blank">Mathematica</a> (**). I warmly suggest to any mathematics student (postgrad included) to attend <em>at least</em> one course of general programme design and a course on one of those languages. In programming, motivation is essential, so I suggest to the same students to pick a problem in your favourite area and learn to programme with the final purpose to code a solver for that problem (general or for particular cases). I had a lot of fun when I learned C because the final project was making a Sudoku universal solver.</p>
<p>Now back to work. Hopefully I'll have some interesting contents to share about my codes soon. I wish you no bugs this week!</p>
<p><span style="color: #808080;">(*) To be politically correct, let me stress that this would be equally fool as to ask a mathematician for a trick to multiply numbers in your head. They would prove the most general case: "Here, now you can <em>easily</em> multiply numbers, regardless of how you define your product operation or the ring you are in. You're welcome!".</span></p>
<p><span style="color: #808080;">(**) <a style="color: #808080;" href="http://www.wolfram.com" target="_blank">Wolfram</a> made available a light online free version of Mathematica called <a style="color: #808080;" href="http://www.wolframalpha.com" target="_blank">Wolfram Alpha</a>. It works perfectly if you have basic needs, like plotting something or checking an integral.</span></p>
<p>L'articolo <a href="https://paolaelefante.com/2015/10/coding-coding-coding/">Coding coding coding</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://paolaelefante.com/2015/10/coding-coding-coding/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
		<item>
		<title>4D tomography: walkthrough of my project - part 3</title>
		<link>https://paolaelefante.com/2015/08/4d-tomography-walkthrough-of-my-project-part-3/</link>
					<comments>https://paolaelefante.com/2015/08/4d-tomography-walkthrough-of-my-project-part-3/#respond</comments>
		
		<dc:creator><![CDATA[Paola Elefante]]></dc:creator>
		<pubDate>Tue, 11 Aug 2015 14:03:15 +0000</pubDate>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[experimental math]]></category>
		<category><![CDATA[inverse problems]]></category>
		<category><![CDATA[mathematics]]></category>
		<category><![CDATA[medical imaging]]></category>
		<category><![CDATA[physics]]></category>
		<category><![CDATA[research]]></category>
		<category><![CDATA[talks]]></category>
		<guid isPermaLink="false">https://paolaelefante.com/?p=447</guid>

					<description><![CDATA[<p>Here comes the final part of the walkthrough of my current project on dynamic sparse tomography (see also part 1 and part 2). In the previous post I left the question of the choice of&#8230;</p>
<p>L'articolo <a href="https://paolaelefante.com/2015/08/4d-tomography-walkthrough-of-my-project-part-3/">4D tomography: walkthrough of my project - part 3</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Here comes the final part of the walkthrough of my current project on dynamic sparse tomography (see also <a href="https://paolaelefante.com/2015/06/4d-tomography-walkthrough-of-my-project-part-1/" target="_blank">part 1</a> and <a href="https://paolaelefante.com/2015/06/4d-tomography-walkthrough-of-my-project-part-2/" target="_blank">part 2</a>). In the previous post I left the question of the choice of the cut-off function <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_b4bec7d8d220016c7603bd88c81dcf71.gif' style='vertical-align: middle; border: none; padding-bottom:1px;' class='tex' alt="" /></span><script type='math/tex'></script> hanging. In a classical level set method, <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_b4bec7d8d220016c7603bd88c81dcf71.gif' style='vertical-align: middle; border: none; padding-bottom:1px;' class='tex' alt="" /></span><script type='math/tex'></script> would be the <a href="https://en.wikipedia.org/wiki/Heaviside_step_function" target="_blank">Heaviside step function</a>. The Heaviside function is defined as:</p>
<p><span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_3d4e19436dccb01845da272144415f89.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script></p>
<p>When the first tests on the static case were ran, Kolehmainen, Lassas and Siltanen noticed that the reconstruction was not good, but the level set function itself resembled the infinite precision data. Hence, they decided to use a new cut-off function:</p>
<p><span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_9d12b06f8a19639be5ebbb42416d093a.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script></p>
<p>that is the identity function, with a non-negativity constraint. In my own simulations, I approximated the latter by a <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_e462b7e236c081548166a08ba6b20e24.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script> map:</p>
<p><span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_57e098b596ed4ce7283152623d7790f1.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script></p>
<p>Numerical results were slightly better and the corresponding objective functional was Frechet differentiable (not only Gateaux differentiable, as before).</p>
<p>Recently <a href="http://www.siltanen-research.net/HHKLNS_v19.pdf" target="_blank">Niemi <em>et al.</em></a> proved that <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_bc6b0efd3bed4dfabe15757cf4089d87.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script> is equivalent to the non-negativity constraint Tikhonov functional. Hence, they generalized it to higher orders. For instance, the functional of order 2 to minimize is:</p>
<p><span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_1e1a8f860011b9a5145d6980a728b435.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script></p>
<p>In this case, existence of a global minimizer was proved.</p>
<p>The first simulation Esa Niemi ran, was on the (2+1)D phantom shown in <a href="https://paolaelefante.com/2015/06/4d-tomography-walkthrough-of-my-project-part-2/" target="_blank">part 2</a>. The intensity value of the medium is constantly 1, while outside it we have a background constant at value 0. At each time frame, measurements were collected around a full-angle, from only 7 equally distant directions. In the following chosen time frames (“sections” of the 3D surface) you can see the outcome.</p>
<p><a href="https://paolaelefante.com/wp-content/uploads/2015/08/SimulationResults.png"><img decoding="async" class="aligncenter wp-image-491 size-large" src="https://paolaelefante.com/wp-content/uploads/2015/08/SimulationResults-1024x693.png" alt="SimulationResults" width="648" height="439" srcset="https://paolaelefante.com/wp-content/uploads/2015/08/SimulationResults-1024x693.png 1024w, https://paolaelefante.com/wp-content/uploads/2015/08/SimulationResults-300x203.png 300w, https://paolaelefante.com/wp-content/uploads/2015/08/SimulationResults-800x541.png 800w, https://paolaelefante.com/wp-content/uploads/2015/08/SimulationResults.png 1150w" sizes="(max-width: 648px) 100vw, 648px" /></a></p>
<p>The first column depict the infinite precision data, that is the simulated body. In the second column the same sections are reconstructed through Filtered Back Projection, that is the method currently used by industrial machineries. FBP does not work with undersampled data, as you can see. In the third and fourth column you can compare the reconstructions by the level set method I explained, respectively by the order 1 and the order 2 functionals. In the last column, I show how a classical regularization method works in this case, namely Tikhonov regularization. Our new method, with the order 2 functional, works much better, as you can see by the approximation errors shown in each frame.</p>
<p>The second step Esa faced was testing on real data. To reproduce the same measurement setting of the simulation, he created a stop-motion animation. He put some sugar cubes and measured around a full-angle. Then he added one or a couple of sugar cubes and measured again, and so on. The new sugar cubes represented the dynamic change (sudden, in this case) in the data. Sugar cubes are also a good choice because they have corners, which the simulated data was missing. The results can be seen in the following pictures (I selected only three time frames).</p>
<p><a href="https://paolaelefante.com/wp-content/uploads/2015/08/RealDataResults.png"><img decoding="async" class="aligncenter wp-image-492 size-large" src="https://paolaelefante.com/wp-content/uploads/2015/08/RealDataResults-1024x714.png" alt="RealDataResults" width="648" height="452" srcset="https://paolaelefante.com/wp-content/uploads/2015/08/RealDataResults-1024x714.png 1024w, https://paolaelefante.com/wp-content/uploads/2015/08/RealDataResults-300x209.png 300w, https://paolaelefante.com/wp-content/uploads/2015/08/RealDataResults-800x558.png 800w, https://paolaelefante.com/wp-content/uploads/2015/08/RealDataResults.png 1122w" sizes="(max-width: 648px) 100vw, 648px" /></a></p>
<p>The first column shows a fine reconstruction, done by FBP, using many projection angles. From the second column on, only 10 projections were used. Our method is compared with another classical reconstruction method, as Total Variation is. Again, the outcome is very promising: of course in this case you cannot compute an approximation error but you can compare visually with ground truth.</p>
<p>There is still an extensive investigation to carry on. Personally, one of my next goals is to make the codes work in a more realistic measurement setting, namely helicoidal acquisition. I would like to sample the data <em>while</em> the dynamic change happens. To this purpose, I designed the following prototype, inspired by the potential application of angiography.</p>

<a href='https://paolaelefante.com/2015/08/4d-tomography-walkthrough-of-my-project-part-3/model/'><img decoding="async" width="150" height="150" src="https://paolaelefante.com/wp-content/uploads/2015/08/model-150x150.jpg" class="attachment-thumbnail size-thumbnail" alt="" srcset="https://paolaelefante.com/wp-content/uploads/2015/08/model-150x150.jpg 150w, https://paolaelefante.com/wp-content/uploads/2015/08/model-60x60.jpg 60w, https://paolaelefante.com/wp-content/uploads/2015/08/model-1200x1200-cropped.jpg 1200w" sizes="(max-width: 150px) 100vw, 150px" /></a>
<a href='https://paolaelefante.com/2015/08/4d-tomography-walkthrough-of-my-project-part-3/model3/'><img decoding="async" width="150" height="150" src="https://paolaelefante.com/wp-content/uploads/2015/08/model3-150x150.jpg" class="attachment-thumbnail size-thumbnail" alt="" srcset="https://paolaelefante.com/wp-content/uploads/2015/08/model3-150x150.jpg 150w, https://paolaelefante.com/wp-content/uploads/2015/08/model3-60x60.jpg 60w" sizes="(max-width: 150px) 100vw, 150px" /></a>
<a href='https://paolaelefante.com/2015/08/4d-tomography-walkthrough-of-my-project-part-3/model4/'><img decoding="async" width="150" height="150" src="https://paolaelefante.com/wp-content/uploads/2015/08/model4-150x150.jpg" class="attachment-thumbnail size-thumbnail" alt="" srcset="https://paolaelefante.com/wp-content/uploads/2015/08/model4-150x150.jpg 150w, https://paolaelefante.com/wp-content/uploads/2015/08/model4-60x60.jpg 60w" sizes="(max-width: 150px) 100vw, 150px" /></a>

<p>The top part of the model has the practical purpose of collecting the viscous contrast agent and buy some time for it while we start the measurement procedure. The relevant part of the model are the “veins” that would be (slowly) filled up while we rotate the sample and acquire the data. This will be the next (2+1)D real data I will test on. Currently I am experimenting to find the right contrast agent together with my colleague <a href="https://tuhat.halvi.helsinki.fi/portal/fi/persons/alexander-meaney(52bd796c-7270-4b34-a96a-5f3fa16ae33a).html" target="_blank">Alexander Meaney</a>. In the meantime I am experimenting with simulated data with promising results.</p>
<p>This is the current state of my project. Personally, I find it to be a perfect mix of theoretical aspects, computer simulations and great potential for applications. I also hope this will make me get in touch with professionals of other areas. For instance, it would be nice to get suggestions for testing data, or measurement settings. So… feel free to comment and share your view.</p>
<p>L'articolo <a href="https://paolaelefante.com/2015/08/4d-tomography-walkthrough-of-my-project-part-3/">4D tomography: walkthrough of my project - part 3</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://paolaelefante.com/2015/08/4d-tomography-walkthrough-of-my-project-part-3/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>4D tomography: walkthrough of my project - part 2</title>
		<link>https://paolaelefante.com/2015/06/4d-tomography-walkthrough-of-my-project-part-2/</link>
					<comments>https://paolaelefante.com/2015/06/4d-tomography-walkthrough-of-my-project-part-2/#respond</comments>
		
		<dc:creator><![CDATA[Paola Elefante]]></dc:creator>
		<pubDate>Tue, 23 Jun 2015 09:45:56 +0000</pubDate>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[experimental math]]></category>
		<category><![CDATA[inverse problems]]></category>
		<category><![CDATA[mathematics]]></category>
		<category><![CDATA[medical imaging]]></category>
		<category><![CDATA[physics]]></category>
		<category><![CDATA[research]]></category>
		<category><![CDATA[talks]]></category>
		<guid isPermaLink="false">https://paolaelefante.com/?p=426</guid>

					<description><![CDATA[<p>After talking about motivation (see the first part and then part 3), I will now go into details with the mathematics foundations of the project. The novel tomography reconstruction algorithm I am contributing developing is based on&#8230;</p>
<p>L'articolo <a href="https://paolaelefante.com/2015/06/4d-tomography-walkthrough-of-my-project-part-2/">4D tomography: walkthrough of my project - part 2</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>After talking about motivation (<a href="https://paolaelefante.com/2015/06/4d-tomography-walkthrough-of-my-project-part-1/" target="_blank">see the first part</a> and then <a href="https://paolaelefante.com/2015/08/4d-tomography-walkthrough-of-my-project-part-3/" target="_blank">part 3</a>), I will now go into details with the mathematics foundations of the project. The novel tomography reconstruction algorithm I am contributing developing is based on a level set method approach.</p>
<h4>Level set methods</h4>
<p>A <a href="https://en.wikipedia.org/wiki/Level_set_method" target="_blank">level set method</a> is an elaborate, yet geometrically intuitive, framework to deal with a dynamic front. Imagine the problem of a 2D object changing in time. For instance, let's say we have a disk that stays still for a while, then expands in a "eigth shape" and then splits into disks that keep moving. After a while, a smaller disk originates from one of the previous two. In a situation like this, we would witness a topological change that is quite hard to parametrize (*). The intuitive idea behind level set methods is to model such situation in 3D, including time as a spatial dimension. The dynamic 2D object will then "build" a continuous surface. You can observe the case I depicted in the following video (**).</p>
<p><a href="https://youtu.be/VtOpVH7pwrI">https://youtu.be/VtOpVH7pwrI</a></p>
<p>On the left, you can observe the 2D dynamic object changing in time. On the right, the level set surface is built accordingly.</p>
<p>Level set methods were originally developed in the 1980s by mathematicians <a href="http://www.math.ucla.edu/~sjo/" target="_blank">Stanley Osher</a> and <a href="https://math.berkeley.edu/people/faculty/james-sethian" target="_blank">James Sethian</a>. The motivating application was (still is) computer graphics, where problems like the one I described above are frequent, for instance, in reproducing animation of fluids, where topological changes are routine.</p>
<p><iframe title="Fluid simulation - Pouring water" width="720" height="540" src="https://www.youtube.com/embed/3tNv_buE_gA?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></p>
<p>Video from <a href="https://www.youtube.com/channel/UCpsG-clkffBjB-Aoc8sS9pQ" target="_blank">Dongsoo Han Youtube channel</a>. See also <a href="https://www.youtube.com/watch?v=z8wlEsSnpQY" target="_blank">this video</a> about Disney animation.</p>
<p>As Osher put it, "<em>when a catastrophe in the movies should look realistic, Hollywood calls for the mathematicians</em>".</p>
<h4>Our model</h4>
<p>Level set methods were applied to several inverse problems and you can learn more about it <a href="ftp://ftp.math.ucla.edu/pub/camreport/cam04-02.pdf" target="_blank">from this nice survey</a> (2004). In this case, we model the X-ray attenuation (that is the unknown we want to recover) as <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_e9327736511c9ce0f7b78497f8869b42.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script>, where <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_b4bec7d8d220016c7603bd88c81dcf71.gif' style='vertical-align: middle; border: none; padding-bottom:1px;' class='tex' alt="" /></span><script type='math/tex'></script> is a cut-off function we choose (I will explain how in the next post) and <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_dd978be062d95fe4c7df74594cc810e3.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script> is the minimizer of the following Tikhonov-like functional:</p>
<p>(1)<span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_080edc0b804f0557c29f876aed9b8313.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script></p>
<p>For someone who works in iterative reconstruction algorithms, this looks familiar (***). The main difference is the presence of the function <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_b4bec7d8d220016c7603bd88c81dcf71.gif' style='vertical-align: middle; border: none; padding-bottom:1px;' class='tex' alt="" /></span><script type='math/tex'></script>. Here <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_7b7f9dbfea05c83784f8b85149852f08.gif' style='vertical-align: middle; border: none; padding-bottom:2px;' class='tex' alt="" /></span><script type='math/tex'></script> is the regularization parameter, that has the task to balance the two norms. Now, through Gateaux differentiation (§), one can see that solving this minimization problem is equivalent to finding the limit solution <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_c807cafa3d99b80beb551e6845a0ab1c.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script> of the evolution equation:</p>
<p>(2) <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_e0c4ebf0b435819c81cc50fd301e321c.gif' style='vertical-align: middle; border: none; ' class='tex' alt="" /></span><script type='math/tex'></script></p>
<p>In this sense, this is a level set method, since equation (2) recalls an evolution equation of a level set method. Anyway, I approach the numerical solution of the problem by the formulation (1) and apply gradient descent methods.</p>
<p>In the next post I will explain who <span class='MathJax_Preview'><img src='https://paolaelefante.com/wp-content/plugins/latex/cache/tex_b4bec7d8d220016c7603bd88c81dcf71.gif' style='vertical-align: middle; border: none; padding-bottom:1px;' class='tex' alt="" /></span><script type='math/tex'></script> is and how we choose it. Also, I will show some published results to present a comparison with well-known methods in the case of undersampled data.</p>
<p>&nbsp;</p>
<p>(*) If you had the instinct of running away at "topological change", don't panic. In simpler words, the trouble is at the instant when the disk splits in two. Such geometric change is tricky.</p>
<p>(**) The phantom was created by postgrad student <a href="https://tuhat.halvi.helsinki.fi/portal/fi/persons/esa-niemi(5a89504d-3202-4cbf-be1d-acdacea8220b).html" target="_blank">Esa Niemi</a>, the video was assembled by master student <a href="https://tuhat.halvi.helsinki.fi/portal/fi/persons/topias-valtteri-rus(d92cb930-c4d5-4931-9b9d-fb493ee2b9ec).html" target="_blank">Topias Rusanen</a>. Please mention the authors if you embed the video somewhere.</p>
<p>(***) For those who do not, this is a classical regularization problem formulation.</p>
<p>(§) For details, see <a href="http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6703813" target="_blank">Niemi <em>et al</em>.</a> and <a href="http://epubs.siam.org/doi/abs/10.1137/050622791" target="_blank">Kolehmainen <em>et al</em>.</a>.</p>
<p>L'articolo <a href="https://paolaelefante.com/2015/06/4d-tomography-walkthrough-of-my-project-part-2/">4D tomography: walkthrough of my project - part 2</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://paolaelefante.com/2015/06/4d-tomography-walkthrough-of-my-project-part-2/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>4D tomography: walkthrough of my project - part 1</title>
		<link>https://paolaelefante.com/2015/06/4d-tomography-walkthrough-of-my-project-part-1/</link>
					<comments>https://paolaelefante.com/2015/06/4d-tomography-walkthrough-of-my-project-part-1/#comments</comments>
		
		<dc:creator><![CDATA[Paola Elefante]]></dc:creator>
		<pubDate>Fri, 12 Jun 2015 18:10:21 +0000</pubDate>
				<category><![CDATA[algorithms]]></category>
		<category><![CDATA[experimental math]]></category>
		<category><![CDATA[inverse problems]]></category>
		<category><![CDATA[mathematics]]></category>
		<category><![CDATA[medical imaging]]></category>
		<category><![CDATA[physics]]></category>
		<category><![CDATA[research]]></category>
		<category><![CDATA[talks]]></category>
		<guid isPermaLink="false">https://paolaelefante.com/?p=420</guid>

					<description><![CDATA[<p>Last month the greatest event in Inverse Problems ever took place in Helsinki: the  Applied Inverse Problems 2015 conference. In addition, I gave my first technical presentation at the 4D tomography minisymposium (find the slides here). I take the&#8230;</p>
<p>L'articolo <a href="https://paolaelefante.com/2015/06/4d-tomography-walkthrough-of-my-project-part-1/">4D tomography: walkthrough of my project - part 1</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Last month the greatest event in Inverse Problems ever took place in Helsinki: the <a href="https://www.aip2015.fips.fi/index.php" target="_blank"> Applied Inverse Problems 2015</a> conference. In addition, I gave my first technical presentation at the <a href="https://www.aip2015.fips.fi/ps8.php" target="_blank">4D tomography minisymposium</a> (find the slides <a href="https://paolaelefante.com/publications-talks/" target="_blank">here</a>). I take the chance to write a series of posts as a walkthrough of my project and its current state.</p>
<h4>The project</h4>
<p>When I started, I basically took up the good work of soon-to-be-doctor <a href="https://tuhat.halvi.helsinki.fi/portal/fi/persons/esa-niemi(5a89504d-3202-4cbf-be1d-acdacea8220b).html" target="_blank">Esa Niemi</a>. Esa studied a novel tomography algorithm based on a level set method in the case of a dynamic 2D object. Such approach had been already investigated in the <a href="http://www.siltanen-research.net/evolution_revision.pdf" target="_blank">paper</a> by <a href="http://www.researchgate.net/profile/Ville_Kolehmainen" target="_blank">Kolehmainen</a>, <a href="http://www.rni.helsinki.fi/~mjl/" target="_blank">Lassas</a> and <a href="http://www.siltanen-research.net" target="_blank">Siltanen</a> in the static 2D case. My aim is to expand the algorithm to the dynamic 3D cases and to include non-trivial acquisition geometries.</p>
<h4>Why dynamic tomography?</h4>
<p>The motivation behind this project is strong and our team is definitely not the only one working on these issues. In our case, we are mostly - but not limited to - interested in biomedical applications. One powerful example of potential applications is angiography. In the featured image of this post, you can see a 2D radiography of a hand where a contrast agent has been injected. Angiography represents a fundamental non-invasive diagnostic and treatment tool in medicine.</p>
<p><a href="https://youtu.be/jEfHnwEi2n4">https://youtu.be/jEfHnwEi2n4</a></p>
<p>In the video above you can observe a contrast agent injected into some heart's blood vessels, while dynamic CT allows to monitor what happens. Coronary angiography can be useful to detect obstructions or ruptures. During the treatment procedure known as <a href="https://en.wikipedia.org/wiki/Angioplasty" target="_blank">angioplasty</a>, it is fundamental for the physician to monitor the evolution of the operation. To date, coronary angiography is available only in the dynamic 2D case, meaning that it is possible to observe only a section of the heart. It would be extremely useful for a doctor to have a sense of the missing spatial dimension.</p>
<p>Another interesting biomedical application of dynamic CT is <a href="https://en.wikipedia.org/wiki/Radiation_therapy" target="_blank">radiation therapy</a>. During radiation therapy, cancerous cells are hit by ionizing radiation. If a tumour is placed along moving organs (i.e. lungs, etc.), the radiation flow would miss it for a portion of time and irradiate healthy tissue. As I mentioned <a href="https://paolaelefante.com/2014/11/mathematics-breast-cancer-prevention/" target="_blank">in a previous post</a>, radiation can contribute to cancer, so you want to tune the radiation dose down.</p>
<figure id="attachment_422" aria-describedby="caption-attachment-422" style="width: 300px" class="wp-caption aligncenter"><a href="https://paolaelefante.com/wp-content/uploads/2015/06/radther.jpg"><img decoding="async" class="size-medium wp-image-422" src="https://paolaelefante.com/wp-content/uploads/2015/06/radther-300x260.jpg" alt="Pic from www.intelligentdental.com." width="300" height="260" srcset="https://paolaelefante.com/wp-content/uploads/2015/06/radther-300x260.jpg 300w, https://paolaelefante.com/wp-content/uploads/2015/06/radther.jpg 540w" sizes="(max-width: 300px) 100vw, 300px" /></a><figcaption id="caption-attachment-422" class="wp-caption-text">Radiation therapy setting.Pic from www.intelligentdental.com.</figcaption></figure>
<p>Dynamic tomography could allow to synchronise a radiation therapy machinery with the real movement of the tumour, thus reducing useless and potentially damaging radiation.</p>
<p>Then we come to the other attribute: <em>sparse</em>. Sparse measurement is synonym of undersampling, meaning that one tries to get the best he can with few data. Few measured data means lower X-ray dose in tomography. To date, industrial machineries mostly reconstruct measured data through the Filtered Back Projection algorithm (FBP). FBP usually guarantees good image quality but asks for a lot of sampled data (*). Iterative methods - that is what we use and research - reconstruct images with less quality (anyway <em>good enough</em>) but with definitely fewer data (even one tenth!). This idea motivates our testing of a novel algorithm, in the hope of massively reduce a patient irradiation.</p>
<p>If the radiation is minimised, CT can be safely prescribed as a prevention examination to monitor some cases. Also, this would mean less sensors and detectors (= less money) and less time (if we succeed to beat FBP computationally speaking).</p>
<p>Here is my/our motivation so far. Next I'll explain what level set method and how we apply it in the dynamic tomography case. To next time!</p>
<p>(*) I here promise I'll take the time to develop in a post what FBP is and show some comparisons with other reconstruction methods, with fewer projections.</p>
<p><span style="color: #b8b8b8;">Featured image comes from <a style="color: #b8b8b8;" href="https://en.wikipedia.org/wiki/Angiography" target="_blank">Wikipedia</a>.</span></p>
<p>L'articolo <a href="https://paolaelefante.com/2015/06/4d-tomography-walkthrough-of-my-project-part-1/">4D tomography: walkthrough of my project - part 1</a> sembra essere il primo su <a href="https://paolaelefante.com">Paola Elefante</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://paolaelefante.com/2015/06/4d-tomography-walkthrough-of-my-project-part-1/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
