You are writing an ML experiment script using the Python SDK.
This code snippet is used to turn on the logging for the run:
... # Start logging data from the experiment run = experiment.start_logging() # load the dataset and count the rows train_data = pd.read_csv('train_data.csv') # set metrics to log row_count = (len(train_data)) # Log the row count run.log('rowcount', row_count) ...After completing the run, which two methods can you use to retrieve the metrics logged for the run?
Click on the arrows to vote for the correct answer
A. B. C. D.Answers: B and C.
Option A is incorrect because the run object doesn't have a get_log()method.
Option B is CORRECT because the JSON object returned by the get_metrics() method is the way of getting themetrics dogged during a run.
Option C is CORRECT because when working in a Jupyter notebook, the show() widget is a nice way of displaying metrics on the run.
Option D is incorrect because the get_details() method is used to get some “descriptive” information (definition, status, log files etc.) on the current run, but no metrics.
Reference:
After logging the metrics using the run.log()
method, there are a few ways to retrieve them. Here are the explanations for the given options:
A. Use run.get_log()
: This method will return a generator that contains all the logged data in the order it was logged. This method can be used to retrieve all the logged data including metrics, parameters, and artifacts. However, this method can be slower if you have a large amount of data to retrieve.
B. Use the JSON from run.get_metrics()
: This method returns a dictionary of the metrics that were logged during the run. The dictionary is in a JSON format, and you can access individual metrics by using their names as keys. This method can be faster and more efficient if you only need to retrieve the metrics.
C. Use RunDetails(run).show()
Jupyter widget: This method can be used to display the run details in a Jupyter widget. This widget will show you a summary of the run including the logged metrics, parameters, and artifacts. This method can be helpful if you want to quickly visualize the results of the run.
D. Use run.get_details()
: This method will return a dictionary of the run details, including the logged metrics, parameters, and artifacts. This method can be used to retrieve all the information about the run in a single call.
In summary, the two methods that can be used to retrieve the metrics logged for the run are options B and D. Option B is recommended if you only need to retrieve the metrics, while option D can be used to retrieve all the information about the run.