简体   繁体   English

带网格搜索的火车

[英]trains with grid search

I would like to test trains usage during grid search and it not clear how to do so.我想在网格搜索期间测试火车的使用情况,但不清楚如何这样做。

from trains import Task 
Task.init(project_name="project name", task_name='name')

creates an experiment in the demo server and logs all but you can't call init twice no matter the 'task_name' and在演示服务器中创建一个实验并记录所有内容,但无论“task_name”和

from trains import Task 
Task.create(project_name="project name", task_name='name')

can be called with different 'task_name' but thus not log any data into the server and creates only 'Draft'.可以使用不同的“task_name”调用,但不会将任何数据记录到服务器中,而只会创建“草稿”。

here is a sample code:这是一个示例代码:

 epochs=[160,300]
 for epoch in epochs:
    model = define_model_run(epoch)
    model.fit(x_train,y_train)
    score = model.score(...)

my final try was:我的最后一次尝试是:

 epochs=[160,300]
 task=Task.init(project_name="demo", task_name='search')
 for epoch in epochs:
    task.create(project_name="demo", task_name=f'search_{epoch}')
    model = define_model_run(epoch)
    model.fit(x_train,y_train)
    score = model.score(...)

which logs all information under the experiments tab and none under the 'Draft'.它记录了实验选项卡下的所有信息,而没有记录在“草稿”下。 I tried the last two hour the read the few documentations provided and reading the source code, but no luck.我尝试了最后两个小时阅读提供的一些文档并阅读源代码,但没有运气。

any help?有什么帮助吗?

Solved by looking on closed bugs in their GitHub repository: link通过查看其 GitHub 存储库中已关闭的错误来解决: 链接

 epochs=[160,300]
 for epoch in epochs:
    task=Task.init(project_name="demo", task_name=f'search_{epoch}')
    model = define_model_run(epoch)
    model.fit(x_train,y_train)
    score = model.score(...)
    task.close()

then each task is a different experiment in project "demo".那么每个任务都是“演示”项目中的不同实验。

Declaimer: I'm a member of TRAINS team声明:我是 TRAINS 团队的成员

Yes, that's exactly the answer.是的,这正是答案。 The idea is that you always have one main Task, in order to create a new one you need to close the running Task, and re-initialize with a new name.这个想法是你总是有一个主任务,为了创建一个新任务,你需要关闭正在运行的任务,并用一个新名称重新初始化。 Kudos on solving it so quickly :)如此迅速地解决它的荣誉:)

BTW: You can see examples here / and here , showing how to send accuracy logs so it is easier to compare the experiments, especially when running hyper-parameter search.顺便说一句:您可以在此处/ 此处查看示例,展示如何发送准确度日志,以便更轻松地比较实验,尤其是在运行超参数搜索时。

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

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