简体   繁体   English

如何使用TRAINS python auto-magical实验管理器手动注册sci-kit模型?

[英]How to manually register a sci-kit model with TRAINS python auto-magical experiment manager?

I'm working mostly with scikit-learn, as far as I understand, the TRAINS auto-magic doesn't catch scikit-learn model store/load automatically.我主要使用 scikit-learn,据我所知,TRAINS auto-magic 不会自动捕获 scikit-learn 模型存储/加载。

How do I manually register the model after I have 'pickled' it.我如何在“腌制”模型后手动注册模型。

For Example:例如:

import pickle
with open("model.pkl", "wb") as file:  
    pickle.dump(my_model, file)

Assuming you are referring to TRAINS experiment manager: https://github.com/allegroai/trains (which I'm one of the maintainers)假设您指的是 TRAINS 实验经理: https : //github.com/allegroai/trains (我是维护者之一)

from trains import Task, OutputModel
OutputModel(Task.current_task()).update_weights(weights_filename="model.pkl")

Or, if you have information you want to store together with the pickled model file, you can do:或者,如果您有想要与腌制模型文件一起存储的信息,您可以执行以下操作:

from trains import Task, OutputModel
model_parameters = {'threshold': 0.123}
OutputModel(Task.current_task(), config_dict=model_parameters).update_weights(weights_filename="model.pkl")

Now, you should see in the UI an output model registered with the experiment.现在,您应该在 UI 中看到一个在实验中注册的输出模型。 The model contains a link to the pickel file, together with the configuration dictionary.该模型包含指向pickel 文件的链接以及配置字典。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM