Skip to content

Conversation

RomeoV
Copy link

@RomeoV RomeoV commented Sep 2, 2025

Summary

Fixes type error where arrays were passed to logmetric instead of individual Float64 values. Now properly logs each point in the price path as a separate metric with step parameters.

Changes

  • Fixed docs/src/tutorial.md:98-101: Replaced single logmetric call with loop through array values
  • Fixed examples/simple-with-mlflow.jl:47-50: Applied same correction

Problem

The tutorial and examples attempted to log entire arrays:

logmetric(mlf, exprun, "pricepath$(idx)", pricepath)  # ❌ pricepath is Array{Float64}

But logmetric only accepts single Float64 values:

logmetric(instance::MLFlow, run::Run, key::String, value::Float64; timestamp, step)

Solution

Updated to log each array element individually with step parameter:

# Log each point in the price path as a separate metric with step parameter
for (step, value) in enumerate(pricepath)
    logmetric(mlf, exprun, "pricepath$(idx)", Float64(value); step=step-1)
end

Benefits

  • ✅ Fixes the type error that prevented tutorial execution
  • ✅ Maintains original intent of logging price paths over time
  • ✅ Uses MLFlow's step parameter to track temporal sequence
  • ✅ Creates proper time-series metrics that can be visualized in MLFlow UI
  • ✅ Follows logmetric API requirements

Impact

  • Makes the tutorial examples functional for metric logging
  • Provides better MLFlow visualization of time-series data
  • Demonstrates proper usage of MLFlow's step parameter for sequential data

Test plan

  • Verified logmetric method signature requires Float64 values
  • Confirmed step parameter usage for time-series data
  • Both tutorial and example files updated consistently
  • Solution maintains the intended data logging semantics

Fixes #63

🤖 Generated with Claude Code

Fixes type error where arrays were passed to logmetric instead of individual Float64 values.
Now properly logs each point in the price path as a separate metric with step parameters.

Before: logmetric(mlf, exprun, "pricepath$(idx)", pricepath)  # ❌ Array
After:  Loop through array and log individual values with step parameter

This approach:
- Maintains the original intent of logging price paths over time
- Uses MLFlow's step parameter to track the temporal sequence
- Creates proper time-series metrics that can be visualized in MLFlow UI
- Follows logmetric API requirements (Float64 values only)

Fixes JuliaAI#63

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@RomeoV RomeoV mentioned this pull request Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tutorial attempts to log arrays with logmetric (type error)
1 participant