Every experiment is sacredEvery experiment is greatIf an experiment is wastedGod gets quite irate
Sacred is a tool to help you configure, organize, log and reproduce experiments.It is designed to do all the tedious overhead work that you need to do aroundyour actual experiment in order to:
Sacred achieves this through the following main mechanisms:
Script to train an SVM on the iris dataset | The same script as a Sacred experiment |
from numpy.random import permutation
from sklearn import svm, datasets
C = 1.0
gamma = 0.7
iris = datasets.load_iris()
perm = permutation(iris.target.size)
iris.data = iris.data[perm]
iris.target = iris.target[perm]
clf = svm.SVC(C, 'rbf', gamma=gamma)
clf.fit(iris.data[:90],
iris.target[:90])
print(clf.score(iris.data[90:],
iris.target[90:]))
|
from numpy.random import permutation
from sklearn import svm, datasets
from sacred import Experiment
ex = Experiment('iris_rbf_svm')
@ex.config
def cfg():
C = 1.0
gamma = 0.7
@ex.automain
def run(C, gamma):
iris = datasets.load_iris()
per = permutation(iris.target.size)
iris.data = iris.data[per]
iris.target = iris.target[per]
clf = svm.SVC(C, 'rbf', gamma=gamma)
clf.fit(iris.data[:90],
iris.target[:90])
return clf.score(iris.data[90:],
iris.target[90:])
|
The documentation is hosted at ReadTheDocs.
You can directly install it from the Python Package Index with pip:
pip install sacred
Or if you want to do it manually you can checkout the current version from gitand install it yourself:
You might want to also install the numpy
and the pymongo
packages. They areoptional dependencies but they offer some cool features:
pip install numpy, pymongo
The tests for sacred use the pytest package.You can execute them by running pytest
in the sacred directory like this:
pytest
There is also a config file for tox so youcan automatically run the tests for various python versions like this:
tox
If you update or change the pytest version, the following files need to be changed:
dev-requirements.txt
tox.ini
test/test_utils.py
setup.py
If you find a bug, have a feature request or want to discuss something general you are welcome to open anissue. If you have a specific question relatedto the usage of sacred, please ask a question on StackOverflow under thepython-sacred tag. We value documentationa lot. If you find something that should be included in the documentation pleasedocument it or let us know whats missing. If you are using Sacred in one of your projects and want to shareyour code with others, put your repo in the Projects using Sacred <docs/projects_using_sacred.rst>_ list.Pull requests are highly welcome!
At this point there are three frontends to the database entries created by sacred (that I'm aware of).They are developed externally as separate projects.
Omniboard is a web dashboard that helps in visualizing the experiments and metrics / logs collected by sacred.Omniboard is written with React, Node.js, Express and Bootstrap.
Incense is a Python library to retrieve runs stored in a MongoDB and interactively display metrics and artifactsin Jupyter notebooks.
Sacredboard is a web-based dashboard interface to the sacred runs stored in aMongoDB.
Neptune is a web service that lets you visualize, organize and compare your experiment runs.Once things are logged to Neptune you can share it with others, add comments and even access objects viaexperiment API:
In order to log your runs to Neptune, all you need to do is add an observer:
from neptunecontrib.monitoring.sacred import NeptuneObserver
ex.observers.append(NeptuneObserver(api_token='YOUR_API_TOKEN',
project_name='USER_NAME/PROJECT_NAME'))
For more info, check the neptune-contrib library.
SacredBrowser is a PyQt4 application to browse the MongoDB entries created bysacred experiments.Features include custom queries, sorting of the results,access to the stored source-code, and many more.No installation is required and it can connect to a localdatabase or over the network.
Prophet is an early prototype of a webinterface to the MongoDB entries created bysacred experiments, that is discontinued.It requires you to run RestHeart to access the database.
Sumatra is a tool for managing and tracking projects based on numericalsimulation and/or analysis, with the aim of supporting reproducible research.It can be thought of as an automated electronic lab notebook forcomputational projects.
Sumatra takes a different approach by providing commandline tools to initializea project and then run arbitrary code (not just python).It tracks information about all runs in a SQL database and even provides a nice browser tool.It integrates less tightly with the code to be run, which makes it easilyapplicable to non-python experiments.But that also means it requires more setup for each experiment andconfiguration needs to be done using files.Use this project if you need to run non-python experiments, or are ok with the additional setup/configuration overhead.
FGLab is a machine learning dashboard, designed to make prototypingexperiments easier. Experiment details and results are sent to a database,which allows analytics to be performed after their completion. The serveris FGLab, and the clients are FGMachines.
Similar to Sumatra, FGLab is an external tool that can keep track of runs fromany program. Projects are configured via a JSON schema and the program needs toaccept these configurations via command-line options.FGLab also takes the role of a basic scheduler by distributing runs over severalmachines.
By tracing system calls during program execution CDE creates a snapshot ofall used files and libraries to guarantee the ability to reproduce any unixprogram execution. It only solves reproducibility, but it does so thoroughly.
This project is released under the terms of the MIT license.
Python Sacred是一个用于管理实验流程和参数配置的开源框架,它可以帮助研究人员更好地组织和记录机器学习实验 Sacred提供了一种轻量级的解决方案,以便更好地跟踪机器学习实验的运行情况、超参数配置以及模型结构等信息。使用Sacred可以使得研究人员更容易地重现他们的实验结果,并加速迭代过程中新想法的测试和实验。它还提供了许多特性,例如自动记录和可视化实验结果、
sacred库安装和使用说明 介绍Sacred+Ominiboard方案 主要参考SHEN’s BLOG Sacred的工具,用于记录实验的配置、组织、日志和复现 使用mongoDB管理后端数据,利用omniboard实现前端可视化: Sacred + MongoDB:实验记录和保存 Ominiboard:可视化管理 各部分库都安装最新的版本,具体如下: MongoDB 4.2.7 omniboa
介绍 Sacred是一个能够帮助你配置,组织,记录和重现实验的工具。它旨在完成我们需要围绕实验进行的所有繁琐的日常工作,以便: 持续跟进我们实验的所有参数 简单的进行不同设置的实验 将单次运行的实验配置信息保存到数据库中 重现我们的结果 Sacred实现这些通过下面的机制: ConfigScopes:函数中局部变量定义实验所用参数的一种非常方便的方法。 Config Injection:可以从每个
简略题意: R∗C 的庄稼地,有些地方已经种了庄稼了。现在需要放置一些稻草人,使得满足以下两个条件: 1 . 所有行都包含稻草人。 2 . 相邻的两列至少包含两个稻草人。 这题目前还没有 AC ,但是值得记录。 注意到行很少,因此可以状压进行 DP 。 令 dp[i][0/1][j] 代表,前i列的稻草人存放了那些行,当前列是否有稻草人。 用 ∗∗ 代表集合并卷积,那么转移有如下: 1.dp[i]
You can disable git with: sacred.Experiment(…, save_git_info=False) 卸载原有的sacred,重新进行pip install就可以了
请点击如下链接