<?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/" >

<channel><title><![CDATA[Keyboard Scientist - Blog]]></title><link><![CDATA[http://keyboardscientist.weebly.com/blog]]></link><description><![CDATA[Blog]]></description><pubDate>Sat, 07 Dec 2024 23:36:40 -0800</pubDate><generator>Weebly</generator><item><title><![CDATA[BBOB-2016: Optimizer Benchmarking Workshop﻿]]></title><link><![CDATA[http://keyboardscientist.weebly.com/blog/bbob-2016-optimizer-benchmarking-workshop]]></link><comments><![CDATA[http://keyboardscientist.weebly.com/blog/bbob-2016-optimizer-benchmarking-workshop#comments]]></comments><pubDate>Fri, 29 Jan 2016 16:05:00 GMT</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://keyboardscientist.weebly.com/blog/bbob-2016-optimizer-benchmarking-workshop</guid><description><![CDATA[GECCO 2016 is hosting the Workshop on Real-Parameter Black-Box Optimization Benchmarking (BBOB 2016), which will be the first time in the BBOB Workshop series where bi-objective problems are examined. &nbsp;This is particularly exciting for us since this competition allows anyone to test any optimization algorithm on a suite of 55 bi-objective problems. &nbsp;The bi-objective problems are constructed by selecting two single-objective functions&nbsp;with known characteristics. &nbsp;Many of the s [...] ]]></description><content:encoded><![CDATA[<div class="paragraph" style="text-align:left;"><a href="http://gecco-2016.sigevo.org/index.html/HomePage">GECCO 2016</a> is hosting the Workshop on Real-Parameter Black-Box Optimization Benchmarking (BBOB 2016), which will be the first time in the BBOB Workshop series where bi-objective problems are examined. &nbsp;This is particularly exciting for us since this competition allows anyone to test any optimization algorithm on a suite of 55 bi-objective problems. &nbsp;The bi-objective problems are constructed by selecting two single-objective <span>functions&nbsp;</span>with known characteristics. &nbsp;Many of the single-objective functions are well-known, such as the Schaffer and Schwefel problems, but additional transformations are applied to increase the difficulty of the functions. &nbsp;This is a perfect opportunity for anyone using the <a href="http://moeaframework.org/">MOEA Framework</a> to show off their optimization algorithm. &nbsp;In this post we will demonstrate how to connect the MOEA Framework to the BBOB 2016 test suite (which is part of the <a href="https://github.com/numbbo/coco">Coco Framework</a>).<br></div><div><!--BLOG_SUMMARY_END--></div><div class="paragraph" style="text-align:left;">To begin, you should grab the latest copies of the MOEA Framework and Coco Framework. &nbsp;Using Git, you can run:<ul><li>git clone&nbsp;https://github.com/numbbo/coco.git</li><li>git clone https://github.com/MOEAFramework/MOEAFramework</li></ul><br>Before continuing further, it is necessary to setup your Coco installation.&nbsp; Two steps are needed, both of which you should run from the root Coco folder.&nbsp; Run:<ul><li>python do.py build-java</li><li>python do.py install-postprocessing</li></ul><br>Great!&nbsp; Coco is written in C, but they provide a very nice Java plugin we can use. &nbsp;You can find details on this plugin in the <strong>Coco/code-experiments/build/java</strong> folder. &nbsp;If you open <strong>ExampleExperiment.java</strong>, you can see a simple example provided by the Coco authors. &nbsp;This example demonstrates random search, but we will show below how to replace this random search algorithm with any optimization algorithm from the MOEA Framework.<br><br>Start by copying the <strong>java</strong> folder and remaining it to <strong>moeaframework</strong>.&nbsp; This folder should be located at Coco/code-experiments/build/moeaframework.&nbsp; Next, edit <strong>ExampleExperiment.java</strong> inside the moeaframework folder.&nbsp; Replace the entire contents of this file with the code below:<br></div><div id="223586691367997450"><div><style type="text/css">        #element-ecf8a445-64ef-4ed4-856e-a35a8a94d769 .code-editor--light {  padding: 20px 0px;}#element-ecf8a445-64ef-4ed4-856e-a35a8a94d769 .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-ecf8a445-64ef-4ed4-856e-a35a8a94d769 .code-editor--light .header .paragraph {  margin: 0;}#element-ecf8a445-64ef-4ed4-856e-a35a8a94d769 .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-ecf8a445-64ef-4ed4-856e-a35a8a94d769 .code-editor--dark {  padding: 20px 0px;}#element-ecf8a445-64ef-4ed4-856e-a35a8a94d769 .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-ecf8a445-64ef-4ed4-856e-a35a8a94d769 .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-ecf8a445-64ef-4ed4-856e-a35a8a94d769 .code-editor--dark .header .paragraph {  margin: 0;}#element-ecf8a445-64ef-4ed4-856e-a35a8a94d769 .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-ecf8a445-64ef-4ed4-856e-a35a8a94d769" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">Code Editor</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;">This code can be broken into four parts.&nbsp; First, we define the class <strong>ProblemWrapper</strong>.&nbsp; This class provides the bridge between the Coco Framework and the MOEA Framework.&nbsp; Given a BBOB 2016 problem instance generated by Coco, it produces a Problem implementation that can be processed by the MOEA Framework.&nbsp; You shouldn't need to make any changes to this class.<br><br>Next, we have the <strong>solve</strong> method.&nbsp; Here we use the MOEA Framework's Executor class to solve the BBOB 2016 problem instance.&nbsp; Here you can control which algorithm you are running, change any parameters, swap in any new crossover/mutation operators, etc.&nbsp; This is where you get to be creative!<br><br>Below the solve method, we encounter the <strong>runBBOBbiobj()</strong> method.&nbsp; This is where we configure Coco to run the BBOB 2016 test problem suite.&nbsp; For each problem in the test suite, this method invokes our solve method.<br><br>Finally, we have the <strong>main</strong> method.&nbsp; The main method is called first when you run the Java application.&nbsp; All we do is setup some logging information and call the runBBOBbiobj() method.&nbsp; In summary, the key method for you is the solve() method.&nbsp; The others can be left alone.<br></div><div class="wsite-adsense"></div><h2 class="wsite-content-title" style="text-align:left;">Running the Example<br></h2><div class="paragraph" style="text-align:left;">Now we can compile and run this example.&nbsp; First, you will need to get the MOEA Framework's JAR files.&nbsp; Visit <a href="http://moeaframework.org/">http://moeaframework.org/</a> and download the "compiled binaries".&nbsp; After extracting the folder, copy all of the JAR files in the <strong>lib/</strong> folder to the <strong>Coco/code-experiments/build/moeaframework</strong> folder.<br><br>Next, compile the code with the following command:<ul><li>javac -cp ".:*" ExampleExperiment.java &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; (Unix/Linux)</li><li>javac -cp ".;*" ExampleExperiment.java&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Windows)</li></ul><br>If you run into an error saying CocoJNI could not be found, be sure to copy CocoJNI.dll or libCocoJNI.so from&nbsp;Coco/code-experiments/build/java to the Coco/code-experiments/build/moeaframework folder.&nbsp; This file was created when we ran "python do.py build-java" above.<br><br>Finally, run the experiment:<ul><li>java -cp ".:*" -Djava.library.path=. ExampleExperiment &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; (Unix/Linux)</li><li>java -cp ".;*" -Djava.library.path=. ExampleExperiment&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (Windows)</li></ul><br>It will take a while to run all 55 text problems, so please be patient!<br></div><div class="wsite-adsense"></div><h2 class="wsite-content-title" style="text-align:left;">Post-processing</h2><div class="paragraph" style="text-align:left;">Coco saves the results to folders called NAME_on_bbob_biobj, where NAME is the name of the algorithm.&nbsp; We can use Coco's post-processing to generate nice figures showing the results.&nbsp; In our example code, we ran GDE3.&nbsp; We would post-process the results with:<ul><li>python -m bbob_pproc GDE3_on_bbob-biobj/</li></ul>or you can post-process many algorithms together:<ul><li>python -m bbob_pproc GDE3_on_bbob-biobj/ OMOPSO_on_bbob-biobj/ NSGAII_on_bbob-biobj/</li></ul><br>The output is saved in the <strong>ppdata</strong> folder.&nbsp; For example, the following shows the performance on these three algorithms on a subset of the test functions:<br></div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/5569041_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">&nbsp;<br>Now it's up to you.&nbsp; Test out existing optimization algorithms or design your own.&nbsp; If you choose to develop your experiments using the MOEA Framework, try our new <a href="http://www.lulu.com/shop/david-hadka/beginners-guide-to-the-moea-framework/paperback/product-22522919.html">Beginner's Guide to the MOEA Framework</a> book.&nbsp; You can also find additional documentation <a href="http://moeaframework.org/documentation.html">online</a> and many examples in the downloads.&nbsp; Good luck and see you at <a href="http://gecco-2016.sigevo.org/index.html/HomePage">GECCO 2016</a>!<br></div><div><div id="971640789782726362" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"> </div></div>]]></content:encoded></item><item><title><![CDATA[Defining Termination Conditions]]></title><link><![CDATA[http://keyboardscientist.weebly.com/blog/defining-termination-conditions]]></link><comments><![CDATA[http://keyboardscientist.weebly.com/blog/defining-termination-conditions#comments]]></comments><pubDate>Tue, 26 Jan 2016 01:42:24 GMT</pubDate><category><![CDATA[Java]]></category><category><![CDATA[MOEA Framework]]></category><guid isPermaLink="false">http://keyboardscientist.weebly.com/blog/defining-termination-conditions</guid><description><![CDATA[The termination condition determines when an optimization algorithm is completed.&nbsp; This post describes a new feature in the MOEA Framework where you can specify termination conditions for an algorithm.&nbsp; We now provide built-in support for fixing the maximum number of evaluations or the maximum wallclock time, but other means can be devised.Termination conditions are supported by the Executor, which provides a simple interface for executing evolutionary algorithms.&nbsp; Those who have  [...] ]]></description><content:encoded><![CDATA[<div class="paragraph" style="text-align:left;">The termination condition determines when an optimization algorithm is completed.&nbsp; This post describes a new feature in the <a href="http://moeaframework.org">MOEA Framework</a> where you can specify termination conditions for an algorithm.&nbsp; We now provide built-in support for fixing the maximum number of evaluations or the maximum wallclock time, but other means can be devised.<br></div><div><!--BLOG_SUMMARY_END--></div><div class="paragraph" style="text-align:left;">Termination conditions are supported by the Executor, which provides a simple interface for executing evolutionary algorithms.&nbsp; Those who have used the MOEA Framework before should be familiar with the following:</div><div id="993176210528826228"><div><style type="text/css">        #element-6568f274-d381-4496-983a-f17a37e03ea4 .code-editor--light {  padding: 20px 0px;}#element-6568f274-d381-4496-983a-f17a37e03ea4 .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-6568f274-d381-4496-983a-f17a37e03ea4 .code-editor--light .header .paragraph {  margin: 0;}#element-6568f274-d381-4496-983a-f17a37e03ea4 .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-6568f274-d381-4496-983a-f17a37e03ea4 .code-editor--dark {  padding: 20px 0px;}#element-6568f274-d381-4496-983a-f17a37e03ea4 .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-6568f274-d381-4496-983a-f17a37e03ea4 .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-6568f274-d381-4496-983a-f17a37e03ea4 .code-editor--dark .header .paragraph {  margin: 0;}#element-6568f274-d381-4496-983a-f17a37e03ea4 .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-6568f274-d381-4496-983a-f17a37e03ea4" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;"></div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;">Here, we are running the NSGA-II algorithm for 10,000 function evaluations on the UF1 problem.&nbsp; You can now try out on the latest master branch on <a href="https://github.com/MOEAFramework/MOEAFramework">Github</a> other termination conditions.&nbsp; For example, we can limit by the maximum wallclock time:<span id="selectionBoundary_1453770750589_6096925778218386">&#65279;</span></div><div id="160170990884863298"><div><style type="text/css">        #element-6d6c04b5-4580-48ad-8088-f9abf52b52fd .code-editor--light {  padding: 20px 0px;}#element-6d6c04b5-4580-48ad-8088-f9abf52b52fd .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-6d6c04b5-4580-48ad-8088-f9abf52b52fd .code-editor--light .header .paragraph {  margin: 0;}#element-6d6c04b5-4580-48ad-8088-f9abf52b52fd .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-6d6c04b5-4580-48ad-8088-f9abf52b52fd .code-editor--dark {  padding: 20px 0px;}#element-6d6c04b5-4580-48ad-8088-f9abf52b52fd .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-6d6c04b5-4580-48ad-8088-f9abf52b52fd .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-6d6c04b5-4580-48ad-8088-f9abf52b52fd .code-editor--dark .header .paragraph {  margin: 0;}#element-6d6c04b5-4580-48ad-8088-f9abf52b52fd .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-6d6c04b5-4580-48ad-8088-f9abf52b52fd" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;"></div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;">Time is specified in milliseconds, so here we are running the algorithm for 60 seconds.&nbsp; Additional termination conditions can be created by implementing the TerminationCondition class.&nbsp; For example, suppose we want to stop if the algorithm makes no improvements after ten generation.&nbsp; We could implement this as follows:<br></div><div id="330962924423518722"><div><style type="text/css">        #element-0c18f302-ad69-4b2d-8344-402a356a8b5d .code-editor--light {  padding: 20px 0px;}#element-0c18f302-ad69-4b2d-8344-402a356a8b5d .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-0c18f302-ad69-4b2d-8344-402a356a8b5d .code-editor--light .header .paragraph {  margin: 0;}#element-0c18f302-ad69-4b2d-8344-402a356a8b5d .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-0c18f302-ad69-4b2d-8344-402a356a8b5d .code-editor--dark {  padding: 20px 0px;}#element-0c18f302-ad69-4b2d-8344-402a356a8b5d .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-0c18f302-ad69-4b2d-8344-402a356a8b5d .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-0c18f302-ad69-4b2d-8344-402a356a8b5d .code-editor--dark .header .paragraph {  margin: 0;}#element-0c18f302-ad69-4b2d-8344-402a356a8b5d .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-0c18f302-ad69-4b2d-8344-402a356a8b5d" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;"></div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;">The TerminationCondition interface defines two methods.&nbsp; The initialize method is used to set any initial conditions used by the termination condition.&nbsp; Note that this method is called after the Algorithm is constructed but before it is run.&nbsp; The shouldTerminate method tests if the algorithm should terminate.&nbsp; It is given a reference to the algorithm, which give you access to any available data about the algorithm (it may be necessary to cast to a specific Algorithm to access its methods).<br><br>Be sure to check out the <a href="http://www.lulu.com/shop/david-hadka/beginners-guide-to-the-moea-framework/ebook/product-22522907.html">Beginner's Guide to the MOEA Framework</a> for additional tips and advice on using the MOEA Framework.<br></div><div><div id="178380730397550441" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"> </div></div>]]></content:encoded></item><item><title><![CDATA[Generating Simple Plots﻿]]></title><link><![CDATA[http://keyboardscientist.weebly.com/blog/generating-simple-plots]]></link><comments><![CDATA[http://keyboardscientist.weebly.com/blog/generating-simple-plots#comments]]></comments><pubDate>Wed, 06 Jan 2016 21:44:46 GMT</pubDate><category><![CDATA[Java]]></category><category><![CDATA[MOEA Framework]]></category><guid isPermaLink="false">http://keyboardscientist.weebly.com/blog/generating-simple-plots</guid><description><![CDATA[If you have used the MOEA Framework in the past, you may have noticed it does not support many plotting options. &nbsp;Yes, it has the Diagnostic Tool for plotting the runtime outputs for an algorithm, but it can only display data generated in the tool. &nbsp;If you were running algorithms programatically, there were not plotting options...until today.New 2D plotting capabilities have been added to the latest development version of the MOEA Framework available for download from https://github.co [...] ]]></description><content:encoded><![CDATA[<div class="paragraph" style="text-align:left;">If you have used the MOEA Framework in the past, you may have noticed it does not support many plotting options. &nbsp;Yes, it has the Diagnostic Tool for plotting the runtime outputs for an algorithm, but it can only display data generated in the tool. &nbsp;If you were running algorithms programatically, there were not plotting options...until today.</div><div><!--BLOG_SUMMARY_END--></div><div class="paragraph" style="text-align:left;">New 2D plotting capabilities have been added to the latest development version of the MOEA Framework available for download from https://github.com/MOEAFramework/MOEAFramework. &nbsp;These new plotting capabilities is not intended to replace more sophisticated plotting tools. &nbsp;They are intended to rapidly create simple plots for displaying outputs from the MOEA Framework. &nbsp;This includes plotting approximation sets or populations (only two-objectives can be displayed), the runtime dynamics collected by the Instrumenter class, and statistical box-and-whisker plots displaying the output from the Analyzer class.<br><br>We'll demonstrate this new class with examples. &nbsp;We'll begin by demonstrating how to create simple plots (e.g., line, scatter, and area plots) and customizing the appearance. &nbsp;Afterwards, we'll demonstrate how to plot Pareto sets, runtime dynamics, and visual comparisons of performance. First, lets create a line plot:</div><div id="529688254973305029"><div><style type="text/css">        #element-b4ac3844-1696-4539-acaa-0e65bf53cf7e .code-editor--light {  padding: 20px 0px;}#element-b4ac3844-1696-4539-acaa-0e65bf53cf7e .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-b4ac3844-1696-4539-acaa-0e65bf53cf7e .code-editor--light .header .paragraph {  margin: 0;}#element-b4ac3844-1696-4539-acaa-0e65bf53cf7e .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-b4ac3844-1696-4539-acaa-0e65bf53cf7e .code-editor--dark {  padding: 20px 0px;}#element-b4ac3844-1696-4539-acaa-0e65bf53cf7e .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-b4ac3844-1696-4539-acaa-0e65bf53cf7e .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-b4ac3844-1696-4539-acaa-0e65bf53cf7e .code-editor--dark .header .paragraph {  margin: 0;}#element-b4ac3844-1696-4539-acaa-0e65bf53cf7e .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-b4ac3844-1696-4539-acaa-0e65bf53cf7e" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">Line Plot</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;">First, we called new Plot() to create a new instance plot instance. &nbsp;Second, we plot the line by calling the line method. &nbsp;The arguments provide a label for the line (which is shown in the legend), and the x and y coordinates. &nbsp;Next, we customize the appearance of the plot by setting labels. &nbsp;Finally, we call show() to display the plot in a window. &nbsp;The result is shown below.</div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/4414831_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">We can add additional series to the plot. &nbsp;For example, below we add three points (which are the endpoints of the line segments):</div><div id="228366835137261553"><div><style type="text/css">        #element-c73528f4-4c47-45d4-a92f-dec3f5d8dadd .code-editor--light {  padding: 20px 0px;}#element-c73528f4-4c47-45d4-a92f-dec3f5d8dadd .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-c73528f4-4c47-45d4-a92f-dec3f5d8dadd .code-editor--light .header .paragraph {  margin: 0;}#element-c73528f4-4c47-45d4-a92f-dec3f5d8dadd .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-c73528f4-4c47-45d4-a92f-dec3f5d8dadd .code-editor--dark {  padding: 20px 0px;}#element-c73528f4-4c47-45d4-a92f-dec3f5d8dadd .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-c73528f4-4c47-45d4-a92f-dec3f5d8dadd .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-c73528f4-4c47-45d4-a92f-dec3f5d8dadd .code-editor--dark .header .paragraph {  margin: 0;}#element-c73528f4-4c47-45d4-a92f-dec3f5d8dadd .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-c73528f4-4c47-45d4-a92f-dec3f5d8dadd" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">Line and Scatter Plot</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;">Note below how the new series is assigned a unique color and displays in the legend.</div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/8758197_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">The appearance of any series can be edited by calling the with* methods immediately after plotting the series. &nbsp;For example:</div><div id="759409985599290823"><div><style type="text/css">        #element-e55232e2-7fb7-446e-a1d6-17b357260125 .code-editor--light {  padding: 20px 0px;}#element-e55232e2-7fb7-446e-a1d6-17b357260125 .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-e55232e2-7fb7-446e-a1d6-17b357260125 .code-editor--light .header .paragraph {  margin: 0;}#element-e55232e2-7fb7-446e-a1d6-17b357260125 .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-e55232e2-7fb7-446e-a1d6-17b357260125 .code-editor--dark {  padding: 20px 0px;}#element-e55232e2-7fb7-446e-a1d6-17b357260125 .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-e55232e2-7fb7-446e-a1d6-17b357260125 .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-e55232e2-7fb7-446e-a1d6-17b357260125 .code-editor--dark .header .paragraph {  margin: 0;}#element-e55232e2-7fb7-446e-a1d6-17b357260125 .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-e55232e2-7fb7-446e-a1d6-17b357260125" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">Editing Appearance</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/2929660_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">Great. &nbsp;Area and stacked area plots are also supported:</div><div id="945235014361142953"><div><style type="text/css">        #element-5d81c299-bc1a-41a8-8362-1a925e3edcee .code-editor--light {  padding: 20px 0px;}#element-5d81c299-bc1a-41a8-8362-1a925e3edcee .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-5d81c299-bc1a-41a8-8362-1a925e3edcee .code-editor--light .header .paragraph {  margin: 0;}#element-5d81c299-bc1a-41a8-8362-1a925e3edcee .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-5d81c299-bc1a-41a8-8362-1a925e3edcee .code-editor--dark {  padding: 20px 0px;}#element-5d81c299-bc1a-41a8-8362-1a925e3edcee .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-5d81c299-bc1a-41a8-8362-1a925e3edcee .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-5d81c299-bc1a-41a8-8362-1a925e3edcee .code-editor--dark .header .paragraph {  margin: 0;}#element-5d81c299-bc1a-41a8-8362-1a925e3edcee .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-5d81c299-bc1a-41a8-8362-1a925e3edcee" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">Area Plot</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/3112618_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="wsite-adsense"></div><div class="paragraph" style="text-align:left;">Ok, so we can create basic plots. &nbsp;Since this plotting code is included in the MOEA Framework, it also understands the data types specific to this library. &nbsp;For example, we can plot the approximation sets produced by algorithms. &nbsp;Here, we compare NSGA-II and SPEA2:</div><div id="718742009979837457"><div><style type="text/css">        #element-6303f119-345e-4546-87bc-ccb3a4c6ba4b .code-editor--light {  padding: 20px 0px;}#element-6303f119-345e-4546-87bc-ccb3a4c6ba4b .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-6303f119-345e-4546-87bc-ccb3a4c6ba4b .code-editor--light .header .paragraph {  margin: 0;}#element-6303f119-345e-4546-87bc-ccb3a4c6ba4b .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-6303f119-345e-4546-87bc-ccb3a4c6ba4b .code-editor--dark {  padding: 20px 0px;}#element-6303f119-345e-4546-87bc-ccb3a4c6ba4b .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-6303f119-345e-4546-87bc-ccb3a4c6ba4b .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-6303f119-345e-4546-87bc-ccb3a4c6ba4b .code-editor--dark .header .paragraph {  margin: 0;}#element-6303f119-345e-4546-87bc-ccb3a4c6ba4b .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-6303f119-345e-4546-87bc-ccb3a4c6ba4b" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">Comparing Outputs</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/5398733_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">SPEA2, shown in blue, clearly does not cover the entire Pareto frontier. &nbsp;Alternatively, we can plot the runtime dynamics of an algorithm. &nbsp;Here, we display the generational distance and inverted generational distance of NSGA-II solving ZDT2:</div><div id="210706205224530582"><div><style type="text/css">        #element-88a5a654-db9c-472f-9692-5dcb79b11ff8 .code-editor--light {  padding: 20px 0px;}#element-88a5a654-db9c-472f-9692-5dcb79b11ff8 .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-88a5a654-db9c-472f-9692-5dcb79b11ff8 .code-editor--light .header .paragraph {  margin: 0;}#element-88a5a654-db9c-472f-9692-5dcb79b11ff8 .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-88a5a654-db9c-472f-9692-5dcb79b11ff8 .code-editor--dark {  padding: 20px 0px;}#element-88a5a654-db9c-472f-9692-5dcb79b11ff8 .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-88a5a654-db9c-472f-9692-5dcb79b11ff8 .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-88a5a654-db9c-472f-9692-5dcb79b11ff8 .code-editor--dark .header .paragraph {  margin: 0;}#element-88a5a654-db9c-472f-9692-5dcb79b11ff8 .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-88a5a654-db9c-472f-9692-5dcb79b11ff8" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">Runtime Dynamics</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/26381_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="wsite-adsense"></div><div class="paragraph" style="text-align:left;">Want to compare algorithms? &nbsp;Lets see how NSGA-II, SPEA2, and OMOPSO stack up on the ZDT1 problem: &nbsp;We'll consider three different performance indicators:</div><div id="192818079766727188"><div><style type="text/css">        #element-e5275fe2-087b-408a-b752-8aae39e5d1eb .code-editor--light {  padding: 20px 0px;}#element-e5275fe2-087b-408a-b752-8aae39e5d1eb .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-e5275fe2-087b-408a-b752-8aae39e5d1eb .code-editor--light .header .paragraph {  margin: 0;}#element-e5275fe2-087b-408a-b752-8aae39e5d1eb .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-e5275fe2-087b-408a-b752-8aae39e5d1eb .code-editor--dark {  padding: 20px 0px;}#element-e5275fe2-087b-408a-b752-8aae39e5d1eb .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-e5275fe2-087b-408a-b752-8aae39e5d1eb .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-e5275fe2-087b-408a-b752-8aae39e5d1eb .code-editor--dark .header .paragraph {  margin: 0;}#element-e5275fe2-087b-408a-b752-8aae39e5d1eb .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-e5275fe2-087b-408a-b752-8aae39e5d1eb" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">Comparing End of Run Performance</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/2943714_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">SPEA2 appears to have better end-of-run performance in all three indicators. &nbsp;Note, you can use the mouse to zoom into the plots.<br><br>Those are the main plotting controls now, but more may be added in the future. &nbsp;You can also call the save method to save the plot to an image file. &nbsp;PNG and JPEG images are supported. &nbsp;SVG is optional and requires adding JFreeSVG to the classpath when running your code.</div><div><div id="324599372575527348" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"> </div></div>]]></content:encoded></item><item><title><![CDATA[Defining New Types﻿]]></title><link><![CDATA[http://keyboardscientist.weebly.com/blog/defining-new-types]]></link><comments><![CDATA[http://keyboardscientist.weebly.com/blog/defining-new-types#comments]]></comments><pubDate>Fri, 11 Dec 2015 16:27:56 GMT</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://keyboardscientist.weebly.com/blog/defining-new-types</guid><description><![CDATA[The next release of the MOEA Framework, version 2.7, will contain improved support for defining new decision variable types. &nbsp;This post outlines these changes and walks through a simple example of creating a new type. &nbsp;This code is currently available in the master branch of &nbsp;https://github.com/MOEAFramework/MOEAFramework.For demonstration purposes, we will define a new type for storing a color. &nbsp;A color is commonly represented on a computer as a composite of three primary co [...] ]]></description><content:encoded><![CDATA[<div class="paragraph" style="text-align:left;">The next release of the MOEA Framework, version 2.7, will contain improved support for defining new decision variable types. &nbsp;This post outlines these changes and walks through a simple example of creating a new type. &nbsp;This code is currently available in the master branch of &nbsp;<a href="https://github.com/MOEAFramework/MOEAFramework">https://github.com/MOEAFramework/MOEAFramework</a>.</div><div><!--BLOG_SUMMARY_END--></div><div class="paragraph" style="text-align:left;">For demonstration purposes, we will define a new type for storing a color. &nbsp;A color is commonly represented on a computer as a composite of three primary colors: red, green, and blue. &nbsp;The value for each primary color typically ranges between 0 and 255, where 0 indicates absence of the primary color and 255 indicates complete saturation. &nbsp;We typically express a color as a tuple of three values, e.g. (red, green, blue). &nbsp;Some common colors are shown below:<ul><li>Black - (0, 0, 0)</li><li>Red - (255, 0, 0)</li><li>Green - (0, 255, 0)</li><li>Blue - (0, 0, 255)</li><li>Yellow - (255, 255, 0)</li><li>White - (255, 255, 255)</li></ul>To represent such colors in the MOEA Framework, we create the Color type by implementing the Variable interface. &nbsp;A variable requires two methods: copy() and randomize(). &nbsp;The copy() method is responsible for creating an exact copy of a color (which is used to create new offspring solutions) and randomize() creates a new random color (which is used to create the initial population).</div><div id="381138846250170833"><div><style type="text/css">        #element-94394c8c-5095-4467-a221-2002b95af23f .code-editor--light {  padding: 20px 0px;}#element-94394c8c-5095-4467-a221-2002b95af23f .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-94394c8c-5095-4467-a221-2002b95af23f .code-editor--light .header .paragraph {  margin: 0;}#element-94394c8c-5095-4467-a221-2002b95af23f .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-94394c8c-5095-4467-a221-2002b95af23f .code-editor--dark {  padding: 20px 0px;}#element-94394c8c-5095-4467-a221-2002b95af23f .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-94394c8c-5095-4467-a221-2002b95af23f .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-94394c8c-5095-4467-a221-2002b95af23f .code-editor--dark .header .paragraph {  margin: 0;}#element-94394c8c-5095-4467-a221-2002b95af23f .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-94394c8c-5095-4467-a221-2002b95af23f" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;"></div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;">Second, we need to define any variation operators for this type. &nbsp;The variation operators describe how to generate new candidate offspring during search. &nbsp;For simplicity, we will define a mutation operator that accepts a single parent, copies the parent (this is important so the parent remains unchanged!), randomly perturbs the color in the copy, and returns the result.</div><div id="784517336942515328"><div><style type="text/css">        #element-2fd3cccf-41bd-4c7a-a741-615434add4b0 .code-editor--light {  padding: 20px 0px;}#element-2fd3cccf-41bd-4c7a-a741-615434add4b0 .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-2fd3cccf-41bd-4c7a-a741-615434add4b0 .code-editor--light .header .paragraph {  margin: 0;}#element-2fd3cccf-41bd-4c7a-a741-615434add4b0 .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-2fd3cccf-41bd-4c7a-a741-615434add4b0 .code-editor--dark {  padding: 20px 0px;}#element-2fd3cccf-41bd-4c7a-a741-615434add4b0 .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-2fd3cccf-41bd-4c7a-a741-615434add4b0 .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-2fd3cccf-41bd-4c7a-a741-615434add4b0 .code-editor--dark .header .paragraph {  margin: 0;}#element-2fd3cccf-41bd-4c7a-a741-615434add4b0 .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-2fd3cccf-41bd-4c7a-a741-615434add4b0" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;"></div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="wsite-adsense"></div><div id="437812931932627746"><div><style type="text/css">        #element-112ac724-c99e-4cd5-bc8b-4f9feee6e15a .code-editor--light {  padding: 20px 0px;}#element-112ac724-c99e-4cd5-bc8b-4f9feee6e15a .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-112ac724-c99e-4cd5-bc8b-4f9feee6e15a .code-editor--light .header .paragraph {  margin: 0;}#element-112ac724-c99e-4cd5-bc8b-4f9feee6e15a .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-112ac724-c99e-4cd5-bc8b-4f9feee6e15a .code-editor--dark {  padding: 20px 0px;}#element-112ac724-c99e-4cd5-bc8b-4f9feee6e15a .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-112ac724-c99e-4cd5-bc8b-4f9feee6e15a .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-112ac724-c99e-4cd5-bc8b-4f9feee6e15a .code-editor--dark .header .paragraph {  margin: 0;}#element-112ac724-c99e-4cd5-bc8b-4f9feee6e15a .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-112ac724-c99e-4cd5-bc8b-4f9feee6e15a" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;"></div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;">Next, we create an operator provider for this new type. &nbsp;The operator provider is responsible for specifying which variation operators are appropriate for a given problem. &nbsp;In this example, we check to see if the problem type contains any Color variables, and if so, instruct the MOEA Framework to use our variation operator.</div><div class="paragraph" style="text-align:left;">At this point, we have defined our new decision variable type and the appropriate operators. &nbsp;We can now define a problem using this type. &nbsp;The problem we will solve is very simple: find N colors that, when mixed, produce a color closest to the target (the base color is white).</div><div id="717179102852468183"><div><style type="text/css">        #element-6e5d73a2-c0a4-495a-94a4-bde50be960fd .code-editor--light {  padding: 20px 0px;}#element-6e5d73a2-c0a4-495a-94a4-bde50be960fd .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-6e5d73a2-c0a4-495a-94a4-bde50be960fd .code-editor--light .header .paragraph {  margin: 0;}#element-6e5d73a2-c0a4-495a-94a4-bde50be960fd .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-6e5d73a2-c0a4-495a-94a4-bde50be960fd .code-editor--dark {  padding: 20px 0px;}#element-6e5d73a2-c0a4-495a-94a4-bde50be960fd .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-6e5d73a2-c0a4-495a-94a4-bde50be960fd .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-6e5d73a2-c0a4-495a-94a4-bde50be960fd .code-editor--dark .header .paragraph {  margin: 0;}#element-6e5d73a2-c0a4-495a-94a4-bde50be960fd .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-6e5d73a2-c0a4-495a-94a4-bde50be960fd" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;"></div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="wsite-adsense"></div><div class="paragraph" style="text-align:left;">Finally, we can solve the problem:</div><div id="489481661784983465"><div><style type="text/css">        #element-ddf18513-3273-45da-99c0-658cfe896ddc .code-editor--light {  padding: 20px 0px;}#element-ddf18513-3273-45da-99c0-658cfe896ddc .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-ddf18513-3273-45da-99c0-658cfe896ddc .code-editor--light .header .paragraph {  margin: 0;}#element-ddf18513-3273-45da-99c0-658cfe896ddc .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-ddf18513-3273-45da-99c0-658cfe896ddc .code-editor--dark {  padding: 20px 0px;}#element-ddf18513-3273-45da-99c0-658cfe896ddc .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-ddf18513-3273-45da-99c0-658cfe896ddc .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-ddf18513-3273-45da-99c0-658cfe896ddc .code-editor--dark .header .paragraph {  margin: 0;}#element-ddf18513-3273-45da-99c0-658cfe896ddc .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-ddf18513-3273-45da-99c0-658cfe896ddc" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;"></div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;">Note the line&nbsp;OperatorFactory.getInstance().addProvider(new ColorProvider());. &nbsp;This registers our custom operator provider with the MOEA Framework. &nbsp;Without this line, you will see a ProviderNotFoundException. The end result shows three colors that, when mixed, produces a dark gray color.</div><div><div id="437752562605923194" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"><pre>0.0 Color [r=148, g=20, b=132] Color [r=158, g=252, b=127] Color [r=76, g=61, b=94]</pre></div></div><div class="paragraph" style="text-align:left;"></div><div><div id="879309135762208427" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"> </div></div>]]></content:encoded></item><item><title><![CDATA[Sensitivity Analysis with SALib]]></title><link><![CDATA[http://keyboardscientist.weebly.com/blog/sensitivity-analysis-with-salib]]></link><comments><![CDATA[http://keyboardscientist.weebly.com/blog/sensitivity-analysis-with-salib#comments]]></comments><pubDate>Tue, 20 Oct 2015 12:37:22 GMT</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://keyboardscientist.weebly.com/blog/sensitivity-analysis-with-salib</guid><description><![CDATA[Sensitivity analysis is the "study of how the uncertainty in the output of a mathematical model or system can be apportioned to different sources of uncertainty in its inputs" [Wikipedia]. &nbsp;Sensitivity analysis is a powerful technique for gaining insight into a model by understanding in general terms how the model's output is influenced by the model's inputs. &nbsp;In this post, we provide a short introduction to sensitivity analysis using visual scatter plots followed by an introduction of [...] ]]></description><content:encoded><![CDATA[<div class="paragraph" style="text-align:left;">Sensitivity analysis is the "study of how the uncertainty in the output of a mathematical model or system can be apportioned to different sources of uncertainty in its inputs" [<a href="https://en.wikipedia.org/wiki/Sensitivity_analysis">Wikipedia</a>]. &nbsp;Sensitivity analysis is a powerful technique for gaining insight into a model by understanding in general terms how the model's output is influenced by the model's inputs. &nbsp;In this post, we provide a short introduction to sensitivity analysis using visual scatter plots followed by an introduction of SALib, an open source Python library for sensitivity analysis.</div><div><!--BLOG_SUMMARY_END--></div><h2 class="wsite-content-title" style="text-align:left;">SA using Scatter Plots</h2><div class="paragraph" style="text-align:left;">Sensitivity analysis can be demonstrated visually using scatter plots. &nbsp;Suppose we have a model, y = f(x) + <span>&epsilon;, with a single input, x, and an error term,&nbsp;&epsilon;. &nbsp;We can generate a scatter plot by randomly sampling values of x and recording the output y:</span></div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/9438612_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">In this example, we observe that increasing values of x result in increasing values of y. &nbsp;This indicates there is a positive correlation between x and y, which is implies that changing the value of x has a direct influence on the value of y. &nbsp;If we fit a line to these points, the sensitivity is the slope of the line. &nbsp;In this example, the sensitivity is approximately 1. &nbsp;Any increase or decrease in the value of x results in a proportional change to y.<br><br>Take for example the following:</div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/6420048_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">In this case, the slope of the line is 0, indicating the sensitivity of y given x is 0. &nbsp;The value of y is independent of the value of x.<br><br>Suppose now we have a function with two inputs, y = f(x1, x2) +&nbsp;<span>&epsilon;. &nbsp;Like before, we sample x1 and x2 independently and generate the scatter plot. &nbsp;The black points show the output caused by varying x1 and the red points show the output caused by varying x2.</span></div><div class="wsite-adsense"></div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/4546056_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">The steeper slope of the black line with respect to the red line indicates that y is more sensitive to x1 than x2. &nbsp;Furthermore, the relative slope of the lines indicates the relative magnitude of the sensitivities. &nbsp;In this example, y is approximately 5 times more sensitive to changes in x1 than x2 (since the slope of the black line is ~1.0 and the slope of the red line is ~0.2).</div><h2 class="wsite-content-title" style="text-align:left;">Using SALib</h2><div class="paragraph" style="text-align:left;">This visual approach is useful for simple models, but can be challenging to use and error prone for more complex models. &nbsp;To address these issues, a variety of sensitivity analysis methods have been developed over the years. &nbsp;These methods typically calculate what are called <em>sensitivity indices</em> as numeric values. &nbsp;Depending on the specific method, they can compute:<ol><li><strong>First-order indices:</strong> measures the contribution to the output variance by a single model input alone.</li><li><strong>Second-order indices:</strong> measures the contribution to the output variance caused by the interaction of two model inputs.</li><li><strong>Total-order index:</strong> measures the contribution to the output variance caused by a model input, including both its first-order effects (the input varying alone) and all higher-order interactions.</li></ol>SALib is an open source library written in Python that contains a&nbsp;variety&nbsp;of sensitivity analysis methods. &nbsp;To download and install SALib, we you will first need to install <a href="https://git-scm.com/">Git</a> and <a href="https://www.python.org/downloads/">Python</a>. &nbsp;Next, run the following commands.</div><div><div id="808271820581624219" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"><pre>    git clone https://github.com/SALib/SALib.git    cd SALib    python setup.py develop</pre></div></div><div class="paragraph" style="text-align:left;"><br>To demonstrate the use of SALib,<span>&nbsp;we will perform a Sobol&rsquo; sensitivity analysis of the Ishigami function, shown below. The Ishigami function is commonly used to test uncertainty and sensitivity analysis methods because it exhibits strong nonlinearity and nonmonotonicity.</span></div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/2983376_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">To begin, start a new interactive Python session. &nbsp;Next,&nbsp;<span>import the necessary libraries. In SALib, the&nbsp;</span><span>sample</span><span>&nbsp;and&nbsp;</span><span>analyze</span><span>&nbsp;functions are stored in separate Python modules. For example, below we import the&nbsp;</span><span>saltelli</span><span>&nbsp;sample function and the&nbsp;</span><span>sobol</span><span>&nbsp;analyze function. We also import the Ishigami function, which is provided as a test function within SALib. Lastly, we import&nbsp;</span><span>numpy</span><span>, as it is used by SALib to store the model inputs and outputs in a matrix.</span></div><div id="595889289462086846"><div><style type="text/css">        #element-e2afbc30-087b-403f-a631-6d08bfc96f75 .code-editor--light {  padding: 20px 0px;}#element-e2afbc30-087b-403f-a631-6d08bfc96f75 .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-e2afbc30-087b-403f-a631-6d08bfc96f75 .code-editor--light .header .paragraph {  margin: 0;}#element-e2afbc30-087b-403f-a631-6d08bfc96f75 .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-e2afbc30-087b-403f-a631-6d08bfc96f75 .code-editor--dark {  padding: 20px 0px;}#element-e2afbc30-087b-403f-a631-6d08bfc96f75 .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-e2afbc30-087b-403f-a631-6d08bfc96f75 .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-e2afbc30-087b-403f-a631-6d08bfc96f75 .code-editor--dark .header .paragraph {  margin: 0;}#element-e2afbc30-087b-403f-a631-6d08bfc96f75 .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-e2afbc30-087b-403f-a631-6d08bfc96f75" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">Importing Python Libraries</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="wsite-adsense"></div><div class="paragraph" style="text-align:left;"><br><span>&#8203;Next, we must define the model inputs. The Ishigami function has three inputs, x1, x2, and x3,&nbsp;where x &isin;&nbsp;[-&pi;,&nbsp;&pi;]. In SALib, we use a&nbsp;dict&nbsp;defining the number of inputs, the names of the inputs, and the bounds on each input, as shown below.</span></div><div id="241084458779495243"><div><style type="text/css">        #element-6d68ccd7-7c53-4eea-b409-5ba3b8e367d5 .code-editor--light {  padding: 20px 0px;}#element-6d68ccd7-7c53-4eea-b409-5ba3b8e367d5 .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-6d68ccd7-7c53-4eea-b409-5ba3b8e367d5 .code-editor--light .header .paragraph {  margin: 0;}#element-6d68ccd7-7c53-4eea-b409-5ba3b8e367d5 .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-6d68ccd7-7c53-4eea-b409-5ba3b8e367d5 .code-editor--dark {  padding: 20px 0px;}#element-6d68ccd7-7c53-4eea-b409-5ba3b8e367d5 .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-6d68ccd7-7c53-4eea-b409-5ba3b8e367d5 .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-6d68ccd7-7c53-4eea-b409-5ba3b8e367d5 .code-editor--dark .header .paragraph {  margin: 0;}#element-6d68ccd7-7c53-4eea-b409-5ba3b8e367d5 .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-6d68ccd7-7c53-4eea-b409-5ba3b8e367d5" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">Defining Problem</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;"><br><span>Next, we generate the samples. Since we are performing a Sobol&rsquo; sensitivity analysis, we need to generate samples using the Saltelli sampler, as shown below.</span></div><div id="647798644300941168"><div><style type="text/css">        #element-f84785bf-ae3f-4932-aa94-0fe8b3160112 .code-editor--light {  padding: 20px 0px;}#element-f84785bf-ae3f-4932-aa94-0fe8b3160112 .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-f84785bf-ae3f-4932-aa94-0fe8b3160112 .code-editor--light .header .paragraph {  margin: 0;}#element-f84785bf-ae3f-4932-aa94-0fe8b3160112 .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-f84785bf-ae3f-4932-aa94-0fe8b3160112 .code-editor--dark {  padding: 20px 0px;}#element-f84785bf-ae3f-4932-aa94-0fe8b3160112 .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-f84785bf-ae3f-4932-aa94-0fe8b3160112 .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-f84785bf-ae3f-4932-aa94-0fe8b3160112 .code-editor--dark .header .paragraph {  margin: 0;}#element-f84785bf-ae3f-4932-aa94-0fe8b3160112 .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-f84785bf-ae3f-4932-aa94-0fe8b3160112" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">Generating Input Samples</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;"><br><span>Here,&nbsp;</span><span>param_values</span><span>&nbsp;is a NumPy matrix. If we run&nbsp;</span><span>param_values.shape</span><span>, we see that the matrix is 8000 by 3. The Saltelli sampler generated 8000 samples. The Saltelli sampler generates N*(2D+2)&nbsp;samples, where in this example N is 1000 (the argument we supplied) and D is 3 (the number of model inputs).<br><br>Next, we must evaluate the model using our generated samples. &nbsp;In this example, we are using the Ishigami function provided by SALib. We can evaluate these test functions as shown below:</span></div><div id="650823249165090932"><div><style type="text/css">        #element-fece8d7d-7787-496c-b0ca-c9ca8f509f62 .code-editor--light {  padding: 20px 0px;}#element-fece8d7d-7787-496c-b0ca-c9ca8f509f62 .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-fece8d7d-7787-496c-b0ca-c9ca8f509f62 .code-editor--light .header .paragraph {  margin: 0;}#element-fece8d7d-7787-496c-b0ca-c9ca8f509f62 .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-fece8d7d-7787-496c-b0ca-c9ca8f509f62 .code-editor--dark {  padding: 20px 0px;}#element-fece8d7d-7787-496c-b0ca-c9ca8f509f62 .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-fece8d7d-7787-496c-b0ca-c9ca8f509f62 .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-fece8d7d-7787-496c-b0ca-c9ca8f509f62 .code-editor--dark .header .paragraph {  margin: 0;}#element-fece8d7d-7787-496c-b0ca-c9ca8f509f62 .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-fece8d7d-7787-496c-b0ca-c9ca8f509f62" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">Evaluating the Model</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;"><br><span>With the model outputs computed, we can finally compute the sensitivity indices. In this example, we use&nbsp;</span><span>sobol.analyze</span><span>, which will compute first, second, and total-order indices.</span></div><div id="136508759297564105"><div><style type="text/css">        #element-04ddb6a1-6837-4924-9aaa-e8188dc1827e .code-editor--light {  padding: 20px 0px;}#element-04ddb6a1-6837-4924-9aaa-e8188dc1827e .code-editor--light .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-top: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-04ddb6a1-6837-4924-9aaa-e8188dc1827e .code-editor--light .header .paragraph {  margin: 0;}#element-04ddb6a1-6837-4924-9aaa-e8188dc1827e .code-editor--light .body-code {  margin: 0;  border: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-04ddb6a1-6837-4924-9aaa-e8188dc1827e .code-editor--dark {  padding: 20px 0px;}#element-04ddb6a1-6837-4924-9aaa-e8188dc1827e .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-04ddb6a1-6837-4924-9aaa-e8188dc1827e .code-editor--dark .header {  padding: 10px 20px;  font-weight: bold;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-top: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-04ddb6a1-6837-4924-9aaa-e8188dc1827e .code-editor--dark .header .paragraph {  margin: 0;}#element-04ddb6a1-6837-4924-9aaa-e8188dc1827e .code-editor--dark .body-code {  margin: 0;  border: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}</style><div id="element-04ddb6a1-6837-4924-9aaa-e8188dc1827e" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">Analyze the Outputs</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;"><br><span>Si</span><span>&nbsp;is a Python&nbsp;</span><span>dict</span><span>&nbsp;with the keys&nbsp;</span><span>"S1"</span><span>,&nbsp;</span><span>"S2"</span><span>,&nbsp;</span><span>"ST"</span><span>,&nbsp;</span><span>"S1_conf"</span><span>,&nbsp;</span><span>"S2_conf"</span><span>, and&nbsp;</span><span>"ST_conf"</span><span>. The&nbsp;</span><span>_conf</span><span>&nbsp;keys store the corresponding confidence intervals, typically with a confidence level of 95%. We can print the values as shown below.</span></div><div><div id="138325686880888503" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"><pre>&gt;&gt;&gt; # Print the first-order indices&gt;&gt;&gt; print Si['S1'][ 0.30644324  0.44776661 -0.00104936 ]&gt;&gt;&gt; # Print the total-order indices&gt;&gt;&gt; print Si['ST'][ 0.56013728  0.4387225   0.24284474]&gt;&gt;&gt; # Print the interactive effects&gt;&gt;&gt; print "x1-x2:", Si['S2'][0,1]&gt;&gt;&gt; print "x1-x3:", Si['S2'][0,2]&gt;&gt;&gt; print "x2-x3:", Si['S2'][1,2]x1-x2: 0.0155279x1-x3: 0.25484902x2-x3: -0.00995392</pre></div></div><div class="paragraph" style="text-align:left;">From this output, we make several observations. &nbsp;First, x1 and x2 show strong first-order sensitivities, but x3 has no first-order sensitivity. &nbsp;x3 has interactive effects as seen by the second and total-order indices.</div><h2 class="wsite-content-title" style="text-align:left;">Conclusion</h2><div class="paragraph" style="text-align:left;">SALib is a powerful toolbox for sensitivity analysis. &nbsp;In this post, we walked through an example using Sobol' sensitivity analysis. &nbsp;SALib includes other methods, including the Fourier Amplitude Sensitivity Test (FAST), Method of Morris, and Delta-Moment Independent Measure.<br><br>We also want to note that while SALib is a Python library, it is designed to work with models in any form. &nbsp;SALib includes a convenient command line interface for generating the model inputs and analyzing the model outputs. &nbsp;Additional documentation for SALib is available online at <a href="http://salib.readthedocs.org/en/latest/index.html">ReadTheDocs</a>.</div><div><div id="703240983875757299" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"> </div></div>]]></content:encoded></item><item><title><![CDATA[MOEA Framework - Implementing New Algorithms]]></title><link><![CDATA[http://keyboardscientist.weebly.com/blog/moea-framework-implementing-new-algorithms]]></link><comments><![CDATA[http://keyboardscientist.weebly.com/blog/moea-framework-implementing-new-algorithms#comments]]></comments><pubDate>Mon, 05 Oct 2015 16:50:13 GMT</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://keyboardscientist.weebly.com/blog/moea-framework-implementing-new-algorithms</guid><description><![CDATA[In the last post, we discussed how to ﻿introduce new problems to the MOEA Framework﻿. &nbsp;Researchers developing new multi-objective optimization algorithms may also find it convenient to implement their algorithm within the MOEA Framework for several reasons:Build the algorithm upon existing classes to save time and effort,Test their algorithm using our extensive collection of test problems,Easily compare the performance of their algorithm against others, andDistribute your algorithm to o [...] ]]></description><content:encoded><![CDATA[<div class="paragraph" style="text-align:left;">In the last post, we discussed how to <span>&#65279;</span><a href="http://keyboardscientist.weebly.com/blog/moea-framework-defining-new-problems">introduce new problems to the MOEA Framework</a><span>&#65279;</span>. &nbsp;Researchers developing new multi-objective optimization algorithms may also find it convenient to implement their algorithm within the MOEA Framework for several reasons:<ol><li>Build the algorithm upon existing classes to save time and effort,</li><li>Test their algorithm using our extensive collection of test problems,</li><li>Easily compare the performance of their algorithm against others, and</li><li>Distribute your algorithm to our large user base.</li></ol>This post will detail the steps for implementing a new multi-objective optimization algorithm within the MOEA Framework.</div><div><!--BLOG_SUMMARY_END--></div><h2 class="wsite-content-title" style="text-align:left;">Choosing the Starting Point</h2><div class="paragraph" style="text-align:left;">All optimization algorithms implemented within the MOEA Framework must implement the <a href="http://moeaframework.org/javadoc/org/moeaframework/core/Algorithm.html">Algorithm</a> interface. &nbsp;This interfaces defines several methods that must be implemented. &nbsp;For convenience, several abstract classes are also provided, including <a href="http://moeaframework.org/javadoc/org/moeaframework/algorithm/AbstractAlgorithm.html">AbstractAlgorithm</a>, <a href="http://moeaframework.org/javadoc/org/moeaframework/algorithm/AbstractEvolutionaryAlgorithm.html">AbstractEvolutionaryAlgorithm</a>, and <a href="http://moeaframework.org/javadoc/org/moeaframework/algorithm/pso/AbstractPSOAlgorithm.html">AbstractPSOAlgorithm</a>.<br><br><strong>Algorithm</strong> - Used when implementing an algorithm that can not use any of the abstract classes discussed below. &nbsp;Provides the greatest flexibility, but requires the most development.<br><br>&#8203;<strong>AbstractAlgorithm</strong> - Used when creating iterative optimization algorithms. &nbsp;The developer must provide the initialize() and iterate() method.<br><br><strong>AbstractEvolutionaryAlgorithm</strong> - Used when creating evolutionary algorithms that typically optimize a population of candidate solutions.<br><br><strong>AbstractPSOAlgorithm</strong> - Used when implementing particle swarm optimization algorithms. &nbsp;Provides structures for storing and updating particle positions, velocities, etc.<br></div><div class="wsite-adsense"></div><h2 class="wsite-content-title" style="text-align:left;">The Random Walker</h2><div class="paragraph" style="text-align:left;">To demonstrate the creation of a new algorithm, we will construct a very simple optimization algorithm called the RandomWalker. &nbsp;The overall algorithm is as follows:<ol><li>Initialize the population&#8203;&#8203;&#8203; with random solutions</li><li>While NFE &lt; MaxNFE<ol><li>Randomly pick a solution from the population</li><li>Mutate the individual with polynomial mutation</li><li>Add the offspring to the population</li><li>Use non-dominated sorting to remove the worst member of the population</li></ol></li></ol>From the above description, we see that the algorithm uses a population of solutions. &nbsp;Therefore, we will extend the AbstractEvolutionaryAlgorithm.<br><br>To start implementing this algorithm, we will first create a new Java package called "randomwalker" and within this package a new Java class called "RandomWalker".</div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/9137004_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">Next, type or copy-and-paste the code below into this new file.</div><div id="247697869760336209"><div><style type="text/css">        #element-ff993e17-9124-4ca3-8f23-e39693406f96 .code-editor {  margin: 10px 0;}#element-ff993e17-9124-4ca3-8f23-e39693406f96 .code-editor--light .header {  padding: 20px;  font-weight: bold;  border: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-ff993e17-9124-4ca3-8f23-e39693406f96 .code-editor--light .header .paragraph {  margin: 0;}#element-ff993e17-9124-4ca3-8f23-e39693406f96 .code-editor--light .body-code {  margin: 0;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-bottom: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-ff993e17-9124-4ca3-8f23-e39693406f96 .code-editor--light .body-code .editor {  margin: 0 20px;}#element-ff993e17-9124-4ca3-8f23-e39693406f96 .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-ff993e17-9124-4ca3-8f23-e39693406f96 .code-editor--dark .header {  padding: 20px;  font-weight: bold;  border: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-ff993e17-9124-4ca3-8f23-e39693406f96 .code-editor--dark .header .paragraph {  margin: 0;}#element-ff993e17-9124-4ca3-8f23-e39693406f96 .code-editor--dark .body-code {  margin: 0;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-bottom: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}#element-ff993e17-9124-4ca3-8f23-e39693406f96 .code-editor--dark .body-code .editor {  margin: 0 20px;}</style><div id="element-ff993e17-9124-4ca3-8f23-e39693406f96" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">RandomWalker.java</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;">Observe that our constructor accepts three arguments: the problem definition, the initialization procedure, and the variation operator. &nbsp;We pass the problem and initialization procedure to the super class (AbstractEvolutionaryAlgorithm). &nbsp;Also note that we pass a new NondominatedSortingPopulation to the super class, which is used to store the population. &nbsp;AbstractEvolutionaryAlgorithm will handle all of the messy details of initializing and maintaining the population.<br><br>Note: The MOEA Framework encourages algorithms to be built in a modular fashion. &nbsp;This allows users to quickly replace and add new functionality. &nbsp;For example, in the above code the variation operator is provided as an argument to the constructor. &nbsp;With this design, a user could introduce any variation operator they choose to use with our algorithm, providing greater flexibility.<br><br>Since we extended the AbstractEvolutionaryAlgorithm class, we only need to implement the iterate() method. &nbsp;The iterate() method describes one iteration of the algorithm. &nbsp;Depending on the type of algorithm, the iterate() method could perform a little or a lot of work. &nbsp;For example, in our RandomWalker example, each iteration will generate one offspring. &nbsp;In a generational algorithm like NSGA-II, all members of the population are evolved every iteration. &nbsp;It is up to the designer of the algorithm to determine how much work is performed in the iterate() method. &nbsp;At the very least, however, at least one offspring should be generated each iteration. &nbsp;The iterate() for the RandomWalker is shown below (please refer to the comments in the code for a description of each step).</div><div id="953227947312639919"><div><style type="text/css">        #element-8103e38a-8a80-4ba1-825a-a984703b7356 .code-editor {  margin: 10px 0;}#element-8103e38a-8a80-4ba1-825a-a984703b7356 .code-editor--light .header {  padding: 20px;  font-weight: bold;  border: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-8103e38a-8a80-4ba1-825a-a984703b7356 .code-editor--light .header .paragraph {  margin: 0;}#element-8103e38a-8a80-4ba1-825a-a984703b7356 .code-editor--light .body-code {  margin: 0;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-bottom: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-8103e38a-8a80-4ba1-825a-a984703b7356 .code-editor--light .body-code .editor {  margin: 0 20px;}#element-8103e38a-8a80-4ba1-825a-a984703b7356 .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-8103e38a-8a80-4ba1-825a-a984703b7356 .code-editor--dark .header {  padding: 20px;  font-weight: bold;  border: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-8103e38a-8a80-4ba1-825a-a984703b7356 .code-editor--dark .header .paragraph {  margin: 0;}#element-8103e38a-8a80-4ba1-825a-a984703b7356 .code-editor--dark .body-code {  margin: 0;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-bottom: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}#element-8103e38a-8a80-4ba1-825a-a984703b7356 .code-editor--dark .body-code .editor {  margin: 0 20px;}</style><div id="element-8103e38a-8a80-4ba1-825a-a984703b7356" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">RandomWalker.java - iterate() method</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="wsite-adsense"></div><h2 class="wsite-content-title" style="text-align:left;"><br>Creating a Service Provider</h2><div class="paragraph" style="text-align:left;">The MOEA Framework is designed to be flexible. &nbsp;It uses what's called a Service Provider Interface, or SPI, to dynamically load algorithms. &nbsp;This allows new optimization algorithms to be introduced within the MOEA Framework without modifying the MOEA Framework's code. &nbsp;To do this, we will create a new Java class called "RandomWalkerProvider" within the "randomwalker" package. &nbsp;This class must extend the AlgorithmProvider. &nbsp;The contents of this file are shown below.</div><div id="313663592417630657"><div><style type="text/css">        #element-279a044b-7714-4164-ad7a-9ea734c8cf2c .code-editor {  margin: 10px 0;}#element-279a044b-7714-4164-ad7a-9ea734c8cf2c .code-editor--light .header {  padding: 20px;  font-weight: bold;  border: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-279a044b-7714-4164-ad7a-9ea734c8cf2c .code-editor--light .header .paragraph {  margin: 0;}#element-279a044b-7714-4164-ad7a-9ea734c8cf2c .code-editor--light .body-code {  margin: 0;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-bottom: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-279a044b-7714-4164-ad7a-9ea734c8cf2c .code-editor--light .body-code .editor {  margin: 0 20px;}#element-279a044b-7714-4164-ad7a-9ea734c8cf2c .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-279a044b-7714-4164-ad7a-9ea734c8cf2c .code-editor--dark .header {  padding: 20px;  font-weight: bold;  border: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-279a044b-7714-4164-ad7a-9ea734c8cf2c .code-editor--dark .header .paragraph {  margin: 0;}#element-279a044b-7714-4164-ad7a-9ea734c8cf2c .code-editor--dark .body-code {  margin: 0;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-bottom: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}#element-279a044b-7714-4164-ad7a-9ea734c8cf2c .code-editor--dark .body-code .editor {  margin: 0 20px;}</style><div id="element-279a044b-7714-4164-ad7a-9ea734c8cf2c" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">RandomWalkerProvider.java</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;"><span>If the user requests an optimization algorithm with the name "RandomWalker", the above class will create and return an instance of our RandomWalker class. &nbsp;Note that a properties object is passed to the getAlgorithm method. &nbsp;This properties object contains any custom properties set by the user, which allows the user to provide special parameters for the algorithm such as the population size.</span><br><br><span>At this point, we have the algorithm provider, but we now need to inform the MOEA Framework that this custom algorithm provider exists. &nbsp;First, in your Eclipse project create the folder META-INF/services/. &nbsp;Within this folder. create a file named&nbsp;org.moeaframework.core.spi.AlgorithmProvider. &nbsp;This file must contain a single line with the path of our algorithm provider: randomwalker.RandomWalkerProvider. &nbsp;See below.</span></div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/4718255_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">Lastly, we need to package this as a JAR. &nbsp;The simplest way to create the JAR is to export the project from Eclipse. &nbsp;First, right-click on the project and select Export &gt; Java &gt; JAR File.</div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/418973_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">In the Window that appears, choose to only export the src/ and META-INF/ folders. &nbsp;Also specify where the JAR file is saved.</div><div class="wsite-adsense"></div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/260842_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">Click Finish to generate the JAR file.</div><h2 class="wsite-content-title" style="text-align:left;">Testing our Algorithm</h2><div class="paragraph" style="text-align:left;">To test our new algorithm, copy the RandomWalker.jar we created in the previous step to the lib/ folder in our Eclipse project. &nbsp;Then, right-click RandomWalker.jar and select Build Path &gt; Add to Build Path. &nbsp;By adding the JAR to the build path, the MOEA Framework can now locate the JAR and instantiate the algorithm provider.</div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/7789250_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">Once completed, we can now test our algorithm with the following:</div><div id="833585027323952036"><div><style type="text/css">        #element-39a62564-6397-40c4-9593-830dde4d829d .code-editor {  margin: 10px 0;}#element-39a62564-6397-40c4-9593-830dde4d829d .code-editor--light .header {  padding: 20px;  font-weight: bold;  border: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-39a62564-6397-40c4-9593-830dde4d829d .code-editor--light .header .paragraph {  margin: 0;}#element-39a62564-6397-40c4-9593-830dde4d829d .code-editor--light .body-code {  margin: 0;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-bottom: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-39a62564-6397-40c4-9593-830dde4d829d .code-editor--light .body-code .editor {  margin: 0 20px;}#element-39a62564-6397-40c4-9593-830dde4d829d .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-39a62564-6397-40c4-9593-830dde4d829d .code-editor--dark .header {  padding: 20px;  font-weight: bold;  border: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-39a62564-6397-40c4-9593-830dde4d829d .code-editor--dark .header .paragraph {  margin: 0;}#element-39a62564-6397-40c4-9593-830dde4d829d .code-editor--dark .body-code {  margin: 0;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-bottom: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}#element-39a62564-6397-40c4-9593-830dde4d829d .code-editor--dark .body-code .editor {  margin: 0 20px;}</style><div id="element-39a62564-6397-40c4-9593-830dde4d829d" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">Example.java</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;">Running this Example class should create the expected output.</div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/5890481_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div><div id="536603021285921678" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"> </div></div>]]></content:encoded></item><item><title><![CDATA[MOEA Fra﻿mework - Defining New Problems]]></title><link><![CDATA[http://keyboardscientist.weebly.com/blog/moea-framework-defining-new-problems]]></link><comments><![CDATA[http://keyboardscientist.weebly.com/blog/moea-framework-defining-new-problems#comments]]></comments><pubDate>Fri, 02 Oct 2015 12:47:15 GMT</pubDate><category><![CDATA[Java]]></category><category><![CDATA[MOEA Framework]]></category><guid isPermaLink="false">http://keyboardscientist.weebly.com/blog/moea-framework-defining-new-problems</guid><description><![CDATA[The MOEA Framework is a Java library for multiobjective optimization. &nbsp;While it comes with an assortment of optimization algorithms and test problems, its true power lies in its ability to solve user-defined problems. &nbsp;This post details the steps required to define new optimization problems within the MOEA Framework.Setting up an Eclipse ProjectIf this is your first time using the MOEA Framework, we suggest using Eclipse to build projects. &nbsp;First, download and install Eclipse. &nb [...] ]]></description><content:encoded><![CDATA[<div class="paragraph" style="text-align:left;">The <a href="http://moeaframework.org">MOEA Framework</a> is a Java library for multiobjective optimization. &nbsp;While it comes with an assortment of optimization algorithms and test problems, its true power lies in its ability to solve user-defined problems. &nbsp;This post details the steps required to define new optimization problems within the MOEA Framework.</div><div><!--BLOG_SUMMARY_END--></div><h2 class="wsite-content-title" style="text-align:left;">Setting up an Eclipse Project</h2><div class="paragraph" style="text-align:left;">If this is your first time using the MOEA Framework, we suggest using Eclipse to build projects. &nbsp;First, <a href="http://www.eclipse.org/">download and install Eclipse</a>. &nbsp;To install Eclipse, simply extract the archive to a location on your computer (e.g., your desktop). &nbsp;Within the extracted folder, run <strong>eclipse.exe</strong>.<br><br>Next, download the <a href="http://moeaframework.org/downloads.html">MOEA Framework compiled binaries</a> and extract the contents of the archive. &nbsp;If you have trouble extracting the .tar.gz archive, we recommend using&nbsp;<a href="http://www.7-zip.org/">7-zip</a>.<br><br>Finally, create a project within Eclipse for the MOEA Framework. &nbsp;First, select File &gt; New Java Project from the menu.</div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/6869777_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">In the window that appears, uncheck "Use default location". &nbsp;Click the "Browse..." button and select the extracted MOEA Framework folder. &nbsp;Click Finish.</div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/4534514_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">The MOEA Framework project will now appear within the "Package Explorer" in Eclipse. &nbsp;We will now create a source folder were our examples will reside. &nbsp;Right-click on the project and select New &gt; Source Folder.</div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/1075665_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">Give the new source folder the name "src" and click Finish.</div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/8643733_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="wsite-adsense"></div><h2 class="wsite-content-title" style="text-align:left;">Defining the Problem</h2><div class="paragraph" style="text-align:left;">With the project set up, we can now define our problem. &nbsp;<span>For this exercise, we will implement a relatively simple test problem, called the Srinivas problem. &nbsp;This problem has two decision variables, two objectives, and two constraints. &nbsp;Its formal definition is shown below.</span><br></div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/6417286_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;"><span>On the left, we see the two objective functions that we are minimizing. &nbsp;On the right, we have the constraints. &nbsp;The MOEA framework supports three kinds of constraints. &nbsp;The variable bounds, or box constraints, define the lower and upper bounds for real-valued decision variables. &nbsp;In this example, the lower and upper bounds are -20&nbsp;&le; x, y&nbsp;&le; 20. &nbsp;Optimization problems can also define any number of equality or inequality constraints. &nbsp;For example, 0&nbsp;&ge; x - 3y + 10 is an inequality constraint requiring that the expression x - 3y + 10 be less than or equal to 0.<br><br>&#8203;To begin defining the problem, we first create a new Java class. &nbsp;Right-click on the "src" folder and select New &gt; Class.</span></div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/9448861_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">In the window that appears, give the class the name "MyProblem" and click Finish<br></div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/9734312_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">This will create a file called "MyProblem.java" in the "src" folder. &nbsp;It will also open a text editor for this file. &nbsp;<span>Within this text editor, type the following:</span><br></div><div id="316704971229559203"><div><style type="text/css">        #element-87d6900e-d3bf-4681-ae44-9645f042d085 .code-editor {  margin: 10px 0;}#element-87d6900e-d3bf-4681-ae44-9645f042d085 .code-editor--light .header {  padding: 20px;  font-weight: bold;  border: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-87d6900e-d3bf-4681-ae44-9645f042d085 .code-editor--light .header .paragraph {  margin: 0;}#element-87d6900e-d3bf-4681-ae44-9645f042d085 .code-editor--light .body-code {  margin: 0;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-bottom: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-87d6900e-d3bf-4681-ae44-9645f042d085 .code-editor--light .body-code .editor {  margin: 0 20px;}#element-87d6900e-d3bf-4681-ae44-9645f042d085 .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-87d6900e-d3bf-4681-ae44-9645f042d085 .code-editor--dark .header {  padding: 20px;  font-weight: bold;  border: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-87d6900e-d3bf-4681-ae44-9645f042d085 .code-editor--dark .header .paragraph {  margin: 0;}#element-87d6900e-d3bf-4681-ae44-9645f042d085 .code-editor--dark .body-code {  margin: 0;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-bottom: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}#element-87d6900e-d3bf-4681-ae44-9645f042d085 .code-editor--dark .body-code .editor {  margin: 0 20px;}</style><div id="element-87d6900e-d3bf-4681-ae44-9645f042d085" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">MyProblem.java</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;">This is the basic structure of any problem within the MOEA Framework. &nbsp;All problems must implement the <strong>Problem</strong> interface. &nbsp;We accomplish this by extending the <strong>AbstractProblem</strong> class.<br><br>In the constructor, we call <strong>super(2, 2, 2)</strong> to indicate that this problem has two decision variables, two objectives, and two constraints. &nbsp;Additionally, the AbstractProblem requires that we define two methods: <strong>evaluate</strong> and <strong>newSolution</strong>.<br><br>The newSolution method is used to define a prototype solution to the problem. &nbsp;This prototype simply defines the number decision variables, their types, and if applicable the bounds on the decision variables. &nbsp;For the Srinivas problem, we have two decision variables with bounds -20&nbsp;<span>&le; x, y&nbsp;&le; 20. &nbsp;We implement newSolution as follows:</span></div><div id="855657164386437137"><div><style type="text/css">        #element-b93c223b-d832-454b-9b03-1f68c53287fc .code-editor {  margin: 10px 0;}#element-b93c223b-d832-454b-9b03-1f68c53287fc .code-editor--light .header {  padding: 20px;  font-weight: bold;  border: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-b93c223b-d832-454b-9b03-1f68c53287fc .code-editor--light .header .paragraph {  margin: 0;}#element-b93c223b-d832-454b-9b03-1f68c53287fc .code-editor--light .body-code {  margin: 0;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-bottom: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-b93c223b-d832-454b-9b03-1f68c53287fc .code-editor--light .body-code .editor {  margin: 0 20px;}#element-b93c223b-d832-454b-9b03-1f68c53287fc .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-b93c223b-d832-454b-9b03-1f68c53287fc .code-editor--dark .header {  padding: 20px;  font-weight: bold;  border: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-b93c223b-d832-454b-9b03-1f68c53287fc .code-editor--dark .header .paragraph {  margin: 0;}#element-b93c223b-d832-454b-9b03-1f68c53287fc .code-editor--dark .body-code {  margin: 0;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-bottom: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}#element-b93c223b-d832-454b-9b03-1f68c53287fc .code-editor--dark .body-code .editor {  margin: 0 20px;}</style><div id="element-b93c223b-d832-454b-9b03-1f68c53287fc" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">MyProblem.java - newSolution method</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;">Lastly, we implement the evaluate method. &nbsp;The evaluate method is given a candidate solution to the problem, and we must calculate and assign the objective and constraint values. &nbsp;For the Srinivas problem, the evaluate method is shown below:</div><div id="354860019644972140"><div><style type="text/css">        #element-8cb4ea78-64bf-4352-80ee-ca201edc138a .code-editor {  margin: 10px 0;}#element-8cb4ea78-64bf-4352-80ee-ca201edc138a .code-editor--light .header {  padding: 20px;  font-weight: bold;  border: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-8cb4ea78-64bf-4352-80ee-ca201edc138a .code-editor--light .header .paragraph {  margin: 0;}#element-8cb4ea78-64bf-4352-80ee-ca201edc138a .code-editor--light .body-code {  margin: 0;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-bottom: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-8cb4ea78-64bf-4352-80ee-ca201edc138a .code-editor--light .body-code .editor {  margin: 0 20px;}#element-8cb4ea78-64bf-4352-80ee-ca201edc138a .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-8cb4ea78-64bf-4352-80ee-ca201edc138a .code-editor--dark .header {  padding: 20px;  font-weight: bold;  border: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-8cb4ea78-64bf-4352-80ee-ca201edc138a .code-editor--dark .header .paragraph {  margin: 0;}#element-8cb4ea78-64bf-4352-80ee-ca201edc138a .code-editor--dark .body-code {  margin: 0;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-bottom: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}#element-8cb4ea78-64bf-4352-80ee-ca201edc138a .code-editor--dark .body-code .editor {  margin: 0 20px;}</style><div id="element-8cb4ea78-64bf-4352-80ee-ca201edc138a" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">MyProblem.java - evaluate method</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;">The evaluate method begins by reading the values of the decision variables, x and y. &nbsp;Next, we compute the objectives, f1 and f2, and constraints, c1 and c2. &nbsp;The MOEA Framework only supports minimization problems. &nbsp;Therefore, if you have an objective that is maximized, simply negate the value. &nbsp;Constraints are satisfied only if their value is 0. &nbsp;Any non-zero constraint value is considered a violation and the solution is not feasible. &nbsp;In this example, we use the ternary if-else operator c1 &lt;= 0.0 ? 0.0 : c1 to set the constraint to 0 if it is satisfied and a non-zero value (c1) if the constraint is violated. &nbsp;Finally, we call <strong>setObjective</strong> and <strong>setConstraint</strong> to assign the objective and constraint values for the solution. &nbsp;The complete file is shown below:</div><div id="199286348457655038"><div><style type="text/css">        #element-278fc322-3240-474c-9f08-8ef581c25f6c .code-editor {  margin: 10px 0;}#element-278fc322-3240-474c-9f08-8ef581c25f6c .code-editor--light .header {  padding: 20px;  font-weight: bold;  border: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-278fc322-3240-474c-9f08-8ef581c25f6c .code-editor--light .header .paragraph {  margin: 0;}#element-278fc322-3240-474c-9f08-8ef581c25f6c .code-editor--light .body-code {  margin: 0;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-bottom: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-278fc322-3240-474c-9f08-8ef581c25f6c .code-editor--light .body-code .editor {  margin: 0 20px;}#element-278fc322-3240-474c-9f08-8ef581c25f6c .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-278fc322-3240-474c-9f08-8ef581c25f6c .code-editor--dark .header {  padding: 20px;  font-weight: bold;  border: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-278fc322-3240-474c-9f08-8ef581c25f6c .code-editor--dark .header .paragraph {  margin: 0;}#element-278fc322-3240-474c-9f08-8ef581c25f6c .code-editor--dark .body-code {  margin: 0;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-bottom: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}#element-278fc322-3240-474c-9f08-8ef581c25f6c .code-editor--dark .body-code .editor {  margin: 0 20px;}</style><div id="element-278fc322-3240-474c-9f08-8ef581c25f6c" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">MyProblem.java - Complete</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="wsite-adsense"></div><h2 class="wsite-content-title" style="text-align:left;"><br>&#8203;Solving the Problem</h2><div class="paragraph" style="text-align:left;">With the problem defined, we can now solve the problem using the <strong>Executor</strong> class. &nbsp;The executor provides convenient access to a variety of optimization algorithms. &nbsp;To begin, first create a new Java class within Eclipse called "MyProblemTest". &nbsp;Within this file, add the following text:</div><div id="694034839327403234"><div><style type="text/css">        #element-77187a9c-ab3e-4b31-9307-a7a2f5f46bca .code-editor {  margin: 10px 0;}#element-77187a9c-ab3e-4b31-9307-a7a2f5f46bca .code-editor--light .header {  padding: 20px;  font-weight: bold;  border: 1px solid #C9CDCF;  background-color: #F8F8F8;  color: #363B3E;}#element-77187a9c-ab3e-4b31-9307-a7a2f5f46bca .code-editor--light .header .paragraph {  margin: 0;}#element-77187a9c-ab3e-4b31-9307-a7a2f5f46bca .code-editor--light .body-code {  margin: 0;  border-left: 1px solid #C9CDCF;  border-right: 1px solid #C9CDCF;  border-bottom: 1px solid #C9CDCF;  background-color: #FFFFFF;  color: #666C70;}#element-77187a9c-ab3e-4b31-9307-a7a2f5f46bca .code-editor--light .body-code .editor {  margin: 0 20px;}#element-77187a9c-ab3e-4b31-9307-a7a2f5f46bca .code-editor--dark .ace-tomorrow-night-eighties {  background-color: #363B3E;}#element-77187a9c-ab3e-4b31-9307-a7a2f5f46bca .code-editor--dark .header {  padding: 20px;  font-weight: bold;  border: 1px solid #E0E1E2;  background-color: #666C70;  color: #FFFFFF;}#element-77187a9c-ab3e-4b31-9307-a7a2f5f46bca .code-editor--dark .header .paragraph {  margin: 0;}#element-77187a9c-ab3e-4b31-9307-a7a2f5f46bca .code-editor--dark .body-code {  margin: 0;  border-left: 1px solid #E0E1E2;  border-right: 1px solid #E0E1E2;  border-bottom: 1px solid #E0E1E2;  background-color: #363B3E;  color: #F8F8F8;}#element-77187a9c-ab3e-4b31-9307-a7a2f5f46bca .code-editor--dark .body-code .editor {  margin: 0 20px;}</style><div id="element-77187a9c-ab3e-4b31-9307-a7a2f5f46bca" class="platform-element-contents"><div class="code-editor--light"><div class="header"><div class="paragraph" style="text-align:left;">MyProblemTest.java</div></div><div class="body-code"><pre class="editor"></pre></div></div></div><div style="clear:both;"></div></div></div><div class="paragraph" style="text-align:left;">Then, right-click the file MyProblemTest.java and select Run As &gt; Java Application to compile and run this example.</div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/9821474_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">The output will appear in the Eclipse console. &nbsp;The output should appear similar to the screenshot below. &nbsp;Since the optimization algorithm, NSGA-II, is stochastic, it will produce different results every time this example is executed.</div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0;margin-right:0;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/4931847_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;"><span>This output contains the Pareto optimal solutions to this problem. &nbsp;Each line shows the two objectives for a single Pareto optimal solution. &nbsp;We can also visualize this data in a scatter plot to see the Pareto front:</span></div><div><div class="wsite-image wsite-image-border-none" style="padding-top:10px;padding-bottom:10px;margin-left:0px;margin-right:0px;text-align:center"><a><img src="http://keyboardscientist.weebly.com/uploads/1/3/9/3/13938370/6870230_orig.png" alt="Picture" style="width:auto;max-width:100%"></a><div style="display:block;font-size:90%"></div></div></div><div class="paragraph" style="text-align:left;">Using similar steps, you can implement your custom user-defined problem. &nbsp;The MOEA Framework is designed to be flexible and support a variety of problems. &nbsp; For instance, we can define problems in other programming languages using either <a href="http://moeaframework.org/javadoc/org/moeaframework/problem/ScriptedProblem.html">ScriptedProblem</a> or <a href="http://moeaframework.org/javadoc/org/moeaframework/problem/ExternalProblem.html">ExternalProblem</a>. &nbsp;The use of these classes will be described in a future blog post.</div><div><div id="219059493507544612" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"> </div></div>]]></content:encoded></item><item><title><![CDATA[Finding Statistically Significant Differences]]></title><link><![CDATA[http://keyboardscientist.weebly.com/blog/finding-statistically-significant-differences]]></link><comments><![CDATA[http://keyboardscientist.weebly.com/blog/finding-statistically-significant-differences#comments]]></comments><pubDate>Thu, 01 Oct 2015 17:07:44 GMT</pubDate><category><![CDATA[Java]]></category><category><![CDATA[MOEA Framework]]></category><category><![CDATA[Statistics]]></category><guid isPermaLink="false">http://keyboardscientist.weebly.com/blog/finding-statistically-significant-differences</guid><description><![CDATA[Suppose we have two datasets, which are typically called&nbsp;populations. &nbsp;We want to determine if the two datasets are similar in some way, such as having the same population mean. &nbsp;We could compare the mean value of each dataset, but what happens if one of the dataset, by random chance, contained unusually large values. &nbsp;We might incorrectly assert the datasets are different even if the underlying processes that generated the two datasets are identical. &nbsp;To avoid this pote [...] ]]></description><content:encoded><![CDATA[<div class="paragraph" style="text-align:left;">Suppose we have two datasets, which are typically called&nbsp;<em>populations</em>. &nbsp;We want to determine if the two datasets are similar in some way, such as having the same population mean. &nbsp;We could compare the mean value of each dataset, but what happens if one of the dataset, by random chance, contained unusually large values. &nbsp;We might incorrectly assert the datasets are different even if the underlying processes that generated the two datasets are identical. &nbsp;To avoid this potential problem, we turn to statistical tests to provide more rigor.</div><div><!--BLOG_SUMMARY_END--></div><div class="paragraph" style="text-align:left;">Statistical tests begin with a <em>null hypothesis</em>. &nbsp;For example, our null hypothesis could state that "populations A and B have equal mean values". &nbsp;The null hypothesis is generally assumed to be true unless evidence suggests otherwise. &nbsp;We use statistical tests to determine if we should reject the null hypothesis. &nbsp;Another way to interpret the null hypothesis is that chance (or randomness) alone is responsible for the result. &nbsp;If the null hypothesis is rejected by our statistical test, then any differences in the two populations is likely not the result of chance. &nbsp;We would say there is a statistically significant difference.<br><br>A statistical test can also be <em>parametric</em> or <em>non-parameteric</em>. &nbsp;A parametric test is one where we make an assumption about the probability distributions of the populations. &nbsp;For example, we could assume that A and B follow a normal distribution. &nbsp;Problems arise when this assumption is false, which lead the statistical test to report invalid results. &nbsp;If we are unable to make such assumptions, we can instead use non-parametric tests. &nbsp;Non-parametric tests do not make any assumptions concerning the distributions of the populations. &nbsp;As a result, non-parameteric tests are often "weaker" in that it becomes harder to reject the null hypothesis. &nbsp;However, they gain the advantage of being applicable to a broader range of datasets.<br><br>When applying statistical tests, we often refer to something called the&nbsp;<em><a href="https://en.wikipedia.org/wiki/Statistical_significance">significance level</a></em>, typically referred to with the greek letter &alpha;. &nbsp;In practice, we typically choose a significance level of 0.05 (5%) or less. &nbsp;If we choose a significance level of 5%, then we expect the statistical test to be incorrect 5% of the time.<br><br>There is debate in the scientific community as to the use of the significance level as a threshold of accepting scientific results. &nbsp;If we standardize the use of&nbsp;&alpha;=0.05, then we would expect 5% of academic papers using statistical testing to contain invalid results! &nbsp;Instead, they recommend reporting the so-called "<a href="https://en.wikipedia.org/wiki/P-value">p-value</a>". &nbsp;The p-value is the probability of attaining the given results assuming the null hypothesis is true. &nbsp;Thus, if p &lt;=&nbsp;<span>&alpha;, then we would reject the null hypothesis.</span><br><br>Below we will discuss six statistical tests with code examples. &nbsp;We will be using the statistics package from the <a href="http://moeaframework.org">MOEA Framework</a> (Java), which provides convenient classes for various statistical tests. &nbsp;Python users can use the <a href="http://docs.scipy.org/doc/scipy/reference/stats.html">scipy.stats</a> module.<br><br>For a detailed discussion of these statistical tests and more, please refer to <a href="http://www.amazon.com/gp/product/1439858012/ref=as_li_tl?ie=UTF8&amp;camp=1789&amp;creative=390957&amp;creativeASIN=1439858012&amp;linkCode=as2&amp;tag=mofr-20&amp;linkId=EFGM5PVJQETOFSI7">The Handbook of Parametric and Non-Parametric Statistical Procedures</a>.</div><h2 class="wsite-content-title" style="text-align:left;">Single Sample T Test</h2><div class="paragraph" style="text-align:left;"><strong>Type:</strong> Parametric - assumes normal distribution<br><strong>Null Hypothesis:</strong> The population's mean is X<br><br>&#8203;Assuming that (1) samples are drawn from the population randomly and (2) the distribution of the population follows a normal distribution, then the single sample T test can be used to determine if the mean of the population is equal to some value X. &nbsp;The single sample T test is applied when there is a single population.</div><div><div id="828453285974887323" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"><!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em 1.5em;padding:.2em .6em;"><table><tr><td><pre style="margin: 0; line-height: 125%"> 1 2 3 4 5 6 7 8 9101112131415161718192021222324252627</pre></td><td><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">org.moeaframework.util.statistics.SingleSampleTTest</span><span style="color: #333333">;</span><span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">class</span> <span style="color: #BB0066; font-weight: bold">Test</span> <span style="color: #333333">{</span>        <span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">static</span> <span style="color: #333399; font-weight: bold">void</span> <span style="color: #0066BB; font-weight: bold">main</span><span style="color: #333333">(</span>String<span style="color: #333333">[]</span> args<span style="color: #333333">)</span> <span style="color: #333333">{</span>                <span style="color: #888888">// null hypothesis: the mean is 5.0</span>                SingleSampleTTest test <span style="color: #333333">=</span> <span style="color: #008800; font-weight: bold">new</span> SingleSampleTTest<span style="color: #333333">(</span><span style="color: #6600EE; font-weight: bold">5.0</span><span style="color: #333333">);</span>                <span style="color: #888888">// add our samples</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">9</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">10</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">8</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">4</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">8</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">3</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">10</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">15</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">9</span><span style="color: #333333">);</span>                <span style="color: #888888">// test using a significance level of 5%</span>                <span style="color: #333399; font-weight: bold">boolean</span> result <span style="color: #333333">=</span> test<span style="color: #333333">.</span><span style="color: #0000CC">test</span><span style="color: #333333">(</span><span style="color: #6600EE; font-weight: bold">0.05</span><span style="color: #333333">);</span>                <span style="color: #888888">// result is false - the mean is likely 5.0</span>                System<span style="color: #333333">.</span><span style="color: #0000CC">out</span><span style="color: #333333">.</span><span style="color: #0000CC">println</span><span style="color: #333333">(</span>result<span style="color: #333333">);</span>        <span style="color: #333333">}</span><span style="color: #333333">}</span></pre></td></tr></table></div></div></div><h2 class="wsite-content-title" style="text-align:left;"><br>&#8203;Two Sample T Test</h2><div class="paragraph" style="text-align:left;"><strong>Type:&nbsp;</strong>Parametric - assumes normal distribution<br><strong>Null Hypothesis:&nbsp;</strong>The two population means are equal<br><br>Assuming that (1) samples are randomly drawn from each population and (2) the populations follow a normal distribution, then the two sample T test can be used to determine if two populations have equal means. &nbsp;The two sample T test is applied when there are exactly two populations.</div><div><div id="443782499487558898" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"><!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em 1.5em;padding:.2em .6em;"><table><tr><td><pre style="margin: 0; line-height: 125%"> 1 2 3 4 5 6 7 8 9101112131415161718192021222324252627</pre></td><td><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">org.moeaframework.util.statistics.TwoSampleTTest</span><span style="color: #333333">;</span><span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">class</span> <span style="color: #BB0066; font-weight: bold">Test</span> <span style="color: #333333">{</span>        <span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">static</span> <span style="color: #333399; font-weight: bold">void</span> <span style="color: #0066BB; font-weight: bold">main</span><span style="color: #333333">(</span>String<span style="color: #333333">[]</span> args<span style="color: #333333">)</span> <span style="color: #333333">{</span>                <span style="color: #888888">// setup test for independent samples (unpaired)</span>                TwoSampleTTest test <span style="color: #333333">=</span> <span style="color: #008800; font-weight: bold">new</span> TwoSampleTTest<span style="color: #333333">(</span><span style="color: #008800; font-weight: bold">true</span><span style="color: #333333">);</span>                <span style="color: #888888">// add our samples (the second argument specifies population 0 or 1)</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">11</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">2</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">11</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">11</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">5</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">8</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">4</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                <span style="color: #888888">// test using a significance level of 5%</span>                <span style="color: #333399; font-weight: bold">boolean</span> result <span style="color: #333333">=</span> test<span style="color: #333333">.</span><span style="color: #0000CC">test</span><span style="color: #333333">(</span><span style="color: #6600EE; font-weight: bold">0.05</span><span style="color: #333333">);</span>                <span style="color: #888888">// result is false - the two populations likely have the same mean</span>                System<span style="color: #333333">.</span><span style="color: #0000CC">out</span><span style="color: #333333">.</span><span style="color: #0000CC">println</span><span style="color: #333333">(</span>result<span style="color: #333333">);</span>        <span style="color: #333333">}</span><span style="color: #333333">}</span></pre></td></tr></table></div></div></div><h2 class="wsite-content-title" style="text-align:left;"><br>&#8203;One Way ANOVA</h2><div class="paragraph" style="text-align:left;"><strong>Type:&nbsp;</strong>Parametric - assumes normal distribution<br><strong>Null Hypothesis:&nbsp;</strong>All populations have equal means<br><br>Assuming that (1) samples are randomly drawn from each population, (2) the distribution of the underlying population is normal, and (3) the variances of the underlying populations are equal, then the one-way ANOVA test can be used to determine if N populations have identical means. &nbsp;The one-way ANOVA test, also called the single-factor between-subjects analysis of variance, is used when there are more than two populations.</div><div><div id="415719975177568898" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"><!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em 1.5em;padding:.2em .6em;"><table><tr><td><pre style="margin: 0; line-height: 125%"> 1 2 3 4 5 6 7 8 9101112131415161718192021222324252627282930313233</pre></td><td><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">org.moeaframework.util.statistics.OneWayANOVA</span><span style="color: #333333">;</span><span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">class</span> <span style="color: #BB0066; font-weight: bold">Test</span> <span style="color: #333333">{</span>        <span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">static</span> <span style="color: #333399; font-weight: bold">void</span> <span style="color: #0066BB; font-weight: bold">main</span><span style="color: #333333">(</span>String<span style="color: #333333">[]</span> args<span style="color: #333333">)</span> <span style="color: #333333">{</span>                <span style="color: #888888">// setup one-way ANOVA test with 3 populations</span>                OneWayANOVA test <span style="color: #333333">=</span> <span style="color: #008800; font-weight: bold">new</span> OneWayANOVA<span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">3</span><span style="color: #333333">);</span>                <span style="color: #888888">// add our samples (the second argument specifies the population)</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">8</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">10</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">9</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">10</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">9</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">7</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">8</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">5</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">8</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">5</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">4</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">2</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">8</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">2</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">7</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">2</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">5</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">2</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">7</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">2</span><span style="color: #333333">);</span>                                <span style="color: #888888">// test using a significance level of 5%</span>                <span style="color: #333399; font-weight: bold">boolean</span> result <span style="color: #333333">=</span> test<span style="color: #333333">.</span><span style="color: #0000CC">test</span><span style="color: #333333">(</span><span style="color: #6600EE; font-weight: bold">0.05</span><span style="color: #333333">);</span>                <span style="color: #888888">// result is true - it is likely at least one population</span>                <span style="color: #888888">// has a different mean</span>                System<span style="color: #333333">.</span><span style="color: #0000CC">out</span><span style="color: #333333">.</span><span style="color: #0000CC">println</span><span style="color: #333333">(</span>result<span style="color: #333333">);</span>        <span style="color: #333333">}</span><span style="color: #333333">}</span></pre></td></tr></table></div></div></div><div class="wsite-adsense"></div><h2 class="wsite-content-title" style="text-align:left;"><br>&#8203;Wilcoxon Signed Ranks Test</h2><div class="paragraph" style="text-align:left;"><strong>Type:&nbsp;</strong>Non-parametric<br><strong>Null Hypothesis:&nbsp;</strong>The population median equals X<br><br>Assuming that (1) samples are randomly drawn from the population and (2) the underlying population distribution is symmetrical (i.e., not skewed on one direction), then the Wilcoxon signed-ranks test determines if the population median is equal to some value X. &nbsp;This test is applied to a single population.</div><div><div id="734199909779759731" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"><!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em 1.5em;padding:.2em .6em;"><table><tr><td><pre style="margin: 0; line-height: 125%"> 1 2 3 4 5 6 7 8 9101112131415161718192021222324252627</pre></td><td><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">org.moeaframework.util.statistics.WilcoxonSignedRanksTest</span><span style="color: #333333">;</span><span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">class</span> <span style="color: #BB0066; font-weight: bold">Test</span> <span style="color: #333333">{</span>        <span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">static</span> <span style="color: #333399; font-weight: bold">void</span> <span style="color: #0066BB; font-weight: bold">main</span><span style="color: #333333">(</span>String<span style="color: #333333">[]</span> args<span style="color: #333333">)</span> <span style="color: #333333">{</span>                <span style="color: #888888">// null hypothesis: the median is 5.0</span>                WilcoxonSignedRanksTest test <span style="color: #333333">=</span> <span style="color: #008800; font-weight: bold">new</span> WilcoxonSignedRanksTest<span style="color: #333333">(</span><span style="color: #6600EE; font-weight: bold">5.0</span><span style="color: #333333">);</span>                <span style="color: #888888">// add our samples</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">9</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">10</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">8</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">4</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">8</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">3</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">10</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">15</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">9</span><span style="color: #333333">);</span>                <span style="color: #888888">// test using a significance level of 5%</span>                <span style="color: #333399; font-weight: bold">boolean</span> result <span style="color: #333333">=</span> test<span style="color: #333333">.</span><span style="color: #0000CC">test</span><span style="color: #333333">(</span><span style="color: #6600EE; font-weight: bold">0.05</span><span style="color: #333333">);</span>                <span style="color: #888888">// result is false - the population median is likely 5.0</span>                System<span style="color: #333333">.</span><span style="color: #0000CC">out</span><span style="color: #333333">.</span><span style="color: #0000CC">println</span><span style="color: #333333">(</span>result<span style="color: #333333">);</span>        <span style="color: #333333">}</span><span style="color: #333333">}</span></pre></td></tr></table></div></div></div><h2 class="wsite-content-title" style="text-align:left;"><br>Mann-Whitney U Test</h2><div class="paragraph" style="text-align:left;"><strong>Type:&nbsp;</strong>Non-parametric<br><strong>Null Hypothesis:&nbsp;</strong>The two populations have the same medians<br><br>Assuming that (1) samples are randomly drawn from each population, (2) samples are independent, and (3) the underlying distributions of the population are identical in shape, then the Mann-Whitney U test determines if two populations have the same median values. &nbsp;The Mann-Whitney U test is applied when there are exactly two populations.</div><div><div id="849022165640401157" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"><!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em 1.5em;padding:.2em .6em;"><table><tr><td><pre style="margin: 0; line-height: 125%"> 1 2 3 4 5 6 7 8 9101112131415161718192021222324252627</pre></td><td><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">org.moeaframework.util.statistics.MannWhitneyUTest</span><span style="color: #333333">;</span><span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">class</span> <span style="color: #BB0066; font-weight: bold">Test</span> <span style="color: #333333">{</span>        <span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">static</span> <span style="color: #333399; font-weight: bold">void</span> <span style="color: #0066BB; font-weight: bold">main</span><span style="color: #333333">(</span>String<span style="color: #333333">[]</span> args<span style="color: #333333">)</span> <span style="color: #333333">{</span>                <span style="color: #888888">// setup the Mann-Whitney U test</span>                MannWhitneyUTest test <span style="color: #333333">=</span> <span style="color: #008800; font-weight: bold">new</span> MannWhitneyUTest<span style="color: #333333">();</span>                <span style="color: #888888">// add our samples (the second argument specifies the population)</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">11</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">2</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">11</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">11</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">5</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">8</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                test<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">4</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                <span style="color: #888888">// test using a significance level of 5%</span>                <span style="color: #333399; font-weight: bold">boolean</span> result <span style="color: #333333">=</span> test<span style="color: #333333">.</span><span style="color: #0000CC">test</span><span style="color: #333333">(</span><span style="color: #6600EE; font-weight: bold">0.05</span><span style="color: #333333">);</span>                <span style="color: #888888">// result is false - the populations likely have identical medians</span>                System<span style="color: #333333">.</span><span style="color: #0000CC">out</span><span style="color: #333333">.</span><span style="color: #0000CC">println</span><span style="color: #333333">(</span>result<span style="color: #333333">);</span>        <span style="color: #333333">}</span><span style="color: #333333">}</span></pre></td></tr></table></div></div></div><h2 class="wsite-content-title" style="text-align:left;"><br>Kruskal-Wallis Test</h2><div class="paragraph" style="text-align:left;"><strong>Type:&nbsp;</strong>Non-parametric<br><strong>Null Hypothesis:&nbsp;</strong>All populations have equal medians<br><br>Assuming that (1) samples are randomly drawn from each population, (2) samples are independent, (3) the values being sampled are continuous, and (4) the underlying distribution of the populations are identical in shape, then the Kruskal-Wallis One-Way Analysis of Variance by Ranks tests determines if N populations have identical medians. &nbsp;The Kruskal-Wallis test is used when there are more than two populations.</div><div><div id="724117647842232900" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"><!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em 1.5em;padding:.2em .6em;"><table><tr><td><pre style="margin: 0; line-height: 125%"> 1 2 3 4 5 6 7 8 91011121314151617181920212223242526272829303132333435</pre></td><td><pre style="margin: 0; line-height: 125%"><span style="color: #008800; font-weight: bold">import</span> <span style="color: #0e84b5; font-weight: bold">org.moeaframework.util.statistics.KruskalWallisTest</span><span style="color: #333333">;</span><span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">class</span> <span style="color: #BB0066; font-weight: bold">Test</span> <span style="color: #333333">{</span>        <span style="color: #008800; font-weight: bold">public</span> <span style="color: #008800; font-weight: bold">static</span> <span style="color: #333399; font-weight: bold">void</span> <span style="color: #0066BB; font-weight: bold">main</span><span style="color: #333333">(</span>String<span style="color: #333333">[]</span> args<span style="color: #333333">)</span> <span style="color: #333333">{</span>                <span style="color: #888888">// setup the Kruskal-Wallis test for 3 populations</span>                KruskalWallisTest kw <span style="color: #333333">=</span> <span style="color: #008800; font-weight: bold">new</span> KruskalWallisTest<span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">3</span><span style="color: #333333">);</span>                <span style="color: #888888">// add our samples (the second argument specifies the population)</span>                kw<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">10</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                kw<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">11</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                kw<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">12</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                kw<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">13</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                kw<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">14</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                kw<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">15</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">0</span><span style="color: #333333">);</span>                kw<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">16</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                kw<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">17</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                kw<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">18</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                kw<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">19</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                kw<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">20</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                kw<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">21</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">1</span><span style="color: #333333">);</span>                kw<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">12</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">2</span><span style="color: #333333">);</span>                kw<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">13</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">2</span><span style="color: #333333">);</span>                kw<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">14</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">2</span><span style="color: #333333">);</span>                kw<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">15</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">2</span><span style="color: #333333">);</span>                kw<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">16</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">2</span><span style="color: #333333">);</span>                kw<span style="color: #333333">.</span><span style="color: #0000CC">add</span><span style="color: #333333">(</span><span style="color: #0000DD; font-weight: bold">17</span><span style="color: #333333">,</span> <span style="color: #0000DD; font-weight: bold">2</span><span style="color: #333333">);</span>                <span style="color: #888888">// test using a significance level of 5%</span>                <span style="color: #333399; font-weight: bold">boolean</span> result <span style="color: #333333">=</span> test<span style="color: #333333">.</span><span style="color: #0000CC">test</span><span style="color: #333333">(</span><span style="color: #6600EE; font-weight: bold">0.05</span><span style="color: #333333">);</span>                <span style="color: #888888">// result is true - the populations likely have different medians</span>                System<span style="color: #333333">.</span><span style="color: #0000CC">out</span><span style="color: #333333">.</span><span style="color: #0000CC">println</span><span style="color: #333333">(</span>result<span style="color: #333333">);</span>        <span style="color: #333333">}</span><span style="color: #333333">}</span></pre></td></tr></table></div></div></div><h2 class="wsite-content-title" style="text-align:left;"><br>Dealing with More than Two Populations</h2><div class="paragraph" style="text-align:left;">If we have N &gt; 2 populations and we want to determine which populations have statistically different means/medians, then special care must be taken. &nbsp;If we apply the two sample T test (for means) or Mann-Whitney U test (for medians) to each pair, then we increase the likelihood of errors. &nbsp;For example, if we use a significance level of &alpha;=0.05&nbsp;when comparing N=6 populations, then the probability that at least one test is incorrect is 1 - (1-&alpha;)^(N choose 2) = 0.53 or 53%.<br><br>To avoid this issue, we should first apply the statistical test for N &gt; 2 population. &nbsp;For example, we would apply the Kruskal-Wallis test if testing the median values. &nbsp;Then, if the test indicates the null hypothesis is rejected, we apply the Mann-Whitney U test to determine which populations have different median values.</div><div><div id="664509473162340745" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"> </div></div>]]></content:encoded></item><item><title><![CDATA[Publishing Your Code]]></title><link><![CDATA[http://keyboardscientist.weebly.com/blog/publishing-your-code]]></link><comments><![CDATA[http://keyboardscientist.weebly.com/blog/publishing-your-code#comments]]></comments><pubDate>Wed, 30 Sep 2015 16:15:07 GMT</pubDate><category><![CDATA[Deployment]]></category><category><![CDATA[Git]]></category><category><![CDATA[Licensing]]></category><guid isPermaLink="false">http://keyboardscientist.weebly.com/blog/publishing-your-code</guid><description><![CDATA[Congratulations!&nbsp; Your study has been accepted to a journal or conference.&nbsp; The burden of sending endless drafts to your adviser is over.&nbsp; Now what?One of the key metrics judging the contribution of a study is the number of citations it receives.&nbsp; More citations indicates more researchers are reading and (hopefully) learning from your work.&nbsp; If your study includes any type of computer code, providing your code to others will help increase accessibility and visibility.&nb [...] ]]></description><content:encoded><![CDATA[<div class="paragraph" style="text-align:left;">Congratulations!&nbsp; Your study has been accepted to a journal or conference.&nbsp; The burden of sending endless drafts to your adviser is over.&nbsp; Now what?<br><br>One of the key metrics judging the contribution of a study is the number of citations it receives.&nbsp; More citations indicates more researchers are reading and (hopefully) learning from your work.&nbsp; If your study includes any type of computer code, providing your code to others will help increase accessibility and visibility.&nbsp; In this post, we will discuss some of the considerations when deciding to release your code publicly.<br></div><div><!--BLOG_SUMMARY_END--></div><h2 class="wsite-content-title" style="text-align:left;">Free or Commercial</h2><div class="paragraph" style="text-align:left;">First, you should determine the acceptable use of your code. You spent many months or even years developing this code, and you have every right to choose how your work is used.&nbsp; If you want to promote your work to the widest possible audience, that release your code for free may be advantageous.&nbsp; However, if you have the desire to commercialize or sell your work, then you should consider a restricted, commercial license.<br><br>Additional factors may influence this decision.&nbsp; First, your institution may mandate certain rules pertaining to intellectual property (IP).&nbsp; For example, many universities and businesses have policies that require you to assign all IP to the organization if you used any computers, software, office space, or other resources belonging to the organization.&nbsp; Second, if your research was funded by a grant or other funding method, the contract may stipulate the license terms for deliverables.&nbsp; Finally, in many cases you will have collaborators who may have differing opinions on how to best distribute the code.&nbsp; Agreement upon licensing and IP rights will be required (and it's often better to discuss these issues early...and finalize any agreements in writing).</div><div class="wsite-adsense"></div><h2 class="wsite-content-title" style="text-align:left;">Choosing a License<br></h2><div class="paragraph" style="text-align:left;">When releasing software, it is important to include a software license.&nbsp; The license defines the permissible uses of your software.&nbsp; Free and open source licenses typically grant extensive freedoms for anyone to use, modify, and distributed your software.&nbsp; More restrictive licenses place limits on the use of software, such as restricting the use of software in commercial products or requiring license fees.&nbsp; In addition, licenses offer protections for you and your institution.&nbsp; Most software licenses include clauses that disclaim or limit warranties or liabilities for damages.&nbsp; While there exists hundreds of licenses of various forms and flavors, below we discuss three that are commonly used for academic software.<br><br><strong>MIT License -</strong> The MIT License is a permissive license that allows your software to be used freely in open source and commercial products.&nbsp; We encourage the use of this license for academic code as it facilitates widespread adoption.<br><br><strong>GPL License -</strong> The GNU General Public License, or GNU GPL, is best for situations where you want to distribute the software freely for academic use, but discourage commercial use.&nbsp; Note that the GPL does not prevent commercial use, but would require the company to release their proprietary software under the GPL.&nbsp; This "copyleft" nature of the GPL is often sufficient to prevent commercial use.<br><br><strong>Commercial License</strong> - If you want to completely restrict commercial use or prevent the free distribution of your software, then you will need to draft a commercial license.&nbsp; Your institution's IP office should be consulted for more information.<br><br><em>Disclaimer: Software licenses have many clauses concerning patent rights and other important factors.&nbsp; In addition, the choice of license may be affected if your software uses any third-party products or libraries.&nbsp; Please read the full license and/or consult with your institution's IP office for more details.</em></div><div class="wsite-adsense"></div><h2 class="wsite-content-title" style="text-align:left;">Preparing Software for Release<br></h2><div class="paragraph" style="text-align:left;">Now that you have selected a software license, the next step is add the license to your source code.&nbsp; This involves two steps:<ol><li>Creating a LICENSE file</li><li>Adding headers to each source code file</li></ol>First, you will create a LICENSE file to store the terms and conditions of the selected license.&nbsp; I typically call this file LICENSE or LICENSE.txt.&nbsp; If using the GNU GPL, the license file is typically called COPYING.&nbsp; Next, copy-and-paste the terms and conditions of the selected license into this file. &nbsp;For example, use either the&nbsp;<a href="https://opensource.org/licenses/MIT">MIT license</a> or the <a href="http://www.gnu.org/licenses/gpl-3.0.txt">GNU GPL license</a>.<br><br>Next, you will want to add headers to each source file.&nbsp; The header will contain your copyright notice and information about the license.&nbsp; It is important to add the license header to every file since your future users may copy only parts of your code.&nbsp; For the MIT license, copy-and-paste the following to the top of every source code file:</div><div><div id="233989726413543053" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"><!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em 1.5em;padding:.2em .8em;"><pre style="margin: 0; line-height: 125%"><span style="color: #888888">/* Copyright &lt;year&gt; &lt;your name&gt;</span><span style="color: #888888"> * </span><span style="color: #888888"> * Permission is hereby granted, free of charge, to any person obtaining a copy</span><span style="color: #888888"> * of this software and associated documentation files (the "Software"), to deal</span><span style="color: #888888"> * in the Software without restriction, including without limitation the rights</span><span style="color: #888888"> * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell</span><span style="color: #888888"> * copies of the Software, and to permit persons to whom the Software is</span><span style="color: #888888"> * furnished to do so, subject to the following conditions:</span><span style="color: #888888"> * </span><span style="color: #888888"> * The above copyright notice and this permission notice shall be included in</span><span style="color: #888888"> * all copies or substantial portions of the Software.</span><span style="color: #888888"> * </span><span style="color: #888888"> * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR</span><span style="color: #888888"> * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,</span><span style="color: #888888"> * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE</span><span style="color: #888888"> * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER</span><span style="color: #888888"> * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,</span><span style="color: #888888"> * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN</span><span style="color: #888888"> * THE SOFTWARE.</span><span style="color: #888888"> */</span></pre></div></div></div><div class="paragraph" style="text-align:left;"><br>For the GNU GPL, use the following header:<br></div><div><div id="906590696575683900" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"><!-- HTML generated using hilite.me --><div style="background: #ffffff; overflow:auto;width:auto;border:solid gray;border-width:.1em .1em .1em 1.5em;padding:.2em .8em;"><pre style="margin: 0; line-height: 125%"><span style="color: #888888">/* Copyright &lt;year&gt; &lt;your name&gt;</span><span style="color: #888888"> * </span><span style="color: #888888"> * This file is part of &lt;library name&gt;</span><span style="color: #888888"> * </span><span style="color: #888888"> * &lt;library name&gt; is free software: you can redistribute it and/or modify</span><span style="color: #888888"> * it under the terms of the GNU General Public License as published by</span><span style="color: #888888"> * the Free Software Foundation, either version 3 of the License, or</span><span style="color: #888888"> * (at your option) any later version.</span><span style="color: #888888"> * </span><span style="color: #888888"> * &lt;library name&gt; is distributed in the hope that it will be useful,</span><span style="color: #888888"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span><span style="color: #888888"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span><span style="color: #888888"> * GNU General Public License for more details.</span><span style="color: #888888"> * </span><span style="color: #888888"> * You should have received a copy of the GNU General Public License</span><span style="color: #888888"> * along with Foobar.  If not, see &lt;http://www.gnu.org/licenses/&gt;.</span><span style="color: #888888"> */</span></pre></div></div></div><h2 class="wsite-content-title" style="text-align:left;"><br>Distributing Your Code</h2><div class="paragraph" style="text-align:left;">Your code is now ready to be released into the wild.&nbsp; If you chose an open source library, such as the MIT or GNU GPL licenses, then you can post your code onto the internet for all to access.&nbsp; Nowadays, many academics are sharing code on <a href="http://github.com">Github.com</a>.&nbsp; Not only does Github provide free hosting for open source projects, Git facilitates distributed sharing of code.&nbsp; For example, another researcher in your field can "fork" your code (i.e., create a copy) to use in their projects.&nbsp; If that researcher fixes bugs or provides any enhancements to your software, they can "push" those changes back to you.&nbsp; This development model encourages collaboration with your peers.<br><br>A Git tutorial will be provided in a future blog post.</div><div><div id="199471265237869189" align="left" style="width: 100%; overflow-y: hidden;" class="wcustomhtml"> </div></div>]]></content:encoded></item><item><title><![CDATA[Welcome]]></title><link><![CDATA[http://keyboardscientist.weebly.com/blog/creating]]></link><comments><![CDATA[http://keyboardscientist.weebly.com/blog/creating#comments]]></comments><pubDate>Wed, 30 Sep 2015 14:25:45 GMT</pubDate><category><![CDATA[Uncategorized]]></category><guid isPermaLink="false">http://keyboardscientist.weebly.com/blog/creating</guid><description><![CDATA[In many fields today, science is increasingly conducted on a computer.&nbsp; Engineers build computer models of their system, data scientists manipulate and analyze massive datasets, and many other disciplines are utilizing computer simulations and modeling in their workflow.&nbsp; As a computer scientist, I spend most of my day working on a computer.&nbsp; In this blog, I hope to share my experiences and best practices across a range of topics relevant to scientists.     [...] ]]></description><content:encoded><![CDATA[<div class="paragraph" style="text-align:left;">In many fields today, science is increasingly conducted on a computer.&nbsp; Engineers build computer models of their system, data scientists manipulate and analyze massive datasets, and many other disciplines are utilizing computer simulations and modeling in their workflow.&nbsp; As a computer scientist, I spend most of my day working on a computer.&nbsp; In this blog, I hope to share my experiences and best practices across a range of topics relevant to scientists.<br /></div>  <div>  <!--BLOG_SUMMARY_END--></div>]]></content:encoded></item></channel></rss>