-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
uploading tests and including mlflow on CI
- Loading branch information
Showing
6 changed files
with
78 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
module TestLoggers | ||
|
||
using Test | ||
using MLJBase | ||
using ..Models | ||
|
||
@testset "mlflow logger" begin | ||
artifact_directory = "mlj-test" | ||
experiment_name = "mlflow logger tests" | ||
|
||
@testset "outside extension tests" begin | ||
@test_throws ErrorException mlflow_logger() | ||
|
||
using MLFlowClient | ||
logger = mlflow_logger(; experiment_name=experiment_name, artifact_location=artifact_directory) | ||
|
||
@test logger.client isa MLFlow | ||
@test logger.experiment_name == experiment_name | ||
@test logger.artifact_location == artifact_directory | ||
end # @testset "outside extension tests" | ||
|
||
@testset "extension tests" begin | ||
X = (x=rand(4),) | ||
y = ["Chenta", "Missy", "Gala", "Wendy"] |> categorical | ||
|
||
mach = machine(ConstantClassifier(), X, y) | ||
fit!(mach, verbosity=0) | ||
|
||
logger = mlflow_logger(; experiment_name=experiment_name, artifact_location=artifact_directory) | ||
|
||
@testset "save" begin | ||
run = MLJBase.save(logger, mach) | ||
experiment = getexperiment(logger.client, run.info.experiment_id) | ||
@test run isa MLFlowRun | ||
@test experiment isa MLFlowExperiment | ||
|
||
deleterun(logger.client, run) | ||
deleteexperiment(logger.client, experiment) | ||
end # @testset "save" | ||
|
||
@testset "evaluate!" begin | ||
evaluate!(mach, resampling=Holdout(), logger=logger) | ||
|
||
experiments = searchexperiments(logger.client) | ||
experiments_ids = experiments .|> (e -> e.experiment_id) | ||
runs = searchruns(logger.client, experiments_ids) | ||
|
||
# it's 2 because of the default experiment | ||
@test length(experiments_ids) == 2 | ||
@test length(runs) == 1 | ||
|
||
deleterun(logger.client, runs[1]) | ||
deleteexperiment(logger.client, experiments[2]) | ||
end # @testset "evaluate!" | ||
end # @testset "extension tests" | ||
end # @testset "mlflow logger" | ||
|
||
end # module | ||
|
||
true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters