Taking Snapshots of your Training Data

If you need to store snapshots of your model's training data for later reference, this example is for you.

1. Set K/V Metadata Attribute on the Collection

import pyrasgo
rasgo = pyrasgo.connect(api_key)

#set a k/v pair on the collection
my_collection = rasgo.get.collection(id)
my_collection.add_attributes([ {"backup":"3"} ])

The integer value you provide for key "backup" indicates the number of snapshots you would like Rasgo to preserve of your training data. These snapshots operate in a FIFO queue, meaning that the oldest snapshot will be deleted when a new snapshot is created if you are over your integer value.

2. Trigger a Snapshot via Generate Training Data

#re-generate your training data for the collection
my_collection.generate_training_data()

If the 'backup' key is set on your collection, then a new snapshot will be created each time you generate training data for that collection. Generating training data can also be done in the UI.

3. Read Snapshot Data

snapshots = rasgo.get.snapshots(<collection_id>)
df = rasgo.read.snapshot_data(<collection_id>, <snapshot_index>)

Last updated