From 5707ea82d995fd280d420a8fc00e776e2b0b825f Mon Sep 17 00:00:00 2001 From: Glenn Moynihan Date: Mon, 23 Mar 2020 11:39:19 +0000 Subject: [PATCH 01/11] tidy up README and docs --- README.md | 11 ++++++----- docs/src/design.md | 40 +++++++++++++++++++--------------------- docs/src/index.md | 12 +++++------- docs/src/testutils.md | 4 ++-- 4 files changed, 32 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index 4819173..2b13324 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,16 @@ # Models -[![Latest](https://img.shields.io/badge/docs-latest-blue.svg)](https://invenia.pages.invenia.ca/research/Models.jl/) -[![Coverage](https://gitlab.invenia.ca/invenia/Models.jl/badges/master/coverage.svg)](https://gitlab.invenia.ca/invenia/Models.jl/commits/master) +[![Build Status](https://travis-ci.com/invenia/Models.jl.svg?branch=master)](https://travis-ci.com/invenia/Models.jl) +[![Build Status](https://ci.appveyor.com/api/projects/status/github/invenia/Models.jl?svg=true)](https://ci.appveyor.com/project/invenia/Models-jl) +[![Codecov](https://codecov.io/gh/invenia/Models.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/invenia/Models.jl) +[![PkgEval](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/N/Models.svg)](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/report.html) +[![code style blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle) ## Why does this package exist? -[Models.jl](https://gitlab.invenia.ca/invenia/research/Models.jl) defines the [`Template`](@ref) and [`Model`](@ref) types as well as a common API for constructing a generic model in downstream packages, including: +[Models.jl](https://github.com/invenia/Models.jl) defines the `Template` and `Model` types as well as a common API for constructing a generic model in downstream packages, including: * Calling `fit` on a `Template`. * Calling `predict` on a `Model`. * Assigning traits such as `EstimateTrait` and `OutputTrait`. * Testing interfaces and downstream dependencies with `TestUtils`. - -For common examples of the interface being implemented see [BaselineModels.jl](https://gitlab.invenia.ca/invenia/research/BaselineModels.jl). diff --git a/docs/src/design.md b/docs/src/design.md index bfbccc4..83b507b 100644 --- a/docs/src/design.md +++ b/docs/src/design.md @@ -1,8 +1,6 @@ ## Design Documentation -This page details the key features of the design of BaselineModels. - -BaselineModels exists to solve the issue highlighted by following quote: +This page details the key features of the design of `Models.jl`, which exists to solve the issue highlighted by following quote: > ML researchers tend to develop general purpose solutions as self-contained packages. > A wide variety of these are available as open-source packages ... @@ -13,22 +11,22 @@ BaselineModels exists to solve the issue highlighted by following quote: -- [Sculley et al 2015](https://papers.nips.cc/paper/5656-hidden-technical-debt-in-machine-learning-systems) -BaselineModels provides a common API for mostly preexisting models to allow them to all be used in the same way. +`Models.jl` provides a common API for mostly preexisting models to allow them to all be used in the same way. As such, the most important thing is that it itself has a common API. Here are some facts about that API: ### Models and Templates -A **model** is an object that can be used to make predictions via calling `predict`. -A **template** is an object that can create a *model* by being `fit` to some data. +A `Model` is an object that can be used to make predictions via calling `predict`. +A `Template` is an object that can create a `Model` by being `fit` to some data. -All information about how to perform `fit`, such as hyper-parameters, is stored inside the *template*. -This is different from some other APIs which might for example pass those as keyword arguments to `fit`. -The template based API is superior to these as it means `fit` is always the same. -One does not have to carry both a model type, and a varying collection of keyword arguments, which would get complicated when composing wrapper models. +All information about how to perform `fit`, such as hyper-parameters, is stored inside the `Template`. +This is different from some other APIs which might, for example, pass hyper-parameters as keyword arguments to `fit`. +The `Template` based API is superior to these as it means `fit` is always the same. +One does not have to carry both a `Model` type, and a varying collection of keyword arguments, which would get complicated when composing wrapper models. -### `fit` and `predict` +### Calling fit and predict ```julia model = StatsBase.fit( @@ -46,30 +44,30 @@ outputs = StatsBase.predict( )::AbstractMatrix # always Variates x Observations ``` -`fit` takes in a *template* and some *data* and returns a `Model` that has been fit to the data. -`predict` takes a `Model` (that has been `fit` from a *template*) and produces a predicted output. +`fit` takes in a `Template` and some *data* and returns a `Model` that has been fit to the data. +`predict` takes a `Model` (that has been `fit` from a `Template`) and produces a predicted output. Important facts about `fit` and `predict`: - `outputs` and `inputs` always have observations as the second dimension -- even if it is [`SingleOutput`](@ref) (that just means that it will be a `1 x num_obs` output. (See [Docs on Julia being column-major](https://docs.julialang.org/en/v1/manual/performance-tips/#Access-arrays-in-memory-order,-along-columns-1)) - The functions must accept any `AbstractMatrix` for the `inputs` and `outputs` (`fit` only). If the underlying implementation needs a plain dense `Matrix` then `fit`/`predict` should perform the conversion. - - `fit` always accepts a `weights` argument. If the underlying model does not support weighted fitting, then `fit` should throw and error if the weights that passed in and are not all equal. + - `fit` always accepts a `weights` argument. If the underlying `Model` does not support weighted fitting, then `fit` should throw and error if the weights that passed in and are not all equal. - `fit`/`predict` take no keyword arguments, or any other arguments except the ones shown. ### Traits -This package largely avoids using complicated abstract types, or relying on a model having a particular abstract type. -Instead we use [traits](https://invenia.github.io/blog/2019/11/06/julialang-features-part-2/) to determine model behavior. +This package largely avoids using complicated abstract types, or relying on a `Model` having a particular abstract type. +Instead we use [traits](https://invenia.github.io/blog/2019/11/06/julialang-features-part-2/) to determine `Model` behavior. -Here are the current model traits in use and their possible values: - - `estimate_type` - determines what kinds of estimates the model outputs. +Here are the current `Model` traits in use and their possible values: + - `estimate_type` - determines what kinds of estimates the `Model` outputs. - `PointEstimate`: Predicts point-estimates of the most likely values. - `DistributionEstimate`: Estimates distributions over possible values. - - `output_type` - determines how many output variates a model can learn + - `output_type` - determines how many output variates a `Model` can learn - `SingleOutput`: Fits and predicts on a single output only. - `MultiOutput`: Fits and predicts on multiple outputs at a time. -The traits always agree between the model and the template. -Every model and template should define all the listed traits. +The traits always agree between the `Model` and the `Template`. +Every `Model` and `Template` should define all the listed traits. This package uses traits implemented such that the trait function returns an `abstract type` (rather than an instance). That means to check a trait one uses: diff --git a/docs/src/index.md b/docs/src/index.md index 0773a1e..6bb2115 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -2,14 +2,12 @@ ## Why does this package exist? -[Models.jl](https://gitlab.invenia.ca/invenia/research/Models.jl) defines the [`Template`](@ref) and [`Model`](@ref) types as well as a common API for constructing a generic model in downstream packages, including: +[Models.jl](https://github.com/invenia/Models.jl) defines the `Template` and `Model` types as well as a common API for constructing a generic model in downstream packages, including: -* Calling [`fit`](@ref) on a [`Template`](@ref). -* Calling [`predict`](@ref) on a [`Model`](@ref). -* Assigning traits such as [`EstimateTrait`](@ref) and [`OutputTrait`](@ref). -* Testing interfaces and downstream dependencies with [`TestUtils`](@ref). - -For common examples of the interface being implemented see [BaselineModels.jl](https://gitlab.invenia.ca/invenia/research/BaselineModels.jl). +* Calling `fit` on a `Template`. +* Calling `predict` on a `Model`. +* Assigning traits such as `EstimateTrait` and `OutputTrait`. +* Testing interfaces and downstream dependencies with `TestUtils`. ## Contents ```@contents diff --git a/docs/src/testutils.md b/docs/src/testutils.md index dd0caa8..f377319 100644 --- a/docs/src/testutils.md +++ b/docs/src/testutils.md @@ -1,7 +1,7 @@ # TestUtils -Provides test fakes, [`FakeTemplate`](@ref) and [`FakeModel`](@ref), that are useful for -testing downstream dependencies, and [`test_interface`](@ref) for testing the Model's API +Provides test fakes, `FakeTemplate` and `FakeModel`, that are useful for +testing downstream dependencies, and `test_interface` for testing the model's API has been correctly implemented. ```@autodocs From 0bef041a220159d7551bf48f247ee1adfa87afb4 Mon Sep 17 00:00:00 2001 From: Glenn Moynihan Date: Mon, 23 Mar 2020 11:45:37 +0000 Subject: [PATCH 02/11] add travis CI --- .gitlab-ci.yml | 4 ---- .travis.yml | 27 +++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) delete mode 100644 .gitlab-ci.yml create mode 100644 .travis.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index ae2f449..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -include: - - project: infrastructure/gitlab-ci-helper - file: /templates/julia.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..a111b36 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,27 @@ +# Documentation: http://docs.travis-ci.com/user/languages/julia/ +language: julia +os: + - linux + - osx +julia: + - 1.0 + - 1.3 + - nightly +matrix: + allow_failures: + - julia: nightly + fast_finish: true +notifications: + email: false +after_success: + - julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder())' +jobs: + include: + - stage: Documentation + julia: 1.3 + script: julia --project=docs -e ' + using Pkg; + Pkg.develop(PackageSpec(path=pwd())); + Pkg.instantiate(); + include("docs/make.jl");' + after_success: skip From 182748b7d96adeb9fef1ab076f382a4c845aff4a Mon Sep 17 00:00:00 2001 From: Glenn Moynihan Date: Mon, 23 Mar 2020 11:53:23 +0000 Subject: [PATCH 03/11] add 1.4 to travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index a111b36..1e429ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ os: julia: - 1.0 - 1.3 + - 1.4 - nightly matrix: allow_failures: From f5fd21d9b83ccd766f5e1963afb84544d36a4621 Mon Sep 17 00:00:00 2001 From: Glenn Moynihan Date: Mon, 23 Mar 2020 11:54:27 +0000 Subject: [PATCH 04/11] add back @refs --- docs/src/design.md | 50 +++++++++++++++++++++---------------------- docs/src/index.md | 10 ++++----- docs/src/testutils.md | 4 ++-- 3 files changed, 32 insertions(+), 32 deletions(-) diff --git a/docs/src/design.md b/docs/src/design.md index 83b507b..d6b7311 100644 --- a/docs/src/design.md +++ b/docs/src/design.md @@ -1,6 +1,6 @@ ## Design Documentation -This page details the key features of the design of `Models.jl`, which exists to solve the issue highlighted by following quote: +This page details the key features of the design of [`Models.jl`](https://github.com/invenia/Models.jl), which exists to solve the issue highlighted by following quote: > ML researchers tend to develop general purpose solutions as self-contained packages. > A wide variety of these are available as open-source packages ... @@ -11,19 +11,19 @@ This page details the key features of the design of `Models.jl`, which exists to -- [Sculley et al 2015](https://papers.nips.cc/paper/5656-hidden-technical-debt-in-machine-learning-systems) -`Models.jl` provides a common API for mostly preexisting models to allow them to all be used in the same way. +[`Models.jl`](https://github.com/invenia/Models.jl) provides a common API for mostly preexisting models to allow them to all be used in the same way. As such, the most important thing is that it itself has a common API. Here are some facts about that API: ### Models and Templates -A `Model` is an object that can be used to make predictions via calling `predict`. -A `Template` is an object that can create a `Model` by being `fit` to some data. +A [`Model`](@ref) is an object that can be used to make predictions via calling [`predict`](@ref). +A [`Template`](@ref) is an object that can create a [`Model`](@ref) by being [`fit`](@ref) to some data. -All information about how to perform `fit`, such as hyper-parameters, is stored inside the `Template`. -This is different from some other APIs which might, for example, pass hyper-parameters as keyword arguments to `fit`. -The `Template` based API is superior to these as it means `fit` is always the same. -One does not have to carry both a `Model` type, and a varying collection of keyword arguments, which would get complicated when composing wrapper models. +All information about how to perform [`fit`](@ref), such as hyper-parameters, is stored inside the [`Template`](@ref). +This is different from some other APIs which might, for example, pass hyper-parameters as keyword arguments to [`fit`](@ref). +The [`Template`](@ref) based API is superior to these as it means [`fit`](@ref) is always the same. +One does not have to carry both a [`Model`](@ref) type, and a varying collection of keyword arguments, which would get complicated when composing wrapper models. ### Calling fit and predict @@ -44,30 +44,30 @@ outputs = StatsBase.predict( )::AbstractMatrix # always Variates x Observations ``` -`fit` takes in a `Template` and some *data* and returns a `Model` that has been fit to the data. -`predict` takes a `Model` (that has been `fit` from a `Template`) and produces a predicted output. +[`fit`](@ref) takes in a [`Template`](@ref) and some *data* and returns a [`Model`](@ref) that has been fit to the data. +[`predict`](@ref) takes a [`Model`](@ref) (that has been [`fit`](@ref) from a [`Template`](@ref)) and produces a predicted output. -Important facts about `fit` and `predict`: +Important facts about [`fit`](@ref) and [`predict`](@ref): - `outputs` and `inputs` always have observations as the second dimension -- even if it is [`SingleOutput`](@ref) (that just means that it will be a `1 x num_obs` output. (See [Docs on Julia being column-major](https://docs.julialang.org/en/v1/manual/performance-tips/#Access-arrays-in-memory-order,-along-columns-1)) - - The functions must accept any `AbstractMatrix` for the `inputs` and `outputs` (`fit` only). If the underlying implementation needs a plain dense `Matrix` then `fit`/`predict` should perform the conversion. - - `fit` always accepts a `weights` argument. If the underlying `Model` does not support weighted fitting, then `fit` should throw and error if the weights that passed in and are not all equal. - - `fit`/`predict` take no keyword arguments, or any other arguments except the ones shown. + - The functions must accept any `AbstractMatrix` for the `inputs` and `outputs` ([`fit`](@ref) only). If the underlying implementation needs a plain dense `Matrix` then [`fit`](@ref)/[`predict`](@ref) should perform the conversion. + - [`fit`](@ref) always accepts a `weights` argument. If the underlying [`Model`](@ref) does not support weighted fitting, then [`fit`](@ref) should throw and error if the weights that passed in and are not all equal. + - [`fit`](@ref)/[`predict`](@ref) take no keyword arguments, or any other arguments except the ones shown. ### Traits -This package largely avoids using complicated abstract types, or relying on a `Model` having a particular abstract type. -Instead we use [traits](https://invenia.github.io/blog/2019/11/06/julialang-features-part-2/) to determine `Model` behavior. +This package largely avoids using complicated abstract types, or relying on a [`Model`](@ref) having a particular abstract type. +Instead we use [traits](https://invenia.github.io/blog/2019/11/06/julialang-features-part-2/) to determine [`Model`](@ref) behavior. -Here are the current `Model` traits in use and their possible values: - - `estimate_type` - determines what kinds of estimates the `Model` outputs. - - `PointEstimate`: Predicts point-estimates of the most likely values. - - `DistributionEstimate`: Estimates distributions over possible values. - - `output_type` - determines how many output variates a `Model` can learn - - `SingleOutput`: Fits and predicts on a single output only. - - `MultiOutput`: Fits and predicts on multiple outputs at a time. +Here are the current [`Model`](@ref) traits in use and their possible values: + - [`estimate_type`](@ref) - determines what kinds of estimates the [`Model`](@ref) outputs. + - [`PointEstimate`](@ref): Predicts point-estimates of the most likely values. + - [`DistributionEstimate`](@ref): Estimates distributions over possible values. + - [`output_type`](@ref) - determines how many output variates a [`Model`](@ref) can learn + - [`SingleOutput`](@ref): Fits and predicts on a single output only. + - [`MultiOutput`](@ref): Fits and predicts on multiple outputs at a time. -The traits always agree between the `Model` and the `Template`. -Every `Model` and `Template` should define all the listed traits. +The traits always agree between the [`Model`](@ref) and the [`Template`](@ref). +Every [`Model`](@ref) and [`Template`](@ref) should define all the listed traits. This package uses traits implemented such that the trait function returns an `abstract type` (rather than an instance). That means to check a trait one uses: diff --git a/docs/src/index.md b/docs/src/index.md index 6bb2115..729e6e4 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -2,12 +2,12 @@ ## Why does this package exist? -[Models.jl](https://github.com/invenia/Models.jl) defines the `Template` and `Model` types as well as a common API for constructing a generic model in downstream packages, including: +[Models.jl](https://github.com/invenia/Models.jl) defines the [`Template`](@ref) and [`Model`](@ref) types as well as a common API for constructing a generic model in downstream packages, including: -* Calling `fit` on a `Template`. -* Calling `predict` on a `Model`. -* Assigning traits such as `EstimateTrait` and `OutputTrait`. -* Testing interfaces and downstream dependencies with `TestUtils`. +* Calling [`fit`](@ref) on a [`Template`](@ref). +* Calling [`predict`](@ref) on a [`Model`](@ref). +* Assigning traits such as [`EstimateTrait`](@ref) and [`OutputTrait`](@ref). +* Testing interfaces and downstream dependencies with [`TestUtils`](@ref). ## Contents ```@contents diff --git a/docs/src/testutils.md b/docs/src/testutils.md index f377319..266434a 100644 --- a/docs/src/testutils.md +++ b/docs/src/testutils.md @@ -1,7 +1,7 @@ # TestUtils -Provides test fakes, `FakeTemplate` and `FakeModel`, that are useful for -testing downstream dependencies, and `test_interface` for testing the model's API +Provides test fakes, [`FakeTemplate`](@ref) and [`FakeModel`](@ref), that are useful for +testing downstream dependencies, and [`test_interface`](@ref) for testing the model's API has been correctly implemented. ```@autodocs From 50472cfa496e2bbd7e95740979e64c3eac21be87 Mon Sep 17 00:00:00 2001 From: Glenn Moynihan Date: Mon, 23 Mar 2020 11:59:05 +0000 Subject: [PATCH 05/11] tidy up badges --- README.md | 3 +-- docs/src/design.md | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2b13324..49b7bd9 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,8 @@ # Models [![Build Status](https://travis-ci.com/invenia/Models.jl.svg?branch=master)](https://travis-ci.com/invenia/Models.jl) -[![Build Status](https://ci.appveyor.com/api/projects/status/github/invenia/Models.jl?svg=true)](https://ci.appveyor.com/project/invenia/Models-jl) [![Codecov](https://codecov.io/gh/invenia/Models.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/invenia/Models.jl) -[![PkgEval](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/N/Models.svg)](https://juliaci.github.io/NanosoldierReports/pkgeval_badges/report.html) + [![code style blue](https://img.shields.io/badge/code%20style-blue-4495d1.svg)](https://github.com/invenia/BlueStyle) ## Why does this package exist? diff --git a/docs/src/design.md b/docs/src/design.md index d6b7311..a763df4 100644 --- a/docs/src/design.md +++ b/docs/src/design.md @@ -1,6 +1,6 @@ ## Design Documentation -This page details the key features of the design of [`Models.jl`](https://github.com/invenia/Models.jl), which exists to solve the issue highlighted by following quote: +This page details the key features of the design of [Models.jl](https://github.com/invenia/Models.jl), which exists to solve the issue highlighted by following quote: > ML researchers tend to develop general purpose solutions as self-contained packages. > A wide variety of these are available as open-source packages ... @@ -11,7 +11,7 @@ This page details the key features of the design of [`Models.jl`](https://github -- [Sculley et al 2015](https://papers.nips.cc/paper/5656-hidden-technical-debt-in-machine-learning-systems) -[`Models.jl`](https://github.com/invenia/Models.jl) provides a common API for mostly preexisting models to allow them to all be used in the same way. +[Models.jl](https://github.com/invenia/Models.jl) provides a common API for mostly preexisting models to allow them to all be used in the same way. As such, the most important thing is that it itself has a common API. Here are some facts about that API: From ccd5070dd5fba729ce8d46cb70e098ec93da14ae Mon Sep 17 00:00:00 2001 From: Glenn Moynihan Date: Mon, 23 Mar 2020 12:08:17 +0000 Subject: [PATCH 06/11] update docs link to repo --- docs/make.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/make.jl b/docs/make.jl index 61dd1ef..048957d 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -16,7 +16,7 @@ makedocs(; "Design" => "design.md", "TestUtils" => "testutils.md", ], - repo="https://gitlab.invenia.ca/invenia/Models.jl/blob/{commit}{path}#L{line}", + repo="https://github.com/invenia/Models.jl/blob/{commit}{path}#L{line}" sitename="Models.jl", authors="Invenia Technical Computing Corporation", strict=true, From 077a1d5b612fccb5f3951de79cace198992124e8 Mon Sep 17 00:00:00 2001 From: Glenn Moynihan Date: Mon, 23 Mar 2020 12:11:41 +0000 Subject: [PATCH 07/11] add more @refs --- src/Models.jl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Models.jl b/src/Models.jl index e6755f9..953e080 100644 --- a/src/Models.jl +++ b/src/Models.jl @@ -12,8 +12,8 @@ export OutputTrait, SingleOutput, MultiOutput A Template is an untrained [`Model`](@ref) that can be [`fit`](@ref) to data. Defined as well are the traits: -- [`output_type`](@ref): SingleOutput or MultiOutput -- [`estimate_type`](@ref): PointEstimate or DistributionEstimate +- [`output_type`](@ref): [`SingleOutput`](@ref) or [`MultiOutput`](@ref). +- [`estimate_type`](@ref): [`PointEstimate`](@ref) or [`DistributionEstimate`](@ref). """ abstract type Template end @@ -22,8 +22,8 @@ abstract type Template end A Model is a trained [`Template`](@ref) with which one can [`predict`](@ref) on inputs. Defined as well are the traits: -- [`output_type`](@ref): SingleOutput or MultiOutput -- [`estimate_type`](@ref): PointEstimate or DistributionEstimate +- [`output_type`](@ref): [`SingleOutput`](@ref) or [`MultiOutput`](@ref). +- [`estimate_type`](@ref): [`PointEstimate`](@ref) or [`DistributionEstimate`](@ref). """ abstract type Model end @@ -40,7 +40,7 @@ function fit end Predict targets for the provided `input` and [`Model`](@ref). -Returns a predictive distribution or point estimates depending on the [`Model`](ref). +Returns a predictive distribution or point estimates depending on the [`Model`](@ref). """ function predict end From d6de82c2dbf2209604b99579c655335141311d42 Mon Sep 17 00:00:00 2001 From: Glenn Moynihan Date: Mon, 23 Mar 2020 12:21:57 +0000 Subject: [PATCH 08/11] fix header --- docs/src/design.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/src/design.md b/docs/src/design.md index a763df4..8f157a9 100644 --- a/docs/src/design.md +++ b/docs/src/design.md @@ -1,4 +1,4 @@ -## Design Documentation +# Design This page details the key features of the design of [Models.jl](https://github.com/invenia/Models.jl), which exists to solve the issue highlighted by following quote: @@ -15,7 +15,7 @@ This page details the key features of the design of [Models.jl](https://github.c As such, the most important thing is that it itself has a common API. Here are some facts about that API: -### Models and Templates +## Models and Templates A [`Model`](@ref) is an object that can be used to make predictions via calling [`predict`](@ref). A [`Template`](@ref) is an object that can create a [`Model`](@ref) by being [`fit`](@ref) to some data. @@ -26,7 +26,7 @@ The [`Template`](@ref) based API is superior to these as it means [`fit`](@ref) One does not have to carry both a [`Model`](@ref) type, and a varying collection of keyword arguments, which would get complicated when composing wrapper models. -### Calling fit and predict +## Calling `fit` and `predict` ```julia model = StatsBase.fit( @@ -53,7 +53,7 @@ Important facts about [`fit`](@ref) and [`predict`](@ref): - [`fit`](@ref) always accepts a `weights` argument. If the underlying [`Model`](@ref) does not support weighted fitting, then [`fit`](@ref) should throw and error if the weights that passed in and are not all equal. - [`fit`](@ref)/[`predict`](@ref) take no keyword arguments, or any other arguments except the ones shown. -### Traits +## Traits This package largely avoids using complicated abstract types, or relying on a [`Model`](@ref) having a particular abstract type. Instead we use [traits](https://invenia.github.io/blog/2019/11/06/julialang-features-part-2/) to determine [`Model`](@ref) behavior. From f29a881f193dc2a0ebae81606e36bd9828bb8071 Mon Sep 17 00:00:00 2001 From: Glenn Moynihan Date: Mon, 23 Mar 2020 13:17:19 +0000 Subject: [PATCH 09/11] define structs outside @testset --- test/traits.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/traits.jl b/test/traits.jl index c052c28..12be8c0 100644 --- a/test/traits.jl +++ b/test/traits.jl @@ -1,7 +1,7 @@ -@testset "traits.jl" begin +struct DummyTemplate <: Template end +struct DummyModel <: Model end - struct DummyTemplate <: Template end - struct DummyModel <: Model end +@testset "traits.jl" begin estimates = (PointEstimate, DistributionEstimate) outputs = (SingleOutput, MultiOutput) From 5be997f513084d8f7e80743a18f11b2a5c0d421c Mon Sep 17 00:00:00 2001 From: Glenn Moynihan Date: Mon, 23 Mar 2020 13:17:40 +0000 Subject: [PATCH 10/11] add deploydocs --- docs/make.jl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/make.jl b/docs/make.jl index 048957d..dad2c98 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -22,3 +22,8 @@ makedocs(; strict=true, checkdocs=:exports, ) + +deploydocs(; + repo="github.com/invenia/Models.jl", + push_preview=true, +) From 37462d7021e05d6d97f7d7f488aef037699c1658 Mon Sep 17 00:00:00 2001 From: Glenn Moynihan Date: Mon, 23 Mar 2020 14:44:34 +0000 Subject: [PATCH 11/11] Update README.md add docs badges Co-Authored-By: Nick Robinson --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 49b7bd9..ff30670 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,8 @@ # Models +[![Stable](https://img.shields.io/badge/docs-latest-blue.svg)](https://invenia.github.io/Models.jl/stable/) +[![Latest](https://img.shields.io/badge/docs-latest-blue.svg)](https://invenia.github.io/Models.jl/dev/) + [![Build Status](https://travis-ci.com/invenia/Models.jl.svg?branch=master)](https://travis-ci.com/invenia/Models.jl) [![Codecov](https://codecov.io/gh/invenia/Models.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/invenia/Models.jl)