Request for Changes68: New sampling strategies in classification framework
From OTBWiki
Contents
Status
 Author: Julien Michel
 Submitted on 29.09.2016
 Proposed target release: 5.8
 Adopted (+3 from Julien, Victor, Guillaume)
 Merged : 9e365928a8cc13b283ab6ddd78e9b1984db68329
Summary
This RFC adds two new strategies for sample selection :
 Set a global percentage of samples to use
 Set a total number of samples to generate
These new strategies are added both in single image and multiimages mode.
Rationale
Need expressed in this otbusers thread:
https://groups.google.com/forum/#!topic/otbusers/yRG_XKThcAs
Implementation details
In monoimage mode the behavior is as follows:
 percent strategy : Use p*N(c) samples among N(c) samples available for class c, where p is the target percentage
 total strategy : Use t*R(c) samples, where R(c) is the proportion of class c and T is the target number of samples
In multiimage mode, the behavior is as follows:
 percent strategy : For each image i and each class c:
 if mode is proportional, then Ni( c ) = p * Ti( c ) where p is the global percentage of samples
 if mode is equal , then Ni( c ) = p * sum_k(Tk(c)]/L where p is the global percentage of samples
 if moide is custom , then Ni( c ) = p(i) * Ti(c) where p(i) is the percentage of samples for image i. c
 total strategy : For each image i and each class c:
 if mode is proportional, then Ni( c ) = total * (sum_k(Ti(k))/sum_kl(Tl(k))) * (Ti(c)/sum_k(Ti(k))) where total is the total number of samples specified.
 if mode is equal , then Ni( c ) = (total / L) * (Ti(c)/sum_k(Ti(k))) where total is the total number of samples specified.
 if mode is custom , then Ni( c ) = total(i) * (Ti(c)/sum_k(Ti(k))) where total(i) is the total number of samples specified for image i.
Classes and files

otb::SamplingRateCalculator
has two new methods to set the global percentage or number of samples 
otb::SamplingRateCalculatorList
has two new methods to set the global percentage or number of samples
Applications

SampleSelection
application has been udpated to propose the two new modes 
MultiImageSamplingRates
application has been udpated to propose the two new modes
Tests
Test for otb::SamplingRateCalculatorList
class has been updated to test the two new modes.
Dashboard came green: http://dash.orfeotoolbox.org/viewTest.php?onlypassed&buildid=246928
Documentation
 Classes documentation has been updated
 Applications documentation has been updated
 Cookbook has been update BUT for some reason the layout of section "Working with several images" is broken for the new modes even if the RST code is exactly the same as for other section. I will not fix this, I leave it to someone that understand (and like) the twisted RST logic (and I start to regret having +1 the RST cookbook RFC).