diff --git a/ext/DensityRatioEstimationChainRulesCoreExt.jl b/ext/DensityRatioEstimationChainRulesCoreExt.jl index 0ec4884..82e49ed 100644 --- a/ext/DensityRatioEstimationChainRulesCoreExt.jl +++ b/ext/DensityRatioEstimationChainRulesCoreExt.jl @@ -1,6 +1,7 @@ # ------------------------------------------------------------------ # Licensed under the MIT License. See LICENSE in the project root. # ------------------------------------------------------------------ + module DensityRatioEstimationChainRulesCoreExt if isdefined(Base, :get_extension) diff --git a/ext/DensityRatioEstimationConvexExt.jl b/ext/DensityRatioEstimationConvexExt.jl index d70f848..b416af8 100644 --- a/ext/DensityRatioEstimationConvexExt.jl +++ b/ext/DensityRatioEstimationConvexExt.jl @@ -1,6 +1,7 @@ # ------------------------------------------------------------------ # Licensed under the MIT License. See LICENSE in the project root. # ------------------------------------------------------------------ + module DensityRatioEstimationConvexExt if isdefined(Base, :get_extension) diff --git a/ext/DensityRatioEstimationGPUArraysExt.jl b/ext/DensityRatioEstimationGPUArraysExt.jl index c16705a..9f58743 100644 --- a/ext/DensityRatioEstimationGPUArraysExt.jl +++ b/ext/DensityRatioEstimationGPUArraysExt.jl @@ -1,6 +1,7 @@ # ------------------------------------------------------------------ # Licensed under the MIT License. See LICENSE in the project root. # ------------------------------------------------------------------ + module DensityRatioEstimationGPUArraysExt if isdefined(Base, :get_extension) diff --git a/ext/DensityRatioEstimationJuMPExt.jl b/ext/DensityRatioEstimationJuMPExt.jl index ee49421..44837d5 100644 --- a/ext/DensityRatioEstimationJuMPExt.jl +++ b/ext/DensityRatioEstimationJuMPExt.jl @@ -1,6 +1,7 @@ # ------------------------------------------------------------------ # Licensed under the MIT License. See LICENSE in the project root. # ------------------------------------------------------------------ + module DensityRatioEstimationJuMPExt if isdefined(Base, :get_extension) diff --git a/ext/DensityRatioEstimationOptimExt.jl b/ext/DensityRatioEstimationOptimExt.jl index 4b1b4f8..7dc088f 100644 --- a/ext/DensityRatioEstimationOptimExt.jl +++ b/ext/DensityRatioEstimationOptimExt.jl @@ -1,6 +1,7 @@ # ------------------------------------------------------------------ # Licensed under the MIT License. See LICENSE in the project root. # ------------------------------------------------------------------ + module DensityRatioEstimationOptimExt if isdefined(Base, :get_extension) @@ -12,7 +13,9 @@ else using ..DensityRatioEstimation: KLIEP, LSIF, OptimLib using ..Optim end + using LinearAlgebra + include("../src/kliep/optim.jl") include("../src/lsif/optim.jl") diff --git a/src/DensityRatioEstimation.jl b/src/DensityRatioEstimation.jl index f933757..c85e275 100644 --- a/src/DensityRatioEstimation.jl +++ b/src/DensityRatioEstimation.jl @@ -32,27 +32,25 @@ include("lcv.jl") # pure Julia implementations include("kmm/julia.jl") +# implementations that require extra dependencies if !isdefined(Base, :get_extension) using Requires end -# implementations that require extra dependencies @static if !isdefined(Base, :get_extension) function __init__() - - #Solvers - - #JuMP: KMM, LSIF + # JuMP: KMM, LSIF @require JuMP = "4076af6c-e467-56ae-b986-b466b2749572" begin @require Ipopt = "b6b21f68-93f8-5de0-b562-5493be1d77c9" begin include("../ext/DensityRatioEstimationJuMPExt.jl") end end - #Optim: KLIEP, LSIF + + # Optim: KLIEP, LSIF @require Optim = "429524aa-4258-5aef-a3af-852621145aeb" begin include("../ext/DensityRatioEstimationOptimExt.jl") end - #Convex: KLIEP + # Convex: KLIEP @require Convex = "f65535da-76fb-5f13-bab9-19810c17039a" begin @require ECOS = "e2685f51-7e38-5353-a97d-a921fd2c8199" begin include("../ext/DensityRatioEstimationConvexExt.jl") @@ -63,7 +61,6 @@ end @require ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" begin include("../ext/DensityRatioEstimationChainRulesCoreExt.jl") end - @require GPUArrays = "0c68f7d7-f131-5f86-a1c3-88cf8149b2d7" begin include("../ext/DensityRatioEstimationGPUArraysExt.jl") end diff --git a/src/kliep/convex.jl b/src/kliep/convex.jl index d6f3bbf..9f6641f 100644 --- a/src/kliep/convex.jl +++ b/src/kliep/convex.jl @@ -2,7 +2,7 @@ # Licensed under the MIT License. See LICENSE in the project root. # ------------------------------------------------------------------ -#This file is part of the module DensityRatioEstimationConvexExt. +# This file is part of the module DensityRatioEstimationConvexExt. function DensityRatioEstimation._kliep_coeffs(K_nu, K_de, dre::KLIEP, optlib::Type{ConvexLib}) # retrieve parameters diff --git a/src/kliep/optim.jl b/src/kliep/optim.jl index 025fe63..8074ea8 100644 --- a/src/kliep/optim.jl +++ b/src/kliep/optim.jl @@ -2,7 +2,7 @@ # Licensed under the MIT License. See LICENSE in the project root. # ------------------------------------------------------------------ -#This file is part of the module DensityRatioEstimationOptimExt. +# This file is part of the module DensityRatioEstimationOptimExt. function DensityRatioEstimation._kliep_coeffs(K_nu, K_de, dre::KLIEP, optlib::Type{OptimLib}) # retrieve parameters diff --git a/src/kmm/jump.jl b/src/kmm/jump.jl index 13eb481..2a3dfa6 100644 --- a/src/kmm/jump.jl +++ b/src/kmm/jump.jl @@ -2,7 +2,7 @@ # Licensed under the MIT License. See LICENSE in the project root. # ------------------------------------------------------------------ -#This file is part of the module DensityRatioEstimationJuMPExt. +# This file is part of the module DensityRatioEstimationJuMPExt. function _kmm_jump_model(K, κ, dre::AbstractKMM, optlib::Type{JuMPLib}) # number of denominator samples diff --git a/src/lsif/jump.jl b/src/lsif/jump.jl index 3c4169e..bdb4045 100644 --- a/src/lsif/jump.jl +++ b/src/lsif/jump.jl @@ -2,7 +2,7 @@ # Licensed under the MIT License. See LICENSE in the project root. # ------------------------------------------------------------------ -#This file is part of the module DensityRatioEstimationJuMPExt. +# This file is part of the module DensityRatioEstimationJuMPExt. function DensityRatioEstimation._lsif_coeffs(H, h, dre::LSIF, optlib::Type{JuMPLib}) # retrieve parameters diff --git a/src/lsif/optim.jl b/src/lsif/optim.jl index 9c7f27d..dc90fc6 100644 --- a/src/lsif/optim.jl +++ b/src/lsif/optim.jl @@ -2,7 +2,7 @@ # Licensed under the MIT License. See LICENSE in the project root. # ------------------------------------------------------------------ -#This file is part of the module DensityRatioEstimationOptimExt. +# This file is part of the module DensityRatioEstimationOptimExt. function DensityRatioEstimation._lsif_coeffs(H, h, dre::LSIF, optlib::Type{OptimLib}) # retrieve parameters