Skip to content

Download Candidate data as csv

Eduardo Bonet requested to merge mlops/download-experiment-data-as-csv into master

What does this MR do and why?

Candidate metrics and params are often used for further analysis by Data Scientists. This allows downloading the data from Projects::Ml::ExperimentsController as csv, accepting the same query parameters as the html rendered. UI to trigger this action will be added as a follow up

How to set up and validate locally

  1. Enable the feature flag

    echo "Feature.enable(:ml_experiment_tracking)" | bundle exec rails c
  2. Create an experiment and a few candidates. The user_id is your local user (1 for root) and project_id is the id for the project you are testing.

    # Added variables
    user_id = 1
    project_id = 1
    
    exp = Ml::Experiment.create!(name: "Awesome Gitlab Experiment", user_id: user_id, project_id: project_id)
    10.times.each { |i| exp.candidates.create!(user_id: user_id, start_time: 0, name: "candidate_#{i}") }
    exp.candidates.each_with_index { |c, i| c.metrics.create!(name: "auc", value: i*0.1 , tracked_at: Time.zone.now, step: 1)} 
    exp.candidates.each_with_index { |c, i| c.metrics.create!(name: "accuracy", value: i* 0.1+0.1 , tracked_at: Time.zone.now, step: 1)} 
    exp.candidates.each { |c| c.params.create!(name: "algorithm", value: ["LogisticRegression", "DecisionTree"].sample )}
  3. Navigate to path/to/project/-/ml/experiments/1.csv. This should download a csv file.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Eduardo Bonet

Merge request reports