-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Labels
in progressWork is being done to resolve this issueWork is being done to resolve this issue
Description
When trying to use the plot_metrics() method, I get the following errors:
File "/home/wk9874/Documents/simvue/examples/venv/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 3790, in get_loc
return self._engine.get_loc(casted_key)
File "index.pyx", line 152, in pandas._libs.index.IndexEngine.get_loc
File "index.pyx", line 181, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 7080, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 7088, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'r'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "index.pyx", line 842, in pandas._libs.index.BaseMultiIndexCodesEngine.get_loc
File "/home/wk9874/Documents/simvue/examples/venv/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 3797, in get_loc
raise KeyError(key) from err
KeyError: 'r'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/wk9874/Documents/simvue/examples/venv/lib/python3.10/site-packages/pandas/core/indexes/multi.py", line 2938, in get_loc
return self._engine.get_loc(key)
File "index.pyx", line 845, in pandas._libs.index.BaseMultiIndexCodesEngine.get_loc
KeyError: ('r', 'a', 'step')
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/wk9874/Documents/simvue/examples/DocsExample/analysis.py", line 19, in <module>
mean_plot = client.plot_metrics(run_name, 'averages.mean', 'step')
File "/home/wk9874/Documents/simvue/examples/venv/lib/python3.10/site-packages/simvue/client.py", line 393, in plot_metrics
plt.plot(data[(run, name, xaxis)],
File "/home/wk9874/Documents/simvue/examples/venv/lib/python3.10/site-packages/pandas/core/frame.py", line 3895, in __getitem__
return self._getitem_multilevel(key)
File "/home/wk9874/Documents/simvue/examples/venv/lib/python3.10/site-packages/pandas/core/frame.py", line 3953, in _getitem_multilevel
loc = self.columns.get_loc(key)
File "/home/wk9874/Documents/simvue/examples/venv/lib/python3.10/site-packages/pandas/core/indexes/multi.py", line 2940, in get_loc
raise KeyError(key) from err
KeyError: ('r', 'a', 'step')
The code which I used to produce these errors is as follows:
client = Client()
# Get data about all of the runs which fit our filters
my_runs = client.get_runs(['/rand_nums', 'completed', 'v1'], metadata=True, tags=True)
# Save the name of the first run in the list
run_name = my_runs[0]['name']
# Plot a line graph of the averages.mean metric
mean_plot = client.plot_metrics(run_name, 'averages.mean', 'step')
The averages.mean metric is a 300 long array of floats between values of 0 and 10. To recreate my run, you can use the following code:
import random
import time
import numpy
from simvue import Run
if __name__ == "__main__":
with Run() as run:
# Create a variable to store the number of runs
num_iterations = 300
# Initialise the run
run.init(name='random-numbers-%d' % time.time(),
description='Monitoring of the generation of random integers between 0 and 10.',
tags=['random-numbers', 'v1'],
folder='/rand_nums',
metadata={
'number_of_iterations': num_iterations,
'result_converged': False
})
# Initialise an empty array which expects integers to store the random numbers
all_numbers = numpy.array([], dtype=numpy.int64)
# Generate 10 random numbers, one per second
for count in range(0, num_iterations):
random_number = random.randint(0, 10)
all_numbers = numpy.append(all_numbers, random_number)
mean = float(numpy.average(all_numbers))
median = int(numpy.median(all_numbers))
mode = int(numpy.bincount(all_numbers).argmax())
# Log the metrics, so that they can be seen in the Simvue UI in real time
run.log_metrics({'random_number': random_number}, step=count)
run.log_metrics({
'averages.mean': mean,
'averages.median': median,
'averages.mode': mode
}, step=count)
time.sleep(1)
# Store the array of random numbers as artifact
run.save(all_numbers, 'output', name='all_random_numbers')
# Update metadata and tags once the run is completed
run.update_metadata({'mean': mean})
if 4.9 < mean < 5.1:
run.update_metadata({'result_converged': True})
run.update_tags(['completed'])
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in progressWork is being done to resolve this issueWork is being done to resolve this issue