Using Archives to Store ModelsΒΆ
All the models listed on the Models page can be stored as and loaded from archives, simply by setting the location property to any supported archive format file.
Currently we support tar and zip formats of archives which can be paired with gzip, lzma and bzip2 compression.
archive.py
import asyncio
from dffml import Model, Features, Feature, train
async def main():
# Load the model using the entrypoint listed on the model plugins page
SLRModel = Model.load("slr")
# Configure the model
model = SLRModel(
features=Features(Feature("Years", int, 1)),
predict=Feature("Salary", int, 1),
# You can set this as any archive format like zip, tgz, etc.
location="slr-model.tar.gz",
)
# Train the model
await train(
model,
{"Years": 0, "Expertise": 1, "Trust": 0.1, "Salary": 10},
{"Years": 1, "Expertise": 3, "Trust": 0.2, "Salary": 20},
)
if __name__ == "__main__":
asyncio.run(main())
$ python archive.py