Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use latest fsdocs #15

Merged
merged 10 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@
"paket"
]
},
"fsharp.formatting.commandtool": {
"version": "11.4.3",
"commands": [
"fsdocs"
]
},
"fantomas": {
"version": "6.3.1",
"commands": [
"fantomas"
]
},
"fsdocs-tool": {
"version": "20.0.0",
"commands": [
"fsdocs"
]
}
}
}
10 changes: 5 additions & 5 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Target.create "RunTests" (fun _ ->
let rHome = Environment.environVarOrFail "R_HOME"
Trace.logf "R_HOME is set as %s" rHome
let result = Fake.DotNet.DotNet.exec (fun args ->
{ args with Verbosity = Some Fake.DotNet.DotNet.Verbosity.Normal}) "test" ("bristlecone.sln")
{ args with Verbosity = Some Fake.DotNet.DotNet.Verbosity.Normal}) "run" ("--project tests/Bristlecone.Tests")
if result.ExitCode <> 0 then failwith "Tests failed"
)

Expand Down Expand Up @@ -157,9 +157,9 @@ Target.create "DocsMeta" (fun _ ->
sprintf "<PackageIconUrl>%s/master/docs/content/logo.png</PackageIconUrl>" repositoryContentUrl
sprintf "<PackageTags>%s</PackageTags>" tags
sprintf "<Version>%s</Version>" release.NugetVersion
sprintf "<FsDocsLogoSource>%s/master/docs/img/logo.png</FsDocsLogoSource>" repositoryContentUrl
sprintf "<FsDocsLicenseLink>%s/blob/master/LICENSE.md</FsDocsLicenseLink>" repositoryUrl
sprintf "<FsDocsReleaseNotesLink>%s/blob/master/RELEASE_NOTES.md</FsDocsReleaseNotesLink>" repositoryUrl
sprintf "<FsDocsLogoSource>/img/logo.png</FsDocsLogoSource>"
sprintf "<FsDocsLicenseLink>%s/blob/master/LICENSE</FsDocsLicenseLink>" repositoryUrl
sprintf "<FsDocsReleaseNotesLink>%s/blob/master/RELEASE_NOTES.MD</FsDocsReleaseNotesLink>" repositoryUrl
"<FsDocsWarnOnMissingDocs>true</FsDocsWarnOnMissingDocs>"
"<FsDocsTheme>default</FsDocsTheme>"
"</PropertyGroup>"
Expand All @@ -169,7 +169,7 @@ Target.create "DocsMeta" (fun _ ->

Target.create "GenerateDocs" (fun _ ->
Fake.IO.Shell.cleanDir ".fsdocs"
DotNet.exec id "fsdocs" "build --clean" |> ignore
DotNet.exec id "fsdocs" "build --clean --eval --strict" |> ignore
)

// --------------------------------------------------------------------------------------
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions docs/_head.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<script src="https://cdn.plot.ly/plotly-2.21.0.min.js"></script>
Empty file added docs/_template.ipynb
Empty file.
30 changes: 15 additions & 15 deletions docs/confidence-intervals.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ index: 5
#r "../src/Bristlecone/bin/Release/netstandard2.0/Bristlecone.dll"
(*** condition: fsx ***)
#if FSX
#r "nuget: Bristlecone,{{package-version}}"
#r "nuget: Bristlecone,{{fsdocs-package-version}}"
#endif // FSX
(*** condition: ipynb ***)
#if IPYNB
#r "nuget: Bristlecone,{{package-version}}"
#r "nuget: Bristlecone,{{fsdocs-package-version}}"
#endif // IPYNB

(**
Expand All @@ -37,20 +37,20 @@ open Bristlecone
open Bristlecone.Optimisation
open Bristlecone.Data

// fitFn =
fun engine dataset hypothesis result ->
// // fitFn =
// fun engine dataset hypothesis result ->

// The function used to fit the model, which unless an
// advanced scenario is usually Bristlecone.fit
let fitFn = Bristlecone.fit
// // The function used to fit the model, which unless an
// // advanced scenario is usually Bristlecone.fit
// let fitFn = Bristlecone.fit

// The number of jumps to perform in parameter space
let n = 10000
// // The number of jumps to perform in parameter space
// let n = 10000

let ci = ConfidenceInterval.ProfileLikelihood.profile fitFn engine dataset hypothesis n result
// let ci = ConfidenceInterval.ProfileLikelihood.profile fitFn engine dataset hypothesis n result

// Optionally, save the result
let saveDir = "/some/save/dir"
let subjectName = "some subject"
let modelId = "some model hypothesis"
Confidence.save saveDir subjectName modelId result.ResultId ci
// // Optionally, save the result
// let saveDir = "/some/save/dir"
// let subjectName = "some subject"
// let modelId = "some model hypothesis"
// Confidence.save saveDir subjectName modelId result.ResultId ci
6 changes: 3 additions & 3 deletions docs/data.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
title: Loading and Saving Data
category: Techniques
categoryindex: 2
index: 1
index: 6
---
*)

Expand All @@ -12,11 +12,11 @@ index: 1
#r "../src/Bristlecone/bin/Release/netstandard2.0/Bristlecone.dll"
(*** condition: fsx ***)
#if FSX
#r "nuget: Bristlecone,{{package-version}}"
#r "nuget: Bristlecone,{{fsdocs-package-version}}"
#endif // FSX
(*** condition: ipynb ***)
#if IPYNB
#r "nuget: Bristlecone,{{package-version}}"
#r "nuget: Bristlecone,{{fsdocs-package-version}}"
#endif // IPYNB

(**
Expand Down
4 changes: 2 additions & 2 deletions docs/dendro.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ index: 1
#r "../src/Bristlecone/bin/Release/netstandard2.0/Bristlecone.dll"
(*** condition: fsx ***)
#if FSX
#r "nuget: Bristlecone,{{package-version}}"
#r "nuget: Bristlecone,{{fsdocs-package-version}}"
#endif // FSX
(*** condition: ipynb ***)
#if IPYNB
#r "nuget: Bristlecone,{{package-version}}"
#r "nuget: Bristlecone,{{fsdocs-package-version}}"
#endif // IPYNB

(**
Expand Down
10 changes: 5 additions & 5 deletions docs/diagnostics.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ index: 5
#r "../src/Bristlecone/bin/Release/netstandard2.0/Bristlecone.dll"
(*** condition: fsx ***)
#if FSX
#r "nuget: Bristlecone,{{package-version}}"
#r "nuget: Bristlecone,{{fsdocs-package-version}}"
#endif // FSX
(*** condition: ipynb ***)
#if IPYNB
#r "nuget: Bristlecone,{{package-version}}"
#r "nuget: Bristlecone,{{fsdocs-package-version}}"
#endif // IPYNB

(**
Expand Down Expand Up @@ -69,9 +69,9 @@ of the `IComponentLogger<float>)` type:
[ NB TODO: This function must be refactored to work with the new Bristlecone Language ]
*)

open Bristlecone
open Bristlecone.Language
open Bristlecone.Diagnostics.ModelComponents
// open Bristlecone
// open Bristlecone.Language
// open Bristlecone.Diagnostics.ModelComponents

// let hypothesis (cLog:IComponentLogger<ModelExpression>) =

Expand Down
51 changes: 48 additions & 3 deletions docs/estimation-engine.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ index: 3
#r "../src/Bristlecone/bin/Release/netstandard2.0/Bristlecone.dll"
(*** condition: fsx ***)
#if FSX
#r "nuget: Bristlecone,{{package-version}}"
#r "nuget: Bristlecone,{{fsdocs-package-version}}"
#endif // FSX
(*** condition: ipynb ***)
#if IPYNB
#r "nuget: Bristlecone,{{package-version}}"
#r "nuget: Bristlecone,{{fsdocs-package-version}}"
#endif // IPYNB

(**
Expand All @@ -31,4 +31,49 @@ will suffice for all model hypotheses.

Forthcoming

*)
*)


(**## Time Modes

Bristlecone can run models in either discrete time, or continuous time. When running models in continuous time, an integration function is required:
*)

(**
Currently only fixed timesteps are supported, but variable timestep support (e.g. for sediment core data) is planned.

Two integration functions are included:

| Solver | Function | Description |
| - | - | - |
| Runge-Kutta 4 (MathNet Numerics) | ``Integration.MathNet.integrate`` | A fourth-order Runge Kutta method to provide approximate solutions to ODE systems. |
| Runge-Kutta 547M (Open Solving Library for ODEs - Microsoft Research) | ``Integration.MsftOslo.integrate`` | A method based on classic Runge-Kutta, but with automatic error and step size control. [See the documentation](https://www.microsoft.com/en-us/research/wp-content/uploads/2014/07/osloUserGuide.pdf).|

## Optimisation

Bristlecone supports optimisation functions that have the following type signature:

```fsharp
type Optimise<'data> = int -> int -> Domain -> ('data[] -> 'data) -> ('data * 'data []) list
```

There are two optimsation techniques currently built-in:

| Method | Function | Description |
| - | - | - |
| Amoeba (Nelder-Mead) | ``Optimisation.Amoeba.solve`` | A gradient-descent method. |
| MCMC Random Walk | ``Optimisation.MonteCarlo.randomWalk`` | A method based on classic Runge-Kutta, but with automatic error and step size control. [See the documentation](https://www.microsoft.com/en-us/research/wp-content/uploads/2014/07/osloUserGuide.pdf).|


## Estimation Engines

To use Bristlecone functions requires a configured ``EstimationEngine``. The easiest way is with the helper functions within the ``Bristlecone`` module:

| Function | Type | Description |
| - | - | - |
| ``mkContinuous`` | EstimationEngine | Default continuous engine |
| ``mkDiscrete`` | EstimationEngine | Default discrete model engine |
| ``withContinuousTime`` | t : Integrate<'a,'b> -> engine: EstimationEngine<'a,'b> -> EstimationEngine<'a,'b> | Transforms engine to continuous time mode, using the given integrator function. |
| ``withConditioning`` | c: Conditioning -> engine: EstimationEngine<'a,'b> -> EstimationEngine<'a,'b> | Choose how the start point is chosen when solving the model system. |

**)
File renamed without changes.
Loading
Loading