Skip to content

Commit

Permalink
Merge 363f928 into 17deadd
Browse files Browse the repository at this point in the history
  • Loading branch information
englhardt committed Aug 31, 2020
2 parents 17deadd + 363f928 commit 37aefbd
Show file tree
Hide file tree
Showing 11 changed files with 40,532 additions and 28,177 deletions.
328 changes: 199 additions & 129 deletions Manifest.toml

Large diffs are not rendered by default.

48,810 changes: 28,535 additions & 20,275 deletions examples/svdd_parametrization.ipynb

Large diffs are not rendered by default.

19,554 changes: 11,789 additions & 7,765 deletions examples/svdd_training.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/classifiers/classifier_ssad.jl
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function predict(model::SSAD, target::Array{T,2}) where T <: Real
return model.ρ .- vec(mapslices(predict_observation, target, dims=1))
end

function fit!(model::SSAD, solver)
function fit!(model::SSAD, solver::SOLVER_TYPE)
debug(LOGGER, "[FIT] Fitting SSAD.")
model.state == model_created && throw(ModelStateException(model.state, model_initialized))

Expand All @@ -132,7 +132,7 @@ function fit!(model::SSAD, solver)
end

# see also tilitools https://github.com/nicococo/tilitools/blob/master/tilitools/ssad_convex.py
function solve!(model::SSAD, solver::JuMP.OptimizerFactory)
function solve!(model::SSAD, solver::SOLVER_TYPE)
debug(LOGGER, "[SOLVE] Setting up QP for SSAD with $(is_K_adjusted(model) ? "adjusted" : "non-adjusted") kernel matrix.")
QP = Model(solver)
K = is_K_adjusted(model) ? model.K_adjusted : model.K
Expand Down
2 changes: 1 addition & 1 deletion src/classifiers/classifier_svdd_neg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ end

set_C!(model::SVDDneg, C::Number) = set_C!(model, (C,C))

function solve!(model::SVDDneg, solver::JuMP.OptimizerFactory)
function solve!(model::SVDDneg, solver::SOLVER_TYPE)
ULin = merge_pools(model.pools, :U, :Lin)
length(ULin) > 0 || throw(ModelInvariantException("SVDDneg requires samples in pool :Lin or :U."))

Expand Down
2 changes: 1 addition & 1 deletion src/classifiers/classifier_svdd_neg_eps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function set_eps!(model::SVDDnegEps, eps::Number)
return nothing
end

function solve!(model::SVDDnegEps, solver::JuMP.OptimizerFactory)
function solve!(model::SVDDnegEps, solver::SOLVER_TYPE)
ULin = merge_pools(model.pools, :U, :Lin)
length(ULin) > 0 || throw(ModelInvariantException("SVDDnegEps requires samples in pool :Lin or :U."))

Expand Down
2 changes: 1 addition & 1 deletion src/classifiers/classifier_svdd_vanilla.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function set_C!(model::VanillaSVDD, C::Number)
return nothing
end

function solve!(model::VanillaSVDD, solver::JuMP.OptimizerFactory)
function solve!(model::VanillaSVDD, solver::SOLVER_TYPE)
debug(LOGGER, "[SOLVE] Setting up QP for VanillaSVDD with $(is_K_adjusted(model) ? "adjusted" : "non-adjusted") kernel matrix.")
QP = Model(solver)
K = is_K_adjusted(model) ? model.K_adjusted : model.K
Expand Down
2 changes: 1 addition & 1 deletion src/classifiers/sub/classifier_sub_svdd.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function fit!(model::SubSVDD, solver)
return status
end

function solve!(model::SubSVDD, solver::JuMP.OptimizerFactory)
function solve!(model::SubSVDD, solver::SOLVER_TYPE)
debug(LOGGER, "[SOLVE] Setting up QP for SubSVDD with $(is_K_adjusted(model) ? "adjusted" : "non-adjusted") kernel matrix.")
QP = Model(solver)
K = is_K_adjusted(model) ? model.K_adjusted : model.K
Expand Down
2 changes: 1 addition & 1 deletion src/init_strategies/strategies_combined.jl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ end
Determines C for WangGammaStrategy by using a provided C init strategy
"""
struct WangCombinedInitializationStrategy <: InitializationStrategyCombined
solver::JuMP.OptimizerFactory
solver::SOLVER_TYPE
gamma_search_range
C_strategy::InitializationStrategyC
end
Expand Down
1 change: 1 addition & 0 deletions src/svdd_base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import MLBase
const learning_pool_enc = LabelEnc.NativeLabels([:U, :Lin, :Lout])
const class_label_enc = LabelEnc.NativeLabels([:inlier, :outlier])
const OPT_PRECISION = 1e-7
const SOLVER_TYPE = JuMP.MOI.OptimizerWithAttributes

@enum ModelState model_created=1 model_initialized=2 model_fitted=3

Expand Down
2 changes: 1 addition & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ using MLKernels, MLLabelUtils
using Test
using LinearAlgebra, Random, Statistics

TEST_SOLVER = with_optimizer(Ipopt.Optimizer, print_level=0)
TEST_SOLVER = optimizer_with_attributes(Ipopt.Optimizer, "print_level" => 0)

include("test_utils.jl")

Expand Down

0 comments on commit 37aefbd

Please sign in to comment.