Skip to content

Commit

Permalink
make metrics a dictionary instead of a vector
Browse files Browse the repository at this point in the history
  • Loading branch information
deyandyankov committed Dec 12, 2021
1 parent 749548d commit cf69ecc
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ Base.show(io::IO, t::MLFlowRunDataMetric) = show(io, ShowCase(t, new_lines=true)
Represents run data.
# Fields
- `metrics::Vector{MLFlowRunDataMetric}`: run metrics.
- `metrics::Dict{String,MLFlowRunDataMetric}`: run metrics.
- `params::Dict{String,String}`: run parameters.
- `tags`: list of run tags.
Expand All @@ -178,12 +178,18 @@ Represents run data.
"""
struct MLFlowRunData
metrics::Vector{MLFlowRunDataMetric}
metrics::Dict{String,MLFlowRunDataMetric}
params::Union{Dict{String,String},Missing}
tags
end
function MLFlowRunData(data::Dict{String,Any})
metrics = haskey(data, "metrics") ? MLFlowRunDataMetric.(data["metrics"]) : MLFlowRunDataMetric[]
metrics = Dict{String,MLFlowRunDataMetric}()
if haskey(data, "metrics")
for metric in data["metrics"]
v = MLFlowRunDataMetric(metric)
metrics[v.key] = v
end
end
if haskey(data, "params")
params = Dict{String,String}()
for p in data["params"]
Expand Down Expand Up @@ -263,4 +269,4 @@ struct MLFlowArtifactDirInfo
end
Base.show(io::IO, t::MLFlowArtifactDirInfo) = show(io, ShowCase(t, new_lines=true))
get_path(mlfadi::MLFlowArtifactDirInfo) = mlfadi.dirpath
get_size(mlfadi::MLFlowArtifactDirInfo) = 0
get_size(mlfadi::MLFlowArtifactDirInfo) = 0

0 comments on commit cf69ecc

Please sign in to comment.