diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19046d8..5e36989 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,16 +9,18 @@ name: Continuous Integration on: pull_request: - branches: ['**'] + branches: ['**', '!update/**', '!pr/**'] push: - branches: ['**'] + branches: ['**', '!update/**', '!pr/**'] tags: [v*] env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - PGP_SECRET: ${{ secrets.PGP_SECRET }} + + +concurrency: + group: ${{ github.workflow }} @ ${{ github.ref }} + cancel-in-progress: true jobs: build: @@ -26,94 +28,152 @@ jobs: strategy: matrix: os: [ubuntu-latest] - scala: [2.13.11] - java: [temurin@11] + scala: [2.13] + java: [temurin@8] runs-on: ${{ matrix.os }} + timeout-minutes: 60 steps: - name: Checkout current branch (full) - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Setup Java (temurin@11) - if: matrix.java == 'temurin@11' - uses: actions/setup-java@v2 + - name: Setup Java (temurin@8) + id: setup-java-temurin-8 + if: matrix.java == 'temurin@8' + uses: actions/setup-java@v3 with: distribution: temurin - java-version: 11 + java-version: 8 + cache: sbt - - name: Cache sbt - uses: actions/cache@v2 - with: - path: | - ~/.sbt - ~/.ivy2/cache - ~/.coursier/cache/v1 - ~/.cache/coursier/v1 - ~/AppData/Local/Coursier/Cache/v1 - ~/Library/Caches/Coursier/v1 - key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + - name: sbt update + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' + run: sbt +update - name: Check that workflows are up to date - run: sbt ++${{ matrix.scala }} githubWorkflowCheck + run: sbt githubWorkflowCheck + + - name: Check headers and formatting + if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest' + run: sbt '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck + + - name: Test + run: sbt '++ ${{ matrix.scala }}' test + + - name: Check binary compatibility + if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest' + run: sbt '++ ${{ matrix.scala }}' mimaReportBinaryIssues - - run: sbt ++${{ matrix.scala }} ci + - name: Generate API documentation + if: matrix.java == 'temurin@8' && matrix.os == 'ubuntu-latest' + run: sbt '++ ${{ matrix.scala }}' doc + + - name: Make target directories + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') + run: mkdir -p target project/target - name: Compress target directories + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') run: tar cf targets.tar target project/target - name: Upload target directories - uses: actions/upload-artifact@v2 + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') + uses: actions/upload-artifact@v3 with: - name: target-${{ matrix.os }}-${{ matrix.scala }}-${{ matrix.java }} + name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }} path: targets.tar publish: name: Publish Artifacts needs: [build] - if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v')) + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') strategy: matrix: os: [ubuntu-latest] - scala: [2.13.11] - java: [temurin@11] + java: [temurin@8] runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Setup Java (temurin@11) - if: matrix.java == 'temurin@11' - uses: actions/setup-java@v2 + - name: Setup Java (temurin@8) + id: setup-java-temurin-8 + if: matrix.java == 'temurin@8' + uses: actions/setup-java@v3 with: distribution: temurin - java-version: 11 + java-version: 8 + cache: sbt - - name: Cache sbt - uses: actions/cache@v2 - with: - path: | - ~/.sbt - ~/.ivy2/cache - ~/.coursier/cache/v1 - ~/.cache/coursier/v1 - ~/AppData/Local/Coursier/Cache/v1 - ~/Library/Caches/Coursier/v1 - key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} - - - name: Download target directories (2.13.11) - uses: actions/download-artifact@v2 + - name: sbt update + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' + run: sbt +update + + - name: Download target directories (2.13) + uses: actions/download-artifact@v3 with: - name: target-${{ matrix.os }}-2.13.11-${{ matrix.java }} + name: target-${{ matrix.os }}-${{ matrix.java }}-2.13 - - name: Inflate target directories (2.13.11) + - name: Inflate target directories (2.13) run: | tar xf targets.tar rm targets.tar - name: Import signing key - run: echo $PGP_SECRET | base64 -d | gpg --import + if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == '' + env: + PGP_SECRET: ${{ secrets.PGP_SECRET }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + run: echo $PGP_SECRET | base64 -di | gpg --import + + - name: Import signing key and strip passphrase + if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != '' + env: + PGP_SECRET: ${{ secrets.PGP_SECRET }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + run: | + echo "$PGP_SECRET" | base64 -di > /tmp/signing-key.gpg + echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg + (echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1) + + - name: Publish + env: + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }} + run: sbt tlCiRelease + + dependency-submission: + name: Submit Dependencies + if: github.event_name != 'pull_request' + strategy: + matrix: + os: [ubuntu-latest] + java: [temurin@8] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v3 + with: + fetch-depth: 0 - - run: sbt ++${{ matrix.scala }} release + - name: Setup Java (temurin@8) + id: setup-java-temurin-8 + if: matrix.java == 'temurin@8' + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 8 + cache: sbt + + - name: sbt update + if: matrix.java == 'temurin@8' && steps.setup-java-temurin-8.outputs.cache-hit == 'false' + run: sbt +update + + - name: Submit Dependencies + uses: scalacenter/sbt-dependency-submission@v2 + with: + configs-ignore: test scala-tool scala-doc-tool test-internal diff --git a/build.sbt b/build.sbt index 641377d..61107c0 100644 --- a/build.sbt +++ b/build.sbt @@ -1,24 +1,13 @@ -ThisBuild / baseVersion := "0.9.0" - -ThisBuild / organization := "ai.entrolution" -ThisBuild / organizationName := "Greg von Nessi" -ThisBuild / publishGithubUser := "gvonness" -ThisBuild / publishFullName := "Greg von Nessi" - -ThisBuild / homepage := Some(url("https://github.com/gvonness/thylacine")) -ThisBuild / scmInfo := Some( - ScmInfo(url("https://github.com/gvonness/thylacine"), "git@github.com:gvonness/thylacine.git") +ThisBuild / tlBaseVersion := "0.9" + +ThisBuild / organization := "ai.entrolution" +ThisBuild / organizationName := "Greg von Nessi" +ThisBuild / startYear := Some(2023) +ThisBuild / licenses := Seq(License.Apache2) +ThisBuild / developers ++= List( + tlGitHubDev("gvonness", "Greg von Nessi") ) -ThisBuild / startYear := Some(2020) -ThisBuild / endYear := Some(2022) - -ThisBuild / spiewakCiReleaseSnapshots := false -ThisBuild / spiewakMainBranches := Seq("main") - -ThisBuild / sonatypeCredentialHost := "s01.oss.sonatype.org" -ThisBuild / sonatypeRepository := "https://s01.oss.sonatype.org/service/local" - scalaVersion := DependencyVersions.scala2p13Version ThisBuild / crossScalaVersions := Seq(DependencyVersions.scala2p13Version) @@ -41,7 +30,6 @@ lazy val commonSettings = Seq( ) lazy val thylacine = (project in file(".")) - .enablePlugins(SonatypeCiReleasePlugin) .settings( commonSettings, name := "thylacine", diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 2fa7abf..d8d932e 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -3,7 +3,7 @@ import sbt.* object DependencyVersions { val scala2p13Version = "2.13.11" - val bengalStmVersion = "0.9.4" + val bengalStmVersion = "0.9.5" val bigMathVersion = "2.3.2" val breezeVersion = "2.1.0" val catsEffectVersion = "3.4.8" diff --git a/project/plugins.sbt b/project/plugins.sbt index 9a4f4e7..e4c00e0 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,5 +1,2 @@ -addSbtPlugin("org.jetbrains" % "sbt-ide-settings" % "1.1.0") -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6") -addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.34") -addSbtPlugin("com.codecommit" % "sbt-spiewak-sonatype" % "0.23.0") -addCompilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1" % "test") +addSbtPlugin("org.jetbrains" % "sbt-ide-settings" % "1.1.0") +addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.5.0-RC11") diff --git a/src/main/scala/thylacine/config/ConjugateGradientConfig.scala b/src/main/scala/thylacine/config/ConjugateGradientConfig.scala index 8453713..090c83b 100644 --- a/src/main/scala/thylacine/config/ConjugateGradientConfig.scala +++ b/src/main/scala/thylacine/config/ConjugateGradientConfig.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/config/CoordinateSlideConfig.scala b/src/main/scala/thylacine/config/CoordinateSlideConfig.scala index 2e5c780..6737951 100644 --- a/src/main/scala/thylacine/config/CoordinateSlideConfig.scala +++ b/src/main/scala/thylacine/config/CoordinateSlideConfig.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/config/HmcmcConfig.scala b/src/main/scala/thylacine/config/HmcmcConfig.scala index 895fda7..8208b90 100644 --- a/src/main/scala/thylacine/config/HmcmcConfig.scala +++ b/src/main/scala/thylacine/config/HmcmcConfig.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/config/HookeAndJeevesConfig.scala b/src/main/scala/thylacine/config/HookeAndJeevesConfig.scala index 95b8224..619fe83 100644 --- a/src/main/scala/thylacine/config/HookeAndJeevesConfig.scala +++ b/src/main/scala/thylacine/config/HookeAndJeevesConfig.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/config/LeapfrogMcmcConfig.scala b/src/main/scala/thylacine/config/LeapfrogMcmcConfig.scala index a5facdc..c94176e 100644 --- a/src/main/scala/thylacine/config/LeapfrogMcmcConfig.scala +++ b/src/main/scala/thylacine/config/LeapfrogMcmcConfig.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/config/MdsConfig.scala b/src/main/scala/thylacine/config/MdsConfig.scala index 8c3fc89..508ad3a 100644 --- a/src/main/scala/thylacine/config/MdsConfig.scala +++ b/src/main/scala/thylacine/config/MdsConfig.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/config/SlqConfig.scala b/src/main/scala/thylacine/config/SlqConfig.scala index 085ad44..854e6ee 100644 --- a/src/main/scala/thylacine/config/SlqConfig.scala +++ b/src/main/scala/thylacine/config/SlqConfig.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/components/forwardmodel/ForwardModel.scala b/src/main/scala/thylacine/model/components/forwardmodel/ForwardModel.scala index 20b0f95..59e4432 100644 --- a/src/main/scala/thylacine/model/components/forwardmodel/ForwardModel.scala +++ b/src/main/scala/thylacine/model/components/forwardmodel/ForwardModel.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,10 +17,10 @@ package ai.entrolution package thylacine.model.components.forwardmodel -import thylacine.model.core._ -import thylacine.model.core.values._ +import thylacine.model.core.* +import thylacine.model.core.values.* -import cats.syntax.all._ +import cats.syntax.all.* trait ForwardModel[F[_]] extends GenericMapping with CanValidate[ForwardModel[F]] { this: AsyncImplicits[F] => diff --git a/src/main/scala/thylacine/model/components/forwardmodel/InMemoryMemoizedForwardModel.scala b/src/main/scala/thylacine/model/components/forwardmodel/InMemoryMemoizedForwardModel.scala index 5508dd7..28b3354 100644 --- a/src/main/scala/thylacine/model/components/forwardmodel/InMemoryMemoizedForwardModel.scala +++ b/src/main/scala/thylacine/model/components/forwardmodel/InMemoryMemoizedForwardModel.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/components/forwardmodel/LinearForwardModel.scala b/src/main/scala/thylacine/model/components/forwardmodel/LinearForwardModel.scala index 739894f..517fc0f 100644 --- a/src/main/scala/thylacine/model/components/forwardmodel/LinearForwardModel.scala +++ b/src/main/scala/thylacine/model/components/forwardmodel/LinearForwardModel.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,15 +18,15 @@ package ai.entrolution package thylacine.model.components.forwardmodel import bengal.stm.STM -import thylacine.model.core.GenericIdentifier._ -import thylacine.model.core._ +import thylacine.model.core.GenericIdentifier.* +import thylacine.model.core.* import thylacine.model.core.computation.CachedComputation -import thylacine.model.core.values._ +import thylacine.model.core.values.* import thylacine.model.core.values.modelparameters.ModelParameterContext import breeze.linalg.{ DenseMatrix, DenseVector } import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* import scala.annotation.unused diff --git a/src/main/scala/thylacine/model/components/forwardmodel/NonLinearForwardModel.scala b/src/main/scala/thylacine/model/components/forwardmodel/NonLinearForwardModel.scala index b09127f..dca6b8e 100644 --- a/src/main/scala/thylacine/model/components/forwardmodel/NonLinearForwardModel.scala +++ b/src/main/scala/thylacine/model/components/forwardmodel/NonLinearForwardModel.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ import thylacine.model.core.computation.{ CachedComputation, FiniteDifferenceJac import thylacine.model.core.values.{ IndexedMatrixCollection, IndexedVectorCollection, VectorContainer } import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* case class NonLinearForwardModel[F[_]: STM: Async]( override protected val evalCache: CachedComputation[F, VectorContainer], diff --git a/src/main/scala/thylacine/model/components/likelihood/CauchyLikelihood.scala b/src/main/scala/thylacine/model/components/likelihood/CauchyLikelihood.scala index 7455c26..49bac46 100644 --- a/src/main/scala/thylacine/model/components/likelihood/CauchyLikelihood.scala +++ b/src/main/scala/thylacine/model/components/likelihood/CauchyLikelihood.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,14 +18,14 @@ package ai.entrolution package thylacine.model.components.likelihood import bengal.stm.STM -import thylacine.model.components.forwardmodel._ -import thylacine.model.core.GenericIdentifier._ -import thylacine.model.core._ +import thylacine.model.components.forwardmodel.* +import thylacine.model.core.GenericIdentifier.* +import thylacine.model.core.* import thylacine.model.core.values.VectorContainer import thylacine.model.distributions.CauchyDistribution import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* import java.util.UUID import scala.annotation.unused diff --git a/src/main/scala/thylacine/model/components/likelihood/GaussianLikelihood.scala b/src/main/scala/thylacine/model/components/likelihood/GaussianLikelihood.scala index ccf56ee..41e0cc8 100644 --- a/src/main/scala/thylacine/model/components/likelihood/GaussianLikelihood.scala +++ b/src/main/scala/thylacine/model/components/likelihood/GaussianLikelihood.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,9 +17,9 @@ package ai.entrolution package thylacine.model.components.likelihood -import thylacine.model.components.forwardmodel._ -import thylacine.model.core.GenericIdentifier._ -import thylacine.model.core._ +import thylacine.model.components.forwardmodel.* +import thylacine.model.core.GenericIdentifier.* +import thylacine.model.core.* import thylacine.model.core.values.VectorContainer import thylacine.model.distributions.GaussianDistribution diff --git a/src/main/scala/thylacine/model/components/likelihood/GaussianLinearLikelihood.scala b/src/main/scala/thylacine/model/components/likelihood/GaussianLinearLikelihood.scala index 45ddc3c..2f82de0 100644 --- a/src/main/scala/thylacine/model/components/likelihood/GaussianLinearLikelihood.scala +++ b/src/main/scala/thylacine/model/components/likelihood/GaussianLinearLikelihood.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,14 +18,14 @@ package ai.entrolution package thylacine.model.components.likelihood import bengal.stm.STM -import thylacine.model.components.forwardmodel._ -import thylacine.model.core.GenericIdentifier._ -import thylacine.model.core._ +import thylacine.model.components.forwardmodel.* +import thylacine.model.core.GenericIdentifier.* +import thylacine.model.core.* import thylacine.model.core.values.VectorContainer import thylacine.model.distributions.GaussianDistribution import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* import java.util.UUID import scala.annotation.unused diff --git a/src/main/scala/thylacine/model/components/likelihood/Likelihood.scala b/src/main/scala/thylacine/model/components/likelihood/Likelihood.scala index 8cb2e1f..609cab2 100644 --- a/src/main/scala/thylacine/model/components/likelihood/Likelihood.scala +++ b/src/main/scala/thylacine/model/components/likelihood/Likelihood.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,21 +17,21 @@ package ai.entrolution package thylacine.model.components.likelihood -import thylacine.model.components.forwardmodel._ +import thylacine.model.components.forwardmodel.* import thylacine.model.components.posterior.PosteriorTerm -import thylacine.model.core._ +import thylacine.model.core.* import thylacine.model.core.values.IndexedVectorCollection.ModelParameterCollection import thylacine.model.core.values.modelparameters.ModelParameterPdf import thylacine.model.core.values.{ IndexedVectorCollection, VectorContainer } import thylacine.model.distributions.Distribution import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* trait Likelihood[F[_], +FM <: ForwardModel[F], +D <: Distribution] extends ModelParameterPdf[F] with PosteriorTerm - with CanValidate[Likelihood[F, _, _]] { + with CanValidate[Likelihood[F, ?, ?]] { this: AsyncImplicits[F] => private[thylacine] def observationDistribution: D diff --git a/src/main/scala/thylacine/model/components/likelihood/UniformLikelihood.scala b/src/main/scala/thylacine/model/components/likelihood/UniformLikelihood.scala index c7da294..ca570f3 100644 --- a/src/main/scala/thylacine/model/components/likelihood/UniformLikelihood.scala +++ b/src/main/scala/thylacine/model/components/likelihood/UniformLikelihood.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package ai.entrolution package thylacine.model.components.likelihood import thylacine.model.components.forwardmodel.ForwardModel -import thylacine.model.core.GenericIdentifier._ -import thylacine.model.core._ +import thylacine.model.core.GenericIdentifier.* +import thylacine.model.core.* import thylacine.model.core.values.VectorContainer import thylacine.model.distributions import thylacine.model.distributions.UniformDistribution diff --git a/src/main/scala/thylacine/model/components/posterior/ConjugateGradientOptimisedPosterior.scala b/src/main/scala/thylacine/model/components/posterior/ConjugateGradientOptimisedPosterior.scala index 782c82b..384f24d 100644 --- a/src/main/scala/thylacine/model/components/posterior/ConjugateGradientOptimisedPosterior.scala +++ b/src/main/scala/thylacine/model/components/posterior/ConjugateGradientOptimisedPosterior.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,10 +30,10 @@ case class ConjugateGradientOptimisedPosterior[F[_]: Async]( private[thylacine] val gradientDescentConfig: ConjugateGradientConfig, override protected val iterationUpdateCallback: OptimisationTelemetryUpdate => F[Unit], override protected val isConvergedCallback: Unit => F[Unit], - override private[thylacine] val priors: Set[Prior[F, _]], - override private[thylacine] val likelihoods: Set[Likelihood[F, _, _]] + override private[thylacine] val priors: Set[Prior[F, ?]], + override private[thylacine] val likelihoods: Set[Likelihood[F, ?, ?]] ) extends AsyncImplicits[F] - with Posterior[F, Prior[F, _], Likelihood[F, _, _]] + with Posterior[F, Prior[F, ?], Likelihood[F, ?, ?]] with ConjugateGradientEngine[F] { override protected val convergenceThreshold: Double = @@ -53,7 +53,7 @@ object ConjugateGradientOptimisedPosterior { def apply[F[_]: Async]( conjugateGradientConfig: ConjugateGradientConfig, - posterior: Posterior[F, Prior[F, _], Likelihood[F, _, _]], + posterior: Posterior[F, Prior[F, ?], Likelihood[F, ?, ?]], iterationUpdateCallback: OptimisationTelemetryUpdate => F[Unit], isConvergedCallback: Unit => F[Unit] ): ConjugateGradientOptimisedPosterior[F] = diff --git a/src/main/scala/thylacine/model/components/posterior/CoordinateSlideOptimisedPosterior.scala b/src/main/scala/thylacine/model/components/posterior/CoordinateSlideOptimisedPosterior.scala index 6d7b738..394ddfc 100644 --- a/src/main/scala/thylacine/model/components/posterior/CoordinateSlideOptimisedPosterior.scala +++ b/src/main/scala/thylacine/model/components/posterior/CoordinateSlideOptimisedPosterior.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,10 +30,10 @@ case class CoordinateSlideOptimisedPosterior[F[_]: Async]( private[thylacine] val coordinateSlideConfig: CoordinateSlideConfig, override protected val iterationUpdateCallback: OptimisationTelemetryUpdate => F[Unit], override protected val isConvergedCallback: Unit => F[Unit], - override private[thylacine] val priors: Set[Prior[F, _]], - override private[thylacine] val likelihoods: Set[Likelihood[F, _, _]] + override private[thylacine] val priors: Set[Prior[F, ?]], + override private[thylacine] val likelihoods: Set[Likelihood[F, ?, ?]] ) extends AsyncImplicits[F] - with Posterior[F, Prior[F, _], Likelihood[F, _, _]] + with Posterior[F, Prior[F, ?], Likelihood[F, ?, ?]] with CoordinateSlideEngine[F] { override protected val convergenceThreshold: Double = @@ -53,7 +53,7 @@ object CoordinateSlideOptimisedPosterior { def apply[F[_]: Async]( coordinateSlideConfig: CoordinateSlideConfig, - posterior: Posterior[F, Prior[F, _], Likelihood[F, _, _]], + posterior: Posterior[F, Prior[F, ?], Likelihood[F, ?, ?]], iterationUpdateCallback: OptimisationTelemetryUpdate => F[Unit], isConvergedCallback: Unit => F[Unit] ): CoordinateSlideOptimisedPosterior[F] = diff --git a/src/main/scala/thylacine/model/components/posterior/GaussianAnalyticPosterior.scala b/src/main/scala/thylacine/model/components/posterior/GaussianAnalyticPosterior.scala index 486679c..27e5e2e 100644 --- a/src/main/scala/thylacine/model/components/posterior/GaussianAnalyticPosterior.scala +++ b/src/main/scala/thylacine/model/components/posterior/GaussianAnalyticPosterior.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,19 +17,19 @@ package ai.entrolution package thylacine.model.components.posterior -import thylacine.model.components.likelihood._ -import thylacine.model.components.posterior.GaussianAnalyticPosterior._ -import thylacine.model.components.prior._ -import thylacine.model.core.GenericIdentifier._ -import thylacine.model.core._ +import thylacine.model.components.likelihood.* +import thylacine.model.components.posterior.GaussianAnalyticPosterior.* +import thylacine.model.components.prior.* +import thylacine.model.core.GenericIdentifier.* +import thylacine.model.core.* import thylacine.model.core.values.IndexedVectorCollection.ModelParameterCollection import thylacine.model.core.values.{ MatrixContainer, VectorContainer } import thylacine.model.sampling.ModelParameterSampler -import breeze.linalg._ -import breeze.stats.distributions._ +import breeze.linalg.* +import breeze.stats.distributions.* import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* import org.apache.commons.math3.random.MersenneTwister import scala.annotation.unused diff --git a/src/main/scala/thylacine/model/components/posterior/HmcmcSampledPosterior.scala b/src/main/scala/thylacine/model/components/posterior/HmcmcSampledPosterior.scala index ca169da..a177d95 100644 --- a/src/main/scala/thylacine/model/components/posterior/HmcmcSampledPosterior.scala +++ b/src/main/scala/thylacine/model/components/posterior/HmcmcSampledPosterior.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,10 +34,10 @@ case class HmcmcSampledPosterior[F[_]: Async]( private[thylacine] val hmcmcConfig: HmcmcConfig, override protected val telemetryUpdateCallback: HmcmcTelemetryUpdate => F[Unit], private[thylacine] val seed: Map[String, Vector[Double]], - override private[thylacine] val priors: Set[Prior[F, _]], - override private[thylacine] val likelihoods: Set[Likelihood[F, _, _]] + override private[thylacine] val priors: Set[Prior[F, ?]], + override private[thylacine] val likelihoods: Set[Likelihood[F, ?, ?]] ) extends AsyncImplicits[F] - with Posterior[F, Prior[F, _], Likelihood[F, _, _]] + with Posterior[F, Prior[F, ?], Likelihood[F, ?, ?]] with HmcmcEngine[F] { final override protected val simulationsBetweenSamples: Int = @@ -62,7 +62,7 @@ object HmcmcSampledPosterior { @unused def apply[F[_]: Async]( hmcmcConfig: HmcmcConfig, - posterior: Posterior[F, Prior[F, _], Likelihood[F, _, _]], + posterior: Posterior[F, Prior[F, ?], Likelihood[F, ?, ?]], telemetryUpdateCallback: HmcmcTelemetryUpdate => F[Unit], seed: Map[String, Vector[Double]] ): HmcmcSampledPosterior[F] = diff --git a/src/main/scala/thylacine/model/components/posterior/HookeAndJeevesOptimisedPosterior.scala b/src/main/scala/thylacine/model/components/posterior/HookeAndJeevesOptimisedPosterior.scala index 2960eb8..fec6f79 100644 --- a/src/main/scala/thylacine/model/components/posterior/HookeAndJeevesOptimisedPosterior.scala +++ b/src/main/scala/thylacine/model/components/posterior/HookeAndJeevesOptimisedPosterior.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,10 +30,10 @@ case class HookeAndJeevesOptimisedPosterior[F[_]: Async]( private[thylacine] val hookeAndJeevesConfig: HookeAndJeevesConfig, override protected val iterationUpdateCallback: OptimisationTelemetryUpdate => F[Unit], override protected val isConvergedCallback: Unit => F[Unit], - override private[thylacine] val priors: Set[Prior[F, _]], - override private[thylacine] val likelihoods: Set[Likelihood[F, _, _]] + override private[thylacine] val priors: Set[Prior[F, ?]], + override private[thylacine] val likelihoods: Set[Likelihood[F, ?, ?]] ) extends AsyncImplicits[F] - with Posterior[F, Prior[F, _], Likelihood[F, _, _]] + with Posterior[F, Prior[F, ?], Likelihood[F, ?, ?]] with HookeAndJeevesEngine[F] { override protected val convergenceThreshold: Double = @@ -48,7 +48,7 @@ object HookeAndJeevesOptimisedPosterior { def apply[F[_]: Async]( hookeAndJeevesConfig: HookeAndJeevesConfig, - posterior: Posterior[F, Prior[F, _], Likelihood[F, _, _]], + posterior: Posterior[F, Prior[F, ?], Likelihood[F, ?, ?]], iterationUpdateCallback: OptimisationTelemetryUpdate => F[Unit], isConvergedCallback: Unit => F[Unit] ): HookeAndJeevesOptimisedPosterior[F] = diff --git a/src/main/scala/thylacine/model/components/posterior/LeapfrogMcmcSampledPosterior.scala b/src/main/scala/thylacine/model/components/posterior/LeapfrogMcmcSampledPosterior.scala index a742c88..0d91b3b 100644 --- a/src/main/scala/thylacine/model/components/posterior/LeapfrogMcmcSampledPosterior.scala +++ b/src/main/scala/thylacine/model/components/posterior/LeapfrogMcmcSampledPosterior.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ import thylacine.model.sampling.SampleRequest import thylacine.model.sampling.leapfrog.LeapfrogMcmcEngine import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* import scala.annotation.unused import scala.collection.immutable.Queue @@ -40,8 +40,8 @@ case class LeapfrogMcmcSampledPosterior[F[_]: STM: Async]( protected val sampleRequestSetCallback: Int => F[Unit], protected val sampleRequestUpdateCallback: Int => F[Unit], private[thylacine] val seed: Map[String, Vector[Double]], - private[thylacine] val priors: Set[Prior[F, _]], - private[thylacine] val likelihoods: Set[Likelihood[F, _, _]], + private[thylacine] val priors: Set[Prior[F, ?]], + private[thylacine] val likelihoods: Set[Likelihood[F, ?, ?]], protected val sampleRequests: TxnVar[F, Queue[SampleRequest[F]]], protected val burnInComplete: TxnVar[F, Boolean], protected val interSampleDistanceCalculationResults: TxnVar[F, Vector[Vector[Double]]], @@ -49,7 +49,7 @@ case class LeapfrogMcmcSampledPosterior[F[_]: STM: Async]( protected val samplePool: TxnVar[F, Vector[Vector[Double]]], protected val currentChainTallies: TxnVar[F, Vector[Int]] ) extends StmImplicits[F] - with Posterior[F, Prior[F, _], Likelihood[F, _, _]] + with Posterior[F, Prior[F, ?], Likelihood[F, ?, ?]] with LeapfrogMcmcEngine[F] { final override protected val stepsBetweenSamples: Int = @@ -72,7 +72,7 @@ object LeapfrogMcmcSampledPosterior { def of[F[_]: STM: Async]( leapfrogMcmcConfig: LeapfrogMcmcConfig, distanceCalculation: (Vector[Double], Vector[Double]) => Double, - posterior: Posterior[F, Prior[F, _], Likelihood[F, _, _]], + posterior: Posterior[F, Prior[F, ?], Likelihood[F, ?, ?]], sampleRequestSetCallback: Int => F[Unit], sampleRequestUpdateCallback: Int => F[Unit], seed: Map[String, Vector[Double]] diff --git a/src/main/scala/thylacine/model/components/posterior/MdsOptimisedPosterior.scala b/src/main/scala/thylacine/model/components/posterior/MdsOptimisedPosterior.scala index cb6c9fc..4f57d79 100644 --- a/src/main/scala/thylacine/model/components/posterior/MdsOptimisedPosterior.scala +++ b/src/main/scala/thylacine/model/components/posterior/MdsOptimisedPosterior.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,10 +32,10 @@ case class MdsOptimisedPosterior[F[_]: Async]( private[thylacine] val mdsConfig: MdsConfig, override protected val iterationUpdateCallback: OptimisationTelemetryUpdate => F[Unit], override protected val isConvergedCallback: Unit => F[Unit], - override private[thylacine] val priors: Set[Prior[F, _]], - override private[thylacine] val likelihoods: Set[Likelihood[F, _, _]] + override private[thylacine] val priors: Set[Prior[F, ?]], + override private[thylacine] val likelihoods: Set[Likelihood[F, ?, ?]] ) extends AsyncImplicits[F] - with Posterior[F, Prior[F, _], Likelihood[F, _, _]] + with Posterior[F, Prior[F, ?], Likelihood[F, ?, ?]] with MdsEngine[F] { override protected val expansionMultiplier: Double = @@ -56,7 +56,7 @@ object MdsOptimisedPosterior { @unused def apply[F[_]: Async]( mdsConfig: MdsConfig, - posterior: Posterior[F, Prior[F, _], Likelihood[F, _, _]], + posterior: Posterior[F, Prior[F, ?], Likelihood[F, ?, ?]], iterationUpdateCallback: OptimisationTelemetryUpdate => F[Unit], isConvergedCallback: Unit => F[Unit] ): MdsOptimisedPosterior[F] = diff --git a/src/main/scala/thylacine/model/components/posterior/Posterior.scala b/src/main/scala/thylacine/model/components/posterior/Posterior.scala index 2c41b00..b04272e 100644 --- a/src/main/scala/thylacine/model/components/posterior/Posterior.scala +++ b/src/main/scala/thylacine/model/components/posterior/Posterior.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,16 +17,16 @@ package ai.entrolution package thylacine.model.components.posterior -import thylacine.model.components.likelihood._ -import thylacine.model.components.prior._ -import thylacine.model.core.GenericIdentifier._ -import thylacine.model.core._ +import thylacine.model.components.likelihood.* +import thylacine.model.components.prior.* +import thylacine.model.core.GenericIdentifier.* +import thylacine.model.core.* import thylacine.model.core.values.IndexedVectorCollection.ModelParameterCollection import thylacine.model.core.values.modelparameters.{ ModelParameterPdf, ModelParameterContext } -import cats.syntax.all._ +import cats.syntax.all.* -private[thylacine] trait Posterior[F[_], P <: Prior[F, _], L <: Likelihood[F, _, _]] +private[thylacine] trait Posterior[F[_], P <: Prior[F, ?], L <: Likelihood[F, ?, ?]] extends ModelParameterPdf[F] with ModelParameterContext { this: AsyncImplicits[F] => diff --git a/src/main/scala/thylacine/model/components/posterior/PosteriorTerm.scala b/src/main/scala/thylacine/model/components/posterior/PosteriorTerm.scala index 32c2623..0677dc6 100644 --- a/src/main/scala/thylacine/model/components/posterior/PosteriorTerm.scala +++ b/src/main/scala/thylacine/model/components/posterior/PosteriorTerm.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/components/posterior/SlqIntegratedPosterior.scala b/src/main/scala/thylacine/model/components/posterior/SlqIntegratedPosterior.scala index f9244f9..19c8ee5 100644 --- a/src/main/scala/thylacine/model/components/posterior/SlqIntegratedPosterior.scala +++ b/src/main/scala/thylacine/model/components/posterior/SlqIntegratedPosterior.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ package ai.entrolution package thylacine.model.components.posterior import bengal.stm.STM -import bengal.stm.model.{TxnVar, TxnVarMap} +import bengal.stm.model.{ TxnVar, TxnVarMap } import thylacine.config.SlqConfig import thylacine.model.components.likelihood.Likelihood import thylacine.model.components.prior.Prior @@ -26,10 +26,10 @@ import thylacine.model.core.StmImplicits import thylacine.model.core.telemetry.SlqTelemetryUpdate import thylacine.model.core.values.IndexedVectorCollection import thylacine.model.core.values.IndexedVectorCollection.ModelParameterCollection -import thylacine.model.integration.slq._ +import thylacine.model.integration.slq.* import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* import scala.annotation.unused @@ -39,8 +39,8 @@ case class SlqIntegratedPosterior[F[_]: STM: Async]( override protected val domainRebuildStartCallback: Unit => F[Unit], override protected val domainRebuildFinishCallback: Unit => F[Unit], override protected val seeds: Set[ModelParameterCollection], - override private[thylacine] val priors: Set[Prior[F, _]], - override private[thylacine] val likelihoods: Set[Likelihood[F, _, _]], + override private[thylacine] val priors: Set[Prior[F, ?]], + override private[thylacine] val likelihoods: Set[Likelihood[F, ?, ?]], override protected val sampleDomain: TxnVar[F, PointInCubeCollection], override protected val samplePool: TxnVarMap[F, Double, ModelParameterCollection], override protected val samplePoolMinimumLogPdf: TxnVar[F, Double], @@ -52,7 +52,7 @@ case class SlqIntegratedPosterior[F[_]: STM: Async]( override protected val samplingSimulation: TxnVar[F, SamplingSimulation], override protected val isConverged: TxnVar[F, Boolean] ) extends StmImplicits[F] - with Posterior[F, Prior[F, _], Likelihood[F, _, _]] + with Posterior[F, Prior[F, ?], Likelihood[F, ?, ?]] with SlqEngine[F] { final override protected val slqSamplePoolSize: Int = slqConfig.poolSize @@ -86,7 +86,7 @@ object SlqIntegratedPosterior { @unused def of[F[_]: STM: Async]( slqConfig: SlqConfig, - posterior: Posterior[F, Prior[F, _], Likelihood[F, _, _]], + posterior: Posterior[F, Prior[F, ?], Likelihood[F, ?, ?]], slqTelemetryUpdateCallback: SlqTelemetryUpdate => F[Unit], domainRebuildStartCallback: Unit => F[Unit], domainRebuildFinishCallback: Unit => F[Unit], diff --git a/src/main/scala/thylacine/model/components/posterior/UnnormalisedPosterior.scala b/src/main/scala/thylacine/model/components/posterior/UnnormalisedPosterior.scala index fa867dc..16c8d48 100644 --- a/src/main/scala/thylacine/model/components/posterior/UnnormalisedPosterior.scala +++ b/src/main/scala/thylacine/model/components/posterior/UnnormalisedPosterior.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,19 +18,19 @@ package ai.entrolution package thylacine.model.components.posterior import thylacine.model.components.forwardmodel.ForwardModel -import thylacine.model.components.likelihood._ -import thylacine.model.components.prior._ +import thylacine.model.components.likelihood.* +import thylacine.model.components.prior.* import thylacine.model.core.{ AsyncImplicits, CanValidate } import thylacine.model.distributions.Distribution import cats.effect.kernel.Async case class UnnormalisedPosterior[F[_]: Async]( - override private[thylacine] val priors: Set[Prior[F, _]], - override private[thylacine] val likelihoods: Set[Likelihood[F, _, _]], + override private[thylacine] val priors: Set[Prior[F, ?]], + override private[thylacine] val likelihoods: Set[Likelihood[F, ?, ?]], override private[thylacine] val validated: Boolean = false ) extends AsyncImplicits[F] - with Posterior[F, Prior[F, _], Likelihood[F, _, _]] + with Posterior[F, Prior[F, ?], Likelihood[F, ?, ?]] with CanValidate[UnnormalisedPosterior[F]] { if (!validated) { // Ensure there are no conflicting identifiers. diff --git a/src/main/scala/thylacine/model/components/prior/CauchyPrior.scala b/src/main/scala/thylacine/model/components/prior/CauchyPrior.scala index f4fe802..080859c 100644 --- a/src/main/scala/thylacine/model/components/prior/CauchyPrior.scala +++ b/src/main/scala/thylacine/model/components/prior/CauchyPrior.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,8 @@ package ai.entrolution package thylacine.model.components.prior -import thylacine.model.core.GenericIdentifier._ -import thylacine.model.core._ +import thylacine.model.core.GenericIdentifier.* +import thylacine.model.core.* import thylacine.model.core.values.VectorContainer import thylacine.model.distributions.CauchyDistribution diff --git a/src/main/scala/thylacine/model/components/prior/GaussianPrior.scala b/src/main/scala/thylacine/model/components/prior/GaussianPrior.scala index e94ea43..b5a7580 100644 --- a/src/main/scala/thylacine/model/components/prior/GaussianPrior.scala +++ b/src/main/scala/thylacine/model/components/prior/GaussianPrior.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,8 +17,8 @@ package ai.entrolution package thylacine.model.components.prior -import thylacine.model.core.GenericIdentifier._ -import thylacine.model.core._ +import thylacine.model.core.GenericIdentifier.* +import thylacine.model.core.* import thylacine.model.core.values.{ MatrixContainer, VectorContainer } import thylacine.model.distributions.GaussianDistribution diff --git a/src/main/scala/thylacine/model/components/prior/Prior.scala b/src/main/scala/thylacine/model/components/prior/Prior.scala index 0d8826d..d185fcf 100644 --- a/src/main/scala/thylacine/model/components/prior/Prior.scala +++ b/src/main/scala/thylacine/model/components/prior/Prior.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package ai.entrolution package thylacine.model.components.prior import thylacine.model.components.posterior.PosteriorTerm -import thylacine.model.core.GenericIdentifier._ -import thylacine.model.core._ +import thylacine.model.core.GenericIdentifier.* +import thylacine.model.core.* import thylacine.model.core.values.IndexedVectorCollection.ModelParameterCollection import thylacine.model.core.values.modelparameters.{ ModelParameterContext, ModelParameterGenerator, ModelParameterPdf } import thylacine.model.core.values.{ IndexedVectorCollection, VectorContainer } @@ -27,7 +27,7 @@ import thylacine.model.distributions.Distribution import thylacine.model.sampling.ModelParameterSampler import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* trait Prior[F[_], +D <: Distribution] extends ModelParameterPdf[F] @@ -35,7 +35,7 @@ trait Prior[F[_], +D <: Distribution] with ModelParameterContext with ModelParameterSampler[F] with ModelParameterGenerator - with CanValidate[Prior[F, _]] { + with CanValidate[Prior[F, ?]] { this: AsyncImplicits[F] => protected def priorDistribution: D diff --git a/src/main/scala/thylacine/model/components/prior/UniformPrior.scala b/src/main/scala/thylacine/model/components/prior/UniformPrior.scala index d27ec23..8dcc012 100644 --- a/src/main/scala/thylacine/model/components/prior/UniformPrior.scala +++ b/src/main/scala/thylacine/model/components/prior/UniformPrior.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ package ai.entrolution package thylacine.model.components.prior import thylacine.model.core.AsyncImplicits -import thylacine.model.core.GenericIdentifier._ +import thylacine.model.core.GenericIdentifier.* import thylacine.model.core.values.IndexedVectorCollection.ModelParameterCollection import thylacine.model.core.values.{ IndexedVectorCollection, VectorContainer } import thylacine.model.distributions diff --git a/src/main/scala/thylacine/model/core/AsyncImplicits.scala b/src/main/scala/thylacine/model/core/AsyncImplicits.scala index 7e580e6..98a9cb0 100644 --- a/src/main/scala/thylacine/model/core/AsyncImplicits.scala +++ b/src/main/scala/thylacine/model/core/AsyncImplicits.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/core/CanValidate.scala b/src/main/scala/thylacine/model/core/CanValidate.scala index c164157..c5ce02e 100644 --- a/src/main/scala/thylacine/model/core/CanValidate.scala +++ b/src/main/scala/thylacine/model/core/CanValidate.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ package thylacine.model.core * Instead we create a flexible validation framework that will be enacted at the creation of any Bayesian graphical * network. Obviously, this won't get us compile time guarantees, but violations will fail the model quickly at runtime */ -private[thylacine] trait CanValidate[+T <: CanValidate[_]] { +private[thylacine] trait CanValidate[+T <: CanValidate[?]] { private[thylacine] def validated: Boolean private[thylacine] def getValidated: T } diff --git a/src/main/scala/thylacine/model/core/GenericIdentifier.scala b/src/main/scala/thylacine/model/core/GenericIdentifier.scala index 6f7f1f0..de12bdd 100644 --- a/src/main/scala/thylacine/model/core/GenericIdentifier.scala +++ b/src/main/scala/thylacine/model/core/GenericIdentifier.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/core/GenericMapping.scala b/src/main/scala/thylacine/model/core/GenericMapping.scala index 5bf00cd..5f3a4af 100644 --- a/src/main/scala/thylacine/model/core/GenericMapping.scala +++ b/src/main/scala/thylacine/model/core/GenericMapping.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/core/GenericScalarValuedMapping.scala b/src/main/scala/thylacine/model/core/GenericScalarValuedMapping.scala index 1e3e86b..9c8fe17 100644 --- a/src/main/scala/thylacine/model/core/GenericScalarValuedMapping.scala +++ b/src/main/scala/thylacine/model/core/GenericScalarValuedMapping.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/core/RecordedData.scala b/src/main/scala/thylacine/model/core/RecordedData.scala index 83f2313..80166f1 100644 --- a/src/main/scala/thylacine/model/core/RecordedData.scala +++ b/src/main/scala/thylacine/model/core/RecordedData.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/core/StmImplicits.scala b/src/main/scala/thylacine/model/core/StmImplicits.scala index 93458aa..8d7a1eb 100644 --- a/src/main/scala/thylacine/model/core/StmImplicits.scala +++ b/src/main/scala/thylacine/model/core/StmImplicits.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/core/computation/CachedComputation.scala b/src/main/scala/thylacine/model/core/computation/CachedComputation.scala index 035d82e..4991c0c 100644 --- a/src/main/scala/thylacine/model/core/computation/CachedComputation.scala +++ b/src/main/scala/thylacine/model/core/computation/CachedComputation.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,14 +18,14 @@ package ai.entrolution package thylacine.model.core.computation import bengal.stm.STM -import bengal.stm.model._ -import bengal.stm.syntax.all._ +import bengal.stm.model.* +import bengal.stm.syntax.all.* import thylacine.model.core.computation.CachedComputation.ComputationResult import thylacine.model.core.values.IndexedVectorCollection.ModelParameterCollection -import cats.effect.implicits._ +import cats.effect.implicits.* import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* import scala.annotation.unused diff --git a/src/main/scala/thylacine/model/core/computation/ComputationWrapper.scala b/src/main/scala/thylacine/model/core/computation/ComputationWrapper.scala index 5c868d4..4bc4b80 100644 --- a/src/main/scala/thylacine/model/core/computation/ComputationWrapper.scala +++ b/src/main/scala/thylacine/model/core/computation/ComputationWrapper.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/core/computation/FiniteDifferenceJacobian.scala b/src/main/scala/thylacine/model/core/computation/FiniteDifferenceJacobian.scala index eaea358..56a9138 100644 --- a/src/main/scala/thylacine/model/core/computation/FiniteDifferenceJacobian.scala +++ b/src/main/scala/thylacine/model/core/computation/FiniteDifferenceJacobian.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ package ai.entrolution package thylacine.model.core.computation -import thylacine.model.core.values._ +import thylacine.model.core.values.* import scala.annotation.unused diff --git a/src/main/scala/thylacine/model/core/telemetry/HmcmcTelemetryUpdate.scala b/src/main/scala/thylacine/model/core/telemetry/HmcmcTelemetryUpdate.scala index 952c171..ec16a4d 100644 --- a/src/main/scala/thylacine/model/core/telemetry/HmcmcTelemetryUpdate.scala +++ b/src/main/scala/thylacine/model/core/telemetry/HmcmcTelemetryUpdate.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/core/telemetry/OptimisationTelemetryUpdate.scala b/src/main/scala/thylacine/model/core/telemetry/OptimisationTelemetryUpdate.scala index f337d8b..c1a5c37 100644 --- a/src/main/scala/thylacine/model/core/telemetry/OptimisationTelemetryUpdate.scala +++ b/src/main/scala/thylacine/model/core/telemetry/OptimisationTelemetryUpdate.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/core/telemetry/SlqTelemetryUpdate.scala b/src/main/scala/thylacine/model/core/telemetry/SlqTelemetryUpdate.scala index 4d6a1ce..d20c3aa 100644 --- a/src/main/scala/thylacine/model/core/telemetry/SlqTelemetryUpdate.scala +++ b/src/main/scala/thylacine/model/core/telemetry/SlqTelemetryUpdate.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/core/telemetry/TelemetryReport.scala b/src/main/scala/thylacine/model/core/telemetry/TelemetryReport.scala index 4108854..cfa16b1 100644 --- a/src/main/scala/thylacine/model/core/telemetry/TelemetryReport.scala +++ b/src/main/scala/thylacine/model/core/telemetry/TelemetryReport.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/core/values/Container.scala b/src/main/scala/thylacine/model/core/values/Container.scala index a9b8163..1b77c6d 100644 --- a/src/main/scala/thylacine/model/core/values/Container.scala +++ b/src/main/scala/thylacine/model/core/values/Container.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/core/values/IndexedCollection.scala b/src/main/scala/thylacine/model/core/values/IndexedCollection.scala index 515d181..f72ab0a 100644 --- a/src/main/scala/thylacine/model/core/values/IndexedCollection.scala +++ b/src/main/scala/thylacine/model/core/values/IndexedCollection.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ package ai.entrolution package thylacine.model.core.values -import thylacine.model.core.GenericIdentifier._ +import thylacine.model.core.GenericIdentifier.* private[thylacine] trait IndexedCollection[T <: Container] { private[thylacine] def index: Map[ModelParameterIdentifier, T] diff --git a/src/main/scala/thylacine/model/core/values/IndexedMatrixCollection.scala b/src/main/scala/thylacine/model/core/values/IndexedMatrixCollection.scala index 5d1a37f..eecd4a5 100644 --- a/src/main/scala/thylacine/model/core/values/IndexedMatrixCollection.scala +++ b/src/main/scala/thylacine/model/core/values/IndexedMatrixCollection.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/core/values/IndexedVectorCollection.scala b/src/main/scala/thylacine/model/core/values/IndexedVectorCollection.scala index 0effcbf..70a7962 100644 --- a/src/main/scala/thylacine/model/core/values/IndexedVectorCollection.scala +++ b/src/main/scala/thylacine/model/core/values/IndexedVectorCollection.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ package ai.entrolution package thylacine.model.core.values -import thylacine.model.core.GenericIdentifier._ +import thylacine.model.core.GenericIdentifier.* import thylacine.model.core.{ CanValidate, GenericIdentifier } private[thylacine] case class IndexedVectorCollection( diff --git a/src/main/scala/thylacine/model/core/values/MatrixContainer.scala b/src/main/scala/thylacine/model/core/values/MatrixContainer.scala index 8fb4814..69149bf 100644 --- a/src/main/scala/thylacine/model/core/values/MatrixContainer.scala +++ b/src/main/scala/thylacine/model/core/values/MatrixContainer.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,10 +19,10 @@ package thylacine.model.core.values import thylacine.model.core.CanValidate -import breeze.linalg._ -import cats.implicits._ +import breeze.linalg.* +import cats.implicits.* -import scala.{ Vector => ScalaVector } +import scala.Vector as ScalaVector private[thylacine] case class MatrixContainer( values: Map[(Int, Int), Double], diff --git a/src/main/scala/thylacine/model/core/values/VectorContainer.scala b/src/main/scala/thylacine/model/core/values/VectorContainer.scala index 3fe335a..fd1385c 100644 --- a/src/main/scala/thylacine/model/core/values/VectorContainer.scala +++ b/src/main/scala/thylacine/model/core/values/VectorContainer.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,9 +20,9 @@ package thylacine.model.core.values import thylacine.model.core.CanValidate import thylacine.util.MathOps -import breeze.linalg._ +import breeze.linalg.* -import scala.{ Vector => ScalaVector } +import scala.Vector as ScalaVector private[thylacine] case class VectorContainer( values: Map[Int, Double], diff --git a/src/main/scala/thylacine/model/core/values/modelparameters/ModelParameterContext.scala b/src/main/scala/thylacine/model/core/values/modelparameters/ModelParameterContext.scala index 03ba0d0..59aa327 100644 --- a/src/main/scala/thylacine/model/core/values/modelparameters/ModelParameterContext.scala +++ b/src/main/scala/thylacine/model/core/values/modelparameters/ModelParameterContext.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/core/values/modelparameters/ModelParameterGenerator.scala b/src/main/scala/thylacine/model/core/values/modelparameters/ModelParameterGenerator.scala index c6d3383..e91a9a9 100644 --- a/src/main/scala/thylacine/model/core/values/modelparameters/ModelParameterGenerator.scala +++ b/src/main/scala/thylacine/model/core/values/modelparameters/ModelParameterGenerator.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/core/values/modelparameters/ModelParameterPdf.scala b/src/main/scala/thylacine/model/core/values/modelparameters/ModelParameterPdf.scala index 4650e5a..1b12afe 100644 --- a/src/main/scala/thylacine/model/core/values/modelparameters/ModelParameterPdf.scala +++ b/src/main/scala/thylacine/model/core/values/modelparameters/ModelParameterPdf.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,12 +18,12 @@ package ai.entrolution package thylacine.model.core.values.modelparameters import thylacine.model.core.values.IndexedVectorCollection.ModelParameterCollection -import thylacine.model.core.values._ +import thylacine.model.core.values.* import thylacine.model.core.{ AsyncImplicits, GenericScalarValuedMapping } import cats.effect.Async -import cats.effect.implicits._ -import cats.syntax.all._ +import cats.effect.implicits.* +import cats.syntax.all.* import scala.annotation.unused diff --git a/src/main/scala/thylacine/model/distributions/CauchyDistribution.scala b/src/main/scala/thylacine/model/distributions/CauchyDistribution.scala index 60ef639..1290800 100644 --- a/src/main/scala/thylacine/model/distributions/CauchyDistribution.scala +++ b/src/main/scala/thylacine/model/distributions/CauchyDistribution.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,8 @@ package thylacine.model.distributions import thylacine.model.core.values.{ MatrixContainer, VectorContainer } import thylacine.model.core.{ CanValidate, RecordedData } -import breeze.linalg._ -import breeze.stats.distributions._ +import breeze.linalg.* +import breeze.stats.distributions.* import org.apache.commons.math3.random.MersenneTwister import org.apache.commons.math3.special.Gamma.gamma import org.apache.commons.math3.util.FastMath diff --git a/src/main/scala/thylacine/model/distributions/Distribution.scala b/src/main/scala/thylacine/model/distributions/Distribution.scala index 8e44a10..ca78274 100644 --- a/src/main/scala/thylacine/model/distributions/Distribution.scala +++ b/src/main/scala/thylacine/model/distributions/Distribution.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/distributions/GaussianDistribution.scala b/src/main/scala/thylacine/model/distributions/GaussianDistribution.scala index 643541a..ce89669 100644 --- a/src/main/scala/thylacine/model/distributions/GaussianDistribution.scala +++ b/src/main/scala/thylacine/model/distributions/GaussianDistribution.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,8 @@ package thylacine.model.distributions import thylacine.model.core.values.{ MatrixContainer, VectorContainer } import thylacine.model.core.{ CanValidate, RecordedData } -import breeze.linalg._ -import breeze.stats.distributions._ +import breeze.linalg.* +import breeze.stats.distributions.* import org.apache.commons.math3.random.MersenneTwister private[thylacine] case class GaussianDistribution( diff --git a/src/main/scala/thylacine/model/distributions/UniformDistribution.scala b/src/main/scala/thylacine/model/distributions/UniformDistribution.scala index 34fd8c6..ead8a20 100644 --- a/src/main/scala/thylacine/model/distributions/UniformDistribution.scala +++ b/src/main/scala/thylacine/model/distributions/UniformDistribution.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,8 @@ package thylacine.model.distributions import thylacine.model.core.CanValidate import thylacine.model.core.values.VectorContainer -import scala.collection.immutable.{ Vector => ScalaVector } -import scala.collection.parallel.CollectionConverters._ +import scala.collection.immutable.Vector as ScalaVector +import scala.collection.parallel.CollectionConverters.* private[thylacine] case class UniformDistribution( upperBounds: VectorContainer, diff --git a/src/main/scala/thylacine/model/integration/ModelParameterIntegrator.scala b/src/main/scala/thylacine/model/integration/ModelParameterIntegrator.scala index 34e26ae..efe09ab 100644 --- a/src/main/scala/thylacine/model/integration/ModelParameterIntegrator.scala +++ b/src/main/scala/thylacine/model/integration/ModelParameterIntegrator.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/integration/slq/PointInCube.scala b/src/main/scala/thylacine/model/integration/slq/PointInCube.scala index 275fbe1..745eb72 100644 --- a/src/main/scala/thylacine/model/integration/slq/PointInCube.scala +++ b/src/main/scala/thylacine/model/integration/slq/PointInCube.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ package ai.entrolution package thylacine.model.integration.slq -import thylacine.model.core._ +import thylacine.model.core.* import thylacine.model.core.values.VectorContainer private[thylacine] case class PointInCube( diff --git a/src/main/scala/thylacine/model/integration/slq/PointInCubeCollection.scala b/src/main/scala/thylacine/model/integration/slq/PointInCubeCollection.scala index 817df5b..aa3f9bf 100644 --- a/src/main/scala/thylacine/model/integration/slq/PointInCubeCollection.scala +++ b/src/main/scala/thylacine/model/integration/slq/PointInCubeCollection.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ package ai.entrolution package thylacine.model.integration.slq -import thylacine.model.core._ +import thylacine.model.core.* import thylacine.model.core.values.VectorContainer import thylacine.util.MathOps diff --git a/src/main/scala/thylacine/model/integration/slq/PointInInterval.scala b/src/main/scala/thylacine/model/integration/slq/PointInInterval.scala index d490b85..45d79a9 100644 --- a/src/main/scala/thylacine/model/integration/slq/PointInInterval.scala +++ b/src/main/scala/thylacine/model/integration/slq/PointInInterval.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ package ai.entrolution package thylacine.model.integration.slq -import thylacine.model.core._ +import thylacine.model.core.* private[thylacine] case class PointInInterval( point: Double, diff --git a/src/main/scala/thylacine/model/integration/slq/QuadratureAbscissa.scala b/src/main/scala/thylacine/model/integration/slq/QuadratureAbscissa.scala index 3387e14..4eb009c 100644 --- a/src/main/scala/thylacine/model/integration/slq/QuadratureAbscissa.scala +++ b/src/main/scala/thylacine/model/integration/slq/QuadratureAbscissa.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ private[thylacine] case class QuadratureAbscissa( samplePool: Set[Double], abscissa: Vector[Double] ) { - import QuadratureAbscissa._ + import QuadratureAbscissa.* private[thylacine] lazy val maxSample: Double = samplePool.max diff --git a/src/main/scala/thylacine/model/integration/slq/QuadratureAbscissaCollection.scala b/src/main/scala/thylacine/model/integration/slq/QuadratureAbscissaCollection.scala index 2f27e27..2e3d1f5 100644 --- a/src/main/scala/thylacine/model/integration/slq/QuadratureAbscissaCollection.scala +++ b/src/main/scala/thylacine/model/integration/slq/QuadratureAbscissaCollection.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/integration/slq/QuadratureDomainTelemetry.scala b/src/main/scala/thylacine/model/integration/slq/QuadratureDomainTelemetry.scala index b28bcd8..8dea0a7 100644 --- a/src/main/scala/thylacine/model/integration/slq/QuadratureDomainTelemetry.scala +++ b/src/main/scala/thylacine/model/integration/slq/QuadratureDomainTelemetry.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/integration/slq/QuadratureIntegrator.scala b/src/main/scala/thylacine/model/integration/slq/QuadratureIntegrator.scala index 92fc335..5fb19a1 100644 --- a/src/main/scala/thylacine/model/integration/slq/QuadratureIntegrator.scala +++ b/src/main/scala/thylacine/model/integration/slq/QuadratureIntegrator.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,7 @@ package thylacine.model.integration.slq import ch.obermuhlner.math.big.DefaultBigDecimalMath -import scala.collection.parallel.CollectionConverters._ +import scala.collection.parallel.CollectionConverters.* private[thylacine] case class QuadratureIntegrator( logPdfs: Vector[Double], diff --git a/src/main/scala/thylacine/model/integration/slq/SamplingSimulation.scala b/src/main/scala/thylacine/model/integration/slq/SamplingSimulation.scala index f67ccd3..cfa4251 100644 --- a/src/main/scala/thylacine/model/integration/slq/SamplingSimulation.scala +++ b/src/main/scala/thylacine/model/integration/slq/SamplingSimulation.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/integration/slq/SlqEngine.scala b/src/main/scala/thylacine/model/integration/slq/SlqEngine.scala index 422e844..d7df6b0 100644 --- a/src/main/scala/thylacine/model/integration/slq/SlqEngine.scala +++ b/src/main/scala/thylacine/model/integration/slq/SlqEngine.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,20 +18,20 @@ package ai.entrolution package thylacine.model.integration.slq import bengal.stm.STM -import bengal.stm.model._ -import bengal.stm.syntax.all._ -import thylacine.model.components.posterior._ -import thylacine.model.components.prior._ -import thylacine.model.core._ +import bengal.stm.model.* +import bengal.stm.syntax.all.* +import thylacine.model.components.posterior.* +import thylacine.model.components.prior.* +import thylacine.model.core.* import thylacine.model.core.telemetry.SlqTelemetryUpdate import thylacine.model.core.values.IndexedVectorCollection.ModelParameterCollection import thylacine.model.integration.ModelParameterIntegrator -import thylacine.model.integration.slq.SamplingSimulation._ +import thylacine.model.integration.slq.SamplingSimulation.* import thylacine.model.sampling.ModelParameterSampler -import cats.effect.implicits._ +import cats.effect.implicits.* import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* /** Implementation of the SLQ (pronounced like "slick") algorithm introduced in Appendix B of [3]. * @@ -49,7 +49,7 @@ import cats.syntax.all._ * stochastic quadratures Plasma Phys. Control Fusion 56 (2014) 114011 */ private[thylacine] trait SlqEngine[F[_]] extends ModelParameterIntegrator[F] with ModelParameterSampler[F] { - this: StmImplicits[F] with Posterior[F, Prior[F, _], _] => + this: StmImplicits[F] with Posterior[F, Prior[F, ?], ?] => import SlqEngine._ diff --git a/src/main/scala/thylacine/model/optimization/ModelParameterOptimizer.scala b/src/main/scala/thylacine/model/optimization/ModelParameterOptimizer.scala index b88c545..f5a7f2a 100644 --- a/src/main/scala/thylacine/model/optimization/ModelParameterOptimizer.scala +++ b/src/main/scala/thylacine/model/optimization/ModelParameterOptimizer.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ import thylacine.model.core.AsyncImplicits import thylacine.model.core.values.IndexedVectorCollection import thylacine.model.core.values.IndexedVectorCollection.ModelParameterCollection -import cats.syntax.all._ +import cats.syntax.all.* import scala.annotation.unused diff --git a/src/main/scala/thylacine/model/optimization/gradientdescent/ConjugateGradientEngine.scala b/src/main/scala/thylacine/model/optimization/gradientdescent/ConjugateGradientEngine.scala index 737ecbe..4df51be 100644 --- a/src/main/scala/thylacine/model/optimization/gradientdescent/ConjugateGradientEngine.scala +++ b/src/main/scala/thylacine/model/optimization/gradientdescent/ConjugateGradientEngine.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,14 +24,14 @@ import thylacine.model.core.telemetry.OptimisationTelemetryUpdate import thylacine.model.core.values.IndexedVectorCollection.ModelParameterCollection import thylacine.model.optimization.ModelParameterOptimizer import thylacine.model.optimization.line.{ GoldenSectionSearch, LineEvaluationResult } -import thylacine.util.ScalaVectorOps.Implicits._ +import thylacine.util.ScalaVectorOps.Implicits.* -import cats.effect.implicits._ +import cats.effect.implicits.* import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* trait ConjugateGradientEngine[F[_]] extends ModelParameterOptimizer[F] with GoldenSectionSearch[F] { - this: AsyncImplicits[F] with Posterior[F, Prior[F, _], _] => + this: AsyncImplicits[F] & Posterior[F, Prior[F, ?], ?] => protected val telemetryPrefix: String = "Conjugate Gradient" diff --git a/src/main/scala/thylacine/model/optimization/hookeandjeeves/CoordinateSlideEngine.scala b/src/main/scala/thylacine/model/optimization/hookeandjeeves/CoordinateSlideEngine.scala index b7aa614..a062967 100644 --- a/src/main/scala/thylacine/model/optimization/hookeandjeeves/CoordinateSlideEngine.scala +++ b/src/main/scala/thylacine/model/optimization/hookeandjeeves/CoordinateSlideEngine.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,10 +23,10 @@ import thylacine.model.core.AsyncImplicits import thylacine.model.optimization.line.GoldenSectionSearch import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* import scala.util.Random -import scala.{ Vector => ScalaVector } +import scala.Vector as ScalaVector // Modification of standard Hooke and Jeeves to leverage // line searches along each coordinate direction. @@ -34,7 +34,7 @@ import scala.{ Vector => ScalaVector } // initial triad between the endpoints or explores in the direction // of greatest increase private[thylacine] trait CoordinateSlideEngine[F[_]] extends HookeAndJeevesEngine[F] with GoldenSectionSearch[F] { - this: AsyncImplicits[F] with Posterior[F, Prior[F, _], _] => + this: AsyncImplicits[F] & Posterior[F, Prior[F, ?], ?] => override protected val telemetryPrefix: String = "Coordinate Slide" diff --git a/src/main/scala/thylacine/model/optimization/hookeandjeeves/HookeAndJeevesEngine.scala b/src/main/scala/thylacine/model/optimization/hookeandjeeves/HookeAndJeevesEngine.scala index 8412ead..9f62372 100644 --- a/src/main/scala/thylacine/model/optimization/hookeandjeeves/HookeAndJeevesEngine.scala +++ b/src/main/scala/thylacine/model/optimization/hookeandjeeves/HookeAndJeevesEngine.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,15 +25,15 @@ import thylacine.model.core.values.IndexedVectorCollection.ModelParameterCollect import thylacine.model.optimization.ModelParameterOptimizer import thylacine.util.MathOps -import cats.effect.implicits._ +import cats.effect.implicits.* import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* import scala.util.Random -import scala.{ Vector => ScalaVector } +import scala.Vector as ScalaVector private[thylacine] trait HookeAndJeevesEngine[F[_]] extends ModelParameterOptimizer[F] { - this: AsyncImplicits[F] with Posterior[F, Prior[F, _], _] => + this: AsyncImplicits[F] & Posterior[F, Prior[F, ?], ?] => protected val telemetryPrefix: String = "Hooke and Jeeves" protected def convergenceThreshold: Double diff --git a/src/main/scala/thylacine/model/optimization/line/GoldenSectionSearch.scala b/src/main/scala/thylacine/model/optimization/line/GoldenSectionSearch.scala index 4df861d..053a6f7 100644 --- a/src/main/scala/thylacine/model/optimization/line/GoldenSectionSearch.scala +++ b/src/main/scala/thylacine/model/optimization/line/GoldenSectionSearch.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,15 +20,15 @@ package thylacine.model.optimization.line import thylacine.model.core.AsyncImplicits import thylacine.model.core.values.modelparameters.{ ModelParameterContext, ModelParameterPdf } import thylacine.model.optimization.line.GoldenSectionSearch.{ inversePhi, inversePhiSquared } -import thylacine.util.ScalaVectorOps.Implicits._ +import thylacine.util.ScalaVectorOps.Implicits.* import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* import scala.util.Random private[thylacine] trait GoldenSectionSearch[F[_]] extends LineProbe[F] with LineSearch[F] { - this: AsyncImplicits[F] with ModelParameterPdf[F] with ModelParameterContext => + this: AsyncImplicits[F] & ModelParameterPdf[F] & ModelParameterContext => protected def goldenSectionTolerance: Double diff --git a/src/main/scala/thylacine/model/optimization/line/LineEvaluationResult.scala b/src/main/scala/thylacine/model/optimization/line/LineEvaluationResult.scala index 57096d3..83a9e4c 100644 --- a/src/main/scala/thylacine/model/optimization/line/LineEvaluationResult.scala +++ b/src/main/scala/thylacine/model/optimization/line/LineEvaluationResult.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/optimization/line/LineEvaluationTriple.scala b/src/main/scala/thylacine/model/optimization/line/LineEvaluationTriple.scala index 807f8b9..7d0e24f 100644 --- a/src/main/scala/thylacine/model/optimization/line/LineEvaluationTriple.scala +++ b/src/main/scala/thylacine/model/optimization/line/LineEvaluationTriple.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/optimization/line/LineProbe.scala b/src/main/scala/thylacine/model/optimization/line/LineProbe.scala index e77e947..e1e4b29 100644 --- a/src/main/scala/thylacine/model/optimization/line/LineProbe.scala +++ b/src/main/scala/thylacine/model/optimization/line/LineProbe.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,10 +22,10 @@ import thylacine.model.core.values.IndexedVectorCollection.ModelParameterCollect import thylacine.model.core.values.modelparameters.{ ModelParameterContext, ModelParameterPdf } import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* private[thylacine] trait LineProbe[F[_]] { - this: AsyncImplicits[F] with ModelParameterPdf[F] with ModelParameterContext => + this: AsyncImplicits[F] & ModelParameterPdf[F] & ModelParameterContext => protected def lineProbeExpansionFactor: Double diff --git a/src/main/scala/thylacine/model/optimization/line/LineSearch.scala b/src/main/scala/thylacine/model/optimization/line/LineSearch.scala index 5ee62ef..3c7a697 100644 --- a/src/main/scala/thylacine/model/optimization/line/LineSearch.scala +++ b/src/main/scala/thylacine/model/optimization/line/LineSearch.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/optimization/mds/MdsEngine.scala b/src/main/scala/thylacine/model/optimization/mds/MdsEngine.scala index e3bf894..192c8d1 100644 --- a/src/main/scala/thylacine/model/optimization/mds/MdsEngine.scala +++ b/src/main/scala/thylacine/model/optimization/mds/MdsEngine.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,12 +24,12 @@ import thylacine.model.core.telemetry.OptimisationTelemetryUpdate import thylacine.model.core.values.IndexedVectorCollection.ModelParameterCollection import thylacine.model.optimization.ModelParameterOptimizer -import cats.effect.implicits._ +import cats.effect.implicits.* import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* trait MdsEngine[F[_]] extends ModelParameterOptimizer[F] { - this: AsyncImplicits[F] with Posterior[F, Prior[F, _], _] => + this: AsyncImplicits[F] & Posterior[F, Prior[F, ?], ?] => protected def expansionMultiplier: Double diff --git a/src/main/scala/thylacine/model/optimization/mds/ModelParameterSimplex.scala b/src/main/scala/thylacine/model/optimization/mds/ModelParameterSimplex.scala index ecb4f01..2e6de46 100644 --- a/src/main/scala/thylacine/model/optimization/mds/ModelParameterSimplex.scala +++ b/src/main/scala/thylacine/model/optimization/mds/ModelParameterSimplex.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/model/sampling/ModelParameterSampler.scala b/src/main/scala/thylacine/model/sampling/ModelParameterSampler.scala index e398387..1d28948 100644 --- a/src/main/scala/thylacine/model/sampling/ModelParameterSampler.scala +++ b/src/main/scala/thylacine/model/sampling/ModelParameterSampler.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,10 +22,10 @@ import thylacine.model.core.values.IndexedVectorCollection.ModelParameterCollect import thylacine.model.core.values.VectorContainer import thylacine.model.core.values.modelparameters.ModelParameterContext -import cats.syntax.all._ +import cats.syntax.all.* trait ModelParameterSampler[F[_]] { - this: AsyncImplicits[F] with ModelParameterContext => + this: AsyncImplicits[F] & ModelParameterContext => protected def sampleModelParameters(numberOfSamples: Int): F[Set[ModelParameterCollection]] diff --git a/src/main/scala/thylacine/model/sampling/hmcmc/HmcmcEngine.scala b/src/main/scala/thylacine/model/sampling/hmcmc/HmcmcEngine.scala index f5159d4..88f8bf4 100644 --- a/src/main/scala/thylacine/model/sampling/hmcmc/HmcmcEngine.scala +++ b/src/main/scala/thylacine/model/sampling/hmcmc/HmcmcEngine.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ package ai.entrolution package thylacine.model.sampling.hmcmc -import thylacine.model.components.posterior._ +import thylacine.model.components.posterior.* import thylacine.model.components.prior.Prior import thylacine.model.core.AsyncImplicits import thylacine.model.core.telemetry.HmcmcTelemetryUpdate @@ -25,14 +25,14 @@ import thylacine.model.core.values.IndexedVectorCollection.ModelParameterCollect import thylacine.model.core.values.{ IndexedVectorCollection, VectorContainer } import thylacine.model.sampling.ModelParameterSampler -import cats.effect.implicits._ +import cats.effect.implicits.* import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* /** Implementation of the Hamiltonian MCMC sampling algorithm */ private[thylacine] trait HmcmcEngine[F[_]] extends ModelParameterSampler[F] { - this: AsyncImplicits[F] with Posterior[F, Prior[F, _], _] => + this: AsyncImplicits[F] with Posterior[F, Prior[F, ?], ?] => /* * - - -- --- ----- -------- ------------- diff --git a/src/main/scala/thylacine/model/sampling/leapfrog/LeapfrogMcmcEngine.scala b/src/main/scala/thylacine/model/sampling/leapfrog/LeapfrogMcmcEngine.scala index 7f8ea4b..a1a30e9 100644 --- a/src/main/scala/thylacine/model/sampling/leapfrog/LeapfrogMcmcEngine.scala +++ b/src/main/scala/thylacine/model/sampling/leapfrog/LeapfrogMcmcEngine.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,22 +17,22 @@ package ai.entrolution package thylacine.model.sampling.leapfrog -import bengal.stm._ -import bengal.stm.model._ -import bengal.stm.syntax.all._ -import thylacine.model.components.posterior._ +import bengal.stm.* +import bengal.stm.model.* +import bengal.stm.syntax.all.* +import thylacine.model.components.posterior.* import thylacine.model.components.prior.Prior import thylacine.model.core.StmImplicits import thylacine.model.core.values.IndexedVectorCollection import thylacine.model.core.values.IndexedVectorCollection.ModelParameterCollection -import thylacine.model.sampling.{ModelParameterSampler, SampleRequest} +import thylacine.model.sampling.{ ModelParameterSampler, SampleRequest } import thylacine.util.MathOps -import thylacine.util.ScalaVectorOps.Implicits._ +import thylacine.util.ScalaVectorOps.Implicits.* import cats.effect.Deferred -import cats.effect.implicits._ +import cats.effect.implicits.* import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* import scala.collection.immutable.Queue import scala.util.Random diff --git a/src/main/scala/thylacine/model/sampling/package.scala b/src/main/scala/thylacine/model/sampling/package.scala index f7ab5ec..ec957e1 100644 --- a/src/main/scala/thylacine/model/sampling/package.scala +++ b/src/main/scala/thylacine/model/sampling/package.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/util/MathOps.scala b/src/main/scala/thylacine/util/MathOps.scala index 58a5e6a..296a197 100644 --- a/src/main/scala/thylacine/util/MathOps.scala +++ b/src/main/scala/thylacine/util/MathOps.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/util/ScalaVectorOps.scala b/src/main/scala/thylacine/util/ScalaVectorOps.scala index 06e76c7..698dbbb 100644 --- a/src/main/scala/thylacine/util/ScalaVectorOps.scala +++ b/src/main/scala/thylacine/util/ScalaVectorOps.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/visualisation/CartesianSurface.scala b/src/main/scala/thylacine/visualisation/CartesianSurface.scala index 5341168..0826c00 100644 --- a/src/main/scala/thylacine/visualisation/CartesianSurface.scala +++ b/src/main/scala/thylacine/visualisation/CartesianSurface.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,15 +17,15 @@ package ai.entrolution package thylacine.visualisation -import bengal.stm._ -import bengal.stm.model._ -import bengal.stm.syntax.all._ +import bengal.stm.* +import bengal.stm.model.* +import bengal.stm.syntax.all.* import thylacine.util.MathOps.trapezoidalQuadrature import cats.data.NonEmptyVector -import cats.effect.implicits._ +import cats.effect.implicits.* import cats.effect.kernel.Async -import cats.syntax.all._ +import cats.syntax.all.* import scala.annotation.unused diff --git a/src/main/scala/thylacine/visualisation/GraphPoint.scala b/src/main/scala/thylacine/visualisation/GraphPoint.scala index 926165b..174adc0 100644 --- a/src/main/scala/thylacine/visualisation/GraphPoint.scala +++ b/src/main/scala/thylacine/visualisation/GraphPoint.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/visualisation/Simplex.scala b/src/main/scala/thylacine/visualisation/Simplex.scala index 91d5a51..4ec9e8c 100644 --- a/src/main/scala/thylacine/visualisation/Simplex.scala +++ b/src/main/scala/thylacine/visualisation/Simplex.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main/scala/thylacine/visualisation/SimplexChain.scala b/src/main/scala/thylacine/visualisation/SimplexChain.scala index 7766448..f91a17b 100644 --- a/src/main/scala/thylacine/visualisation/SimplexChain.scala +++ b/src/main/scala/thylacine/visualisation/SimplexChain.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/scala/thylacine/TestUtils.scala b/src/test/scala/thylacine/TestUtils.scala index ba6394b..e2a6aa8 100644 --- a/src/test/scala/thylacine/TestUtils.scala +++ b/src/test/scala/thylacine/TestUtils.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/test/scala/thylacine/model/components/ComponentFixture.scala b/src/test/scala/thylacine/model/components/ComponentFixture.scala index 3d74aa5..7be0165 100644 --- a/src/test/scala/thylacine/model/components/ComponentFixture.scala +++ b/src/test/scala/thylacine/model/components/ComponentFixture.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ import bengal.stm.STM import thylacine.config.{ ConjugateGradientConfig, CoordinateSlideConfig, HookeAndJeevesConfig, MdsConfig } import thylacine.model.components.forwardmodel.NonLinearForwardModel import thylacine.model.components.likelihood.{ GaussianLikelihood, GaussianLinearLikelihood } -import thylacine.model.components.posterior._ +import thylacine.model.components.posterior.* import thylacine.model.components.prior.{ GaussianPrior, UniformPrior } import cats.effect.IO @@ -73,7 +73,7 @@ object ComponentFixture { nonAnalyticForwardModel <- fooNonAnalyticForwardModelF } yield GaussianLikelihood[IO, NonLinearForwardModel[IO]]( forwardModel = nonAnalyticForwardModel, - measurements = Vector(7, 10), + measurements = Vector(7d, 10d), uncertainties = Vector(0.01, 0.01) ) @@ -179,7 +179,7 @@ object ComponentFixture { convergenceThreshold = 1e-20, goldenSectionTolerance = 1e-10, lineProbeExpansionFactor = 2.0, - minimumNumberOfIterations = 1000 + minimumNumberOfIterations = 10000 ) def conjugateGradientOptimisedPosteriorF(implicit stm: STM[IO]): IO[ConjugateGradientOptimisedPosterior[IO]] = diff --git a/src/test/scala/thylacine/model/components/likelihood/GaussianLikelihoodSpec.scala b/src/test/scala/thylacine/model/components/likelihood/GaussianLikelihoodSpec.scala index f2e178b..c3883eb 100644 --- a/src/test/scala/thylacine/model/components/likelihood/GaussianLikelihoodSpec.scala +++ b/src/test/scala/thylacine/model/components/likelihood/GaussianLikelihoodSpec.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,7 +32,7 @@ class GaussianLikelihoodSpec extends AsyncFreeSpec with AsyncIOSpec with Matcher "generate the a zero gradient at the likelihood maximum" in { (for { - implicit0(stm: STM[IO]) <- STM.runtime[IO] + case implicit0(stm: STM[IO]) <- STM.runtime[IO] likelihood <- fooNonAnalyticLikelihoodF result <- likelihood.logPdfGradientAt(IndexedVectorCollection(Map("foo" -> Vector(1d, 2d)))) } yield result.genericScalaRepresentation) @@ -41,7 +41,7 @@ class GaussianLikelihoodSpec extends AsyncFreeSpec with AsyncIOSpec with Matcher "generate the correct gradient of the logPdf for a given point" in { (for { - implicit0(stm: STM[IO]) <- STM.runtime[IO] + case implicit0(stm: STM[IO]) <- STM.runtime[IO] likelihood <- fooNonAnalyticLikelihoodF result <- likelihood.logPdfGradientAt(IndexedVectorCollection(Map("foo" -> Vector(3d, 2d)))) } yield result.genericScalaRepresentation) diff --git a/src/test/scala/thylacine/model/components/likelihood/GaussianLinearLikelihoodSpec.scala b/src/test/scala/thylacine/model/components/likelihood/GaussianLinearLikelihoodSpec.scala index 567e6ab..377b525 100644 --- a/src/test/scala/thylacine/model/components/likelihood/GaussianLinearLikelihoodSpec.scala +++ b/src/test/scala/thylacine/model/components/likelihood/GaussianLinearLikelihoodSpec.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ class GaussianLinearLikelihoodSpec extends AsyncFreeSpec with AsyncIOSpec with M "generate the a zero gradient at the likelihood maximum" in { (for { - implicit0(stm: STM[IO]) <- STM.runtime[IO] + case implicit0(stm: STM[IO]) <- STM.runtime[IO] likelihood <- fooLikelihoodF result <- likelihood.logPdfGradientAt(IndexedVectorCollection(Map("foo" -> Vector(1d, 2d)))) } yield result.genericScalaRepresentation) @@ -40,7 +40,7 @@ class GaussianLinearLikelihoodSpec extends AsyncFreeSpec with AsyncIOSpec with M "generate the correct gradient of the logPdf for a given point" in { (for { - implicit0(stm: STM[IO]) <- STM.runtime[IO] + case implicit0(stm: STM[IO]) <- STM.runtime[IO] likelihood <- fooLikelihoodF result <- likelihood.logPdfGradientAt(IndexedVectorCollection(Map("foo" -> Vector(3d, 2d)))) } yield result.genericScalaRepresentation) diff --git a/src/test/scala/thylacine/model/components/posterior/ConjugateGradientOptimisedPosteriorSpec.scala b/src/test/scala/thylacine/model/components/posterior/ConjugateGradientOptimisedPosteriorSpec.scala index 98fa123..b82fe06 100644 --- a/src/test/scala/thylacine/model/components/posterior/ConjugateGradientOptimisedPosteriorSpec.scala +++ b/src/test/scala/thylacine/model/components/posterior/ConjugateGradientOptimisedPosteriorSpec.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ package ai.entrolution package thylacine.model.components.posterior import bengal.stm.STM -import thylacine.TestUtils._ +import thylacine.TestUtils.* import thylacine.model.components.ComponentFixture.conjugateGradientOptimisedPosteriorF import cats.effect.IO @@ -30,7 +30,7 @@ class ConjugateGradientOptimisedPosteriorSpec extends AsyncFreeSpec with AsyncIO "ConjugateGradientOptimisedPosterior" - { "find the parameters that correspond to the posterior maximum" in { (for { - implicit0(stm: STM[IO]) <- STM.runtime[IO] + case implicit0(stm: STM[IO]) <- STM.runtime[IO] posterior <- conjugateGradientOptimisedPosteriorF optimisationResult <- posterior.findMaximumLogPdf(Map("fooniform" -> Vector(.5d, .5d), "barniform" -> Vector(3d))) diff --git a/src/test/scala/thylacine/model/components/posterior/CoordinateSlideOptimisedPosteriorSpec.scala b/src/test/scala/thylacine/model/components/posterior/CoordinateSlideOptimisedPosteriorSpec.scala index e7357d0..7e47f45 100644 --- a/src/test/scala/thylacine/model/components/posterior/CoordinateSlideOptimisedPosteriorSpec.scala +++ b/src/test/scala/thylacine/model/components/posterior/CoordinateSlideOptimisedPosteriorSpec.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ package ai.entrolution package thylacine.model.components.posterior import bengal.stm.STM -import thylacine.TestUtils._ +import thylacine.TestUtils.* import thylacine.model.components.ComponentFixture.coordinateSlideOptimisedPosteriorF import cats.effect.IO @@ -30,7 +30,7 @@ class CoordinateSlideOptimisedPosteriorSpec extends AsyncFreeSpec with AsyncIOSp "CoordinateSlideOptimisedPosterior" - { "find the parameters that correspond to the posterior maximum" in { (for { - implicit0(stm: STM[IO]) <- STM.runtime[IO] + case implicit0(stm: STM[IO]) <- STM.runtime[IO] posterior <- coordinateSlideOptimisedPosteriorF optimisationResult <- posterior.findMaximumLogPdf(Map()) } yield maxIndexVectorDiff(optimisationResult._2, Map("fooniform" -> Vector(1, 2), "barniform" -> Vector(5)))) diff --git a/src/test/scala/thylacine/model/components/posterior/GaussianAnalyticPosteriorSpec.scala b/src/test/scala/thylacine/model/components/posterior/GaussianAnalyticPosteriorSpec.scala index c69d563..b742397 100644 --- a/src/test/scala/thylacine/model/components/posterior/GaussianAnalyticPosteriorSpec.scala +++ b/src/test/scala/thylacine/model/components/posterior/GaussianAnalyticPosteriorSpec.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,8 +18,8 @@ package ai.entrolution package thylacine.model.components.posterior import bengal.stm.STM -import thylacine.TestUtils._ -import thylacine.model.components.ComponentFixture._ +import thylacine.TestUtils.* +import thylacine.model.components.ComponentFixture.* import cats.effect.IO import cats.effect.testing.scalatest.AsyncIOSpec @@ -33,7 +33,7 @@ class GaussianAnalyticPosteriorSpec extends AsyncFreeSpec with AsyncIOSpec with // that chip away at the numerical accuracy of the result "generate the correct mean for the inference" in { (for { - implicit0(stm: STM[IO]) <- STM.runtime[IO] + case implicit0(stm: STM[IO]) <- STM.runtime[IO] posterior <- analyticPosteriorF } yield maxIndexVectorDiff(posterior.mean, Map("foo" -> Vector(1, 2), "bar" -> Vector(5)))) .asserting(_ shouldBe (0d +- .1)) @@ -44,7 +44,7 @@ class GaussianAnalyticPosteriorSpec extends AsyncFreeSpec with AsyncIOSpec with // be very small) "generate the correct covariance" in { (for { - implicit0(stm: STM[IO]) <- STM.runtime[IO] + case implicit0(stm: STM[IO]) <- STM.runtime[IO] posterior <- analyticPosteriorF } yield maxVectorDiff(posterior.covarianceStridedVector, Vector.fill(9)(0d))).asserting(_ shouldBe (0.0 +- .01)) } diff --git a/src/test/scala/thylacine/model/components/posterior/HookeAndJeevesOptimisedPosteriorSpec.scala b/src/test/scala/thylacine/model/components/posterior/HookeAndJeevesOptimisedPosteriorSpec.scala index 1693241..13b3f6c 100644 --- a/src/test/scala/thylacine/model/components/posterior/HookeAndJeevesOptimisedPosteriorSpec.scala +++ b/src/test/scala/thylacine/model/components/posterior/HookeAndJeevesOptimisedPosteriorSpec.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ package ai.entrolution package thylacine.model.components.posterior import bengal.stm.STM -import thylacine.TestUtils._ +import thylacine.TestUtils.* import thylacine.model.components.ComponentFixture.hookeAndJeevesOptimisedPosteriorF import cats.effect.IO @@ -30,7 +30,7 @@ class HookeAndJeevesOptimisedPosteriorSpec extends AsyncFreeSpec with AsyncIOSpe "HookeAndJeevesOptimisedPosterior" - { "find the parameters that correspond to the posterior maximum" in { (for { - implicit0(stm: STM[IO]) <- STM.runtime[IO] + case implicit0(stm: STM[IO]) <- STM.runtime[IO] posterior <- hookeAndJeevesOptimisedPosteriorF optimisationResult <- posterior.findMaximumLogPdf(Map()) } yield maxIndexVectorDiff(optimisationResult._2, Map("fooniform" -> Vector(1, 2), "barniform" -> Vector(5)))) diff --git a/src/test/scala/thylacine/model/components/posterior/MdsOptimisedPosteriorSpec.scala b/src/test/scala/thylacine/model/components/posterior/MdsOptimisedPosteriorSpec.scala index 80321f5..d5b2f2d 100644 --- a/src/test/scala/thylacine/model/components/posterior/MdsOptimisedPosteriorSpec.scala +++ b/src/test/scala/thylacine/model/components/posterior/MdsOptimisedPosteriorSpec.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ package ai.entrolution package thylacine.model.components.posterior import bengal.stm.STM -import thylacine.TestUtils._ +import thylacine.TestUtils.* import thylacine.model.components.ComponentFixture.mdsOptimisedPosteriorF import cats.effect.IO @@ -30,7 +30,7 @@ class MdsOptimisedPosteriorSpec extends AsyncFreeSpec with AsyncIOSpec with Matc "MdsOptimisedPosterior" - { "find the parameters that correspond to the posterior maximum" in { (for { - implicit0(stm: STM[IO]) <- STM.runtime[IO] + case implicit0(stm: STM[IO]) <- STM.runtime[IO] posterior <- mdsOptimisedPosteriorF optimisationResult <- posterior.findMaximumLogPdf(Map()) } yield maxIndexVectorDiff(optimisationResult._2, Map("fooniform" -> Vector(1, 2), "barniform" -> Vector(5)))) diff --git a/src/test/scala/thylacine/model/components/prior/GaussianPriorSpec.scala b/src/test/scala/thylacine/model/components/prior/GaussianPriorSpec.scala index a2d22ec..f9c0fa3 100644 --- a/src/test/scala/thylacine/model/components/prior/GaussianPriorSpec.scala +++ b/src/test/scala/thylacine/model/components/prior/GaussianPriorSpec.scala @@ -1,5 +1,5 @@ /* - * Copyright 2020-2022 Greg von Nessi + * Copyright 2023 Greg von Nessi * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.