Commit 36e9e59d authored by Helene Arduin's avatar Helene Arduin
Browse files

Merge branch '9-dev' of https://gitlab.openmole.org/openmole/openmole into 9-dev

parents 9f24c22e 1d832d72
Pipeline #280 failed with stage
in 4 minutes and 41 seconds
......@@ -233,17 +233,18 @@ lazy val mgo = OsgiProject(dir, "mgo", exports = Seq("mgo.*", "freestyle.*"), im
version := mgoVersion) dependsOn(monocle, math, cats, squants) settings(settings: _*)
/*lazy val spatialdataVersion = "0.1-SNAPSHOT"
lazy val spatialdataVersion = "0.1-SNAPSHOT"
lazy val spatialdata = OsgiProject(dir, "org.openmole.spatialdata",
exports = Seq("org.openmole.spatialdata.*"),
imports = Seq("!*") //Seq("!org.apache.commons.math3.*","!better.*", "*")
, privatePackages = Seq("**"),//privatePackages = Seq("!scala.*","!org.apache.commons.math3.*" , "*")
) settings( // ,"**"
privatePackages = Seq("!scala.*","!org.apache.commons.math3.*","*")
) settings(
libraryDependencies += "org.openmole.library" %% "spatialdata" % spatialdataVersion,
version := spatialdataVersion,
OsgiKeys.embeddedJars := (Keys.externalDependencyClasspath in Compile).value map (_.data) filter (f=> (f.getName startsWith "gt-"))
) settings(settings: _*)*/
version := spatialdataVersion//,
//embeddedJars := (Keys.externalDependencyClasspath in Compile).value map (_.data) filter (f=> (f.getName startsWith "gt-")) // embed geotools jars
) settings(settings: _*)
......
......@@ -7,10 +7,10 @@
@h2{Sensitivity analysis}
Sensitivity analysis is the study of how a model reacts to a change in its inputs.
Sensitivity analysis correspond to a set of methods capturing how a model reacts to a change in its inputs.
The goal of these statistical methods is to measure how variation propagates from the inputs to the outputs.
More specifically, A. Saltelli defines Sensitivity Analysis as describing the «relative importance of each input in determining [output] variability».
As a consequence, typical result of such methods is an ordering of its inputs according to their sensitivity.
More specifically, sensitivity analysis is defined by (Saltelli et al., 2008) as describing the «relative importance of each input in determining [output] variability».
As a consequence, typical result of such methods is an ordering of its inputs according to their sensitivity.
@br
......@@ -18,30 +18,30 @@ Sensitivity analysis generally involve an a priori sampling of the input space a
@br@br
Sensitivity analysis comes in two flavors : global, and local.
Global methods depict the effects of inputs variation in the complete input space, local methods depict the effect of inputs variation around a given point of the input space.
Sensitivity analysis can be done at a global or local level.
Global methods provide summary statistics of the effects of inputs variation in the complete input space, whereas local methods focus the effect of inputs variation around a given point of the input space (think of a Jacobian matrix e.g.).
The @aa("one factor at a time method", href := DocumentationPages.elementarySamplings.file) can be viewed as a local sensitivity method, as only one factor vary, the other remaining fixed at their nominal value.
@br
OpenMOLE offers 2 methods for global sensitivity analysis: Morris and Saltelli.
OpenMOLE implements two classical methods for global sensitivity analysis: Morris and Saltelli.
@h2{Morris' method}
@h3{Principle}
@aa("Morris", href := "https://en.wikipedia.org/wiki/Morris_method") is a statistical method for global sensitivity analysis.
It's a @i{screening} method, which means that the input space is (surprise!) @i{screened}, @i{i.e.} sampled via a grid sampling with fixed binwidth in each dimension.
Resulting samples are evenly spaced in the input hypercube: in each dimension there is the same number of points.
This number is a parameter of the method and determines the thickness of hypercube "slices".
@aa("Morris method", href := "https://en.wikipedia.org/wiki/Morris_method") is a statistical method for global sensitivity analysis.
This method is of the type "one-factor-at-a-time", and was conceived as a preliminary computational experiment, to grasp the relative influence of each factor.
In comparison to LHS screening, it has the advantage to provide information for each factor.
@br@br
Trajectories are sampled among these points; the idea of the method is to observe output variation when one of the trajectory points is moved to one of its closest neighbors.
It generates a small variation called "elementary effect".
A certain number of trajectories are generated, in order to observe the consequence of elementary effects "almost everywhere" in the input space.
Then, the method uses these elementary effect as base material to estimate consequent variation in the output space.
The input space is considered as a grid and trajectories are sampled among these points.
The method captures output variation when one of the trajectory points is moved to one of its closest neighbors.
This variation is called an elementary effect.
A certain number of trajectories are generated, in order to observe the consequence of elementary effects anywhere in the input space
(trajectories are generated such that given a starting point, any point at fixed distance is equiprobable - note that the method is still subject
to the curse of dimensionality for trajectories to fill the input space).
Finally, the method summarizes these elementary effect to estimate global sensitivity in the output space.
@h3{Results and Interpretation}
......@@ -108,7 +108,7 @@ Paper describing method and its evaluation : @a("Campolongo F, Saltelli A, Cari
@h2{Saltelli's method}
Saltelli is a statistical method for global sensitivity analysis
Saltelli is a statistical method for global sensitivity analysis. It estimates at the first order the relative variance along each input factor.
......
......@@ -471,7 +471,7 @@ lazy val sensitivity = OsgiProject(pluginDir, "org.openmole.plugin.method.sensit
/* Sampling */
// FIXME problem with osgi bundling for spatialSampling
def allSampling = Seq(combineSampling, csvSampling,oneFactorSampling, lhsSampling, quasirandomSampling)//, spatialSampling)
def allSampling = Seq(combineSampling, csvSampling,oneFactorSampling, lhsSampling, quasirandomSampling, spatialSampling)
lazy val combineSampling = OsgiProject(pluginDir, "org.openmole.plugin.sampling.combine", imports = Seq("*")) dependsOn(exception, modifierDomain, collectionDomain, workflow) settings (pluginSettings: _*)
......@@ -487,6 +487,7 @@ lazy val quasirandomSampling = OsgiProject(pluginDir, "org.openmole.plugin.sampl
libraryDependencies += Libraries.math
) settings (pluginSettings: _*)
lazy val spatialSampling = OsgiProject(pluginDir, "org.openmole.plugin.sampling.spatial", imports = Seq("*")) dependsOn(exception, workflow, workspace) settings (
libraryDependencies += Libraries.math,
libraryDependencies += Libraries.spatialdata
......@@ -732,11 +733,11 @@ def binDir = file("bin")
def bundleFilter(m: ModuleID, artifact: Artifact) = {
def excludedLibraryDependencies = Set("slick", "squants", "shapeless", "sourcecode", "eddsa", "sshj")
def exclude =
def exclude =
(m.organization != "org.openmole.library" && excludedLibraryDependencies.exists(m.name.contains)) ||
(m.name contains "scala-xml") ||
(m.name contains "protobuf")
(m.name contains "protobuf") ||
(m.name contains "jts-core") || (m.name contains "si-quantity") || (m.name contains "systems-common-java8") || (m.name contains "uom-lib-common") || (m.name contains "unit-api") || (m.name contains "uom-se") // geotools bundled dependancies
def include = (artifact.`type` == "bundle" && m.name != "osgi") ||
//(m.name == "sshj") ||
......
......@@ -33,7 +33,17 @@ object PostStepTask {
if (inside) 1.0 / volume else 0.0
}
val xs = observed.toArray.map(o ABC.Observed.fromContext(o, context).flatten).transpose
def zipObserved(obs: Array[Array[Array[Double]]]) = {
def zip2(o1: Array[Array[Double]], o2: Array[Array[Double]]) =
for {
l1 o1
l2 o2
} yield l1 ++ l2
obs.reduceLeft { zip2 }
}
val xs = zipObserved(observed.toArray.map(o ABC.Observed.fromContext(o, context)))
val s = Try(MonAPMC.postStep(n, nAlpha, density, observed.flatMap(o ABC.Observed.value(o)).toArray, context(stepState), xs)(random()))
......
......@@ -29,8 +29,6 @@ package object abc {
implicit def intObservable = Observable[Int](i Array(i.toDouble))
implicit def doubleObservable = Observable[Double](d Array(d))
implicit def iterableDouble = Observable[Iterable[Double]](_.toArray)
implicit def iterableInt = Observable[Iterable[Int]](i i.toArray.map(_.toDouble))
implicit def arrayDouble = Observable[Array[Double]](identity)
implicit def arrayInt = Observable[Array[Int]](_.map(_.toDouble))
}
......@@ -39,7 +37,13 @@ package object abc {
def apply(t: T): Array[Double]
}
implicit def tupleToObserved[T: Observable](t: (Val[T], T)) = Observed(t._1, t._2)
implicit def tupleIntToObserved(t: (Val[Int], Int)) = Observed(t._1, t._2)
implicit def tupleDoubleToObserved(t: (Val[Double], Double)) = Observed(t._1, t._2)
implicit def tupleIterableIntToObserved(t: (Val[Array[Int]], Iterable[Int])) = Observed(t._1, t._2.toArray)
implicit def tupleIterableDoubleToObserved(t: (Val[Array[Double]], Iterable[Double])) = Observed(t._1, t._2.toArray)
implicit def tupleIterableArrayIntToObserved(t: (Val[Array[Int]], Array[Int])) = Observed(t._1, t._2)
implicit def tupleIterableArrayDoubleToObserved(t: (Val[Array[Double]], Array[Double])) = Observed(t._1, t._2)
//implicit def tupleToObserved[T: Observable](t: (Val[T], T)) = Observed(t._1, t._2)
def fromContext[T](observed: Observed[T], context: Context) = context(observed.v.array).map(v observed.obs(v))
def value[T](observed: Observed[T]) = observed.obs(observed.observed)
......@@ -49,13 +53,6 @@ package object abc {
case class ABCParameters(state: Val[MonAPMC.MonState], step: Val[Int], prior: Seq[Prior])
implicit class ABCContainer(dsl: DSLContainer[ABCParameters]) extends DSLContainerHook(dsl) {
def hook(directory: FromContext[File]): DSLContainer[ABC.ABCParameters] = {
implicit val defScope = dsl.scope
dsl hook ABCHook(dsl, directory)
}
}
def apply(
evaluation: DSL,
prior: Seq[Prior],
......@@ -158,7 +155,14 @@ package object abc {
stop = stop
)
DSLContainerExtension(DSLContainer(masterSlave), output = Some(master), delegate = Vector(slave), data = ABCParameters(masterState, step, prior))
DSLContainerExtension[ABCParameters](DSLContainer(masterSlave), output = Some(master), delegate = Vector(slave), data = ABCParameters(masterState, step, prior))
}
implicit class ABCContainer(dsl: DSLContainer[ABCParameters]) extends DSLContainerHook(dsl) {
def hook(directory: FromContext[File]): DSLContainer[ABC.ABCParameters] = {
implicit val defScope = dsl.scope
dsl hook ABCHook(dsl, directory)
}
}
}
......@@ -102,7 +102,7 @@ object Libraries {
lazy val netlogo6 = "org.openmole.library" % "ccl-northwestern-edu-netlogo6" % netLogo6Version
lazy val sourceCode = "org.openmole.library" %% "sourcecode" % sourcecodeVersion
lazy val txtmark = "org.openmole.library" %% "com-github-rjeschke-txtmark" % "0.13"
lazy val spatialdata = "org.openmole.library" %% "spatialdata" % spatialdataVersion
lazy val spatialdata = "org.openmole.library" %% "org-openmole-spatialdata" % spatialdataVersion
def httpClientVersion = "4.5.3"
lazy val httpClient =
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment