整理你的机器学习实验

outfit的Python项目详细描述


:连衣裙:套装[WIP]

装备是一个轻量级的库,可以用简单的方式整理机器学习实验。

装备的想法是将你的参数、输出文件、分数和特征存储在你的Wardrobe中,以便能够根据给定的标准提出请求并找出哪些是你最好的实验。

如何安装设备?

pypi

pip install outfit

dev版本

git clone https://github.com/AdilZouitine/outfit
cd outfit
pip install -r requirements.txt
pip install -e .

服装是如何工作的?

  • tutorial 1:为cnn在mnist数据集上安装pytorch构建一个简单的模型管理管道Open In Colab
importdatetime# Here import all the libraries you need for your experimentfromoutfitimportWardrobe,getlogwardrobe=Wardrobe(db_path='foo/bar/mnist.db')exp={'experiment_name':'ResNet18','comment':'Use differential learning rate','date_experiment':datetime.datetime.now()}wardrobe.add_experiment(**exp)param={'dropout':0.20,'kernel_size':'3x3','conv_block_1_lr':0.01,'conv_block_2_lr':0.001}# Create the instance of your model here with your parameterswardrobe.add_dict_parameter(param)# Do your training phase here.output={'training log':'/result/training_log_resnet18.txt'}@getlog(filepath=output['training log'])deftrain_model(model,loaders,loss,lr_scheduler,n_epoch):...output.update({'tensorboard':'/result/event.tb','model':'diff_lr_resnet18.pth'})wardrobe.add_dict_output(output)score={'train acc':0.96,'train loss':0.430,'val acc':0.94,'val loss':0.460}wardrobe.add_dict_score(score)wardrobe.tidy()# commit your experiment in database
# If you want to get the best experiments forexpinwardrobe.get_best_scores(mode='max',on_score='val acc'):'''    Verbose is true by default and will print on the console     at each iteration the parameters, output file,     features and scores in a table format.    Also returns in dictionary the parameters, output file, features and scores.    '''...

输出

════════════════════
│ TOP 1 EXPERIMENT │
════════════════════



Table : Experiment 

╒════╤═════════════════╤═══════════════════╤════════════════════════════════╤════════════════════╕
│    │   id_experiment │ experiment_name   │ comment                        │ date_experiement   │
╞════╪═════════════════╪═══════════════════╪════════════════════════════════╪════════════════════╡
│  0 │               1 │ ResNet18          │ Use differential learning rate │                    │
╘════╧═════════════════╧═══════════════════╧════════════════════════════════╧════════════════════╛


Table : Parameter 

╒════╤════════════════╤══════════════════╤═════════════╤══════════════╕
│    │   id_parameter │ parameter_name   │ parameter   │   experiment │
╞════╪════════════════╪══════════════════╪═════════════╪══════════════╡
│  0 │              1 │ dropout          │ 0.2         │            1 │
├────┼────────────────┼──────────────────┼─────────────┼──────────────┤
│  1 │              2 │ kernel_size      │ 3x3         │            1 │
├────┼────────────────┼──────────────────┼─────────────┼──────────────┤
│  2 │              3 │ conv_block_1_lr  │ 0.01        │            1 │
├────┼────────────────┼──────────────────┼─────────────┼──────────────┤
│  3 │              4 │ conv_block_2_lr  │ 0.001       │            1 │
╘════╧════════════════╧══════════════════╧═════════════╧══════════════╛


Table : Output 

╒════╤═════════════╤═══════════════╤═══════════════════════════════════╤══════════════╕
│    │   id_output │ type_output   │ path_output                       │   experiment │
╞════╪═════════════╪═══════════════╪═══════════════════════════════════╪══════════════╡
│  0 │           1 │ training log  │ /result/training_log_resnet18.txt │            1 │
├────┼─────────────┼───────────────┼───────────────────────────────────┼──────────────┤
│  1 │           2 │ tensorboard   │ /result/event.tb                  │            1 │
├────┼─────────────┼───────────────┼───────────────────────────────────┼──────────────┤
│  2 │           3 │ model         │ diff_lr_resnet18.pth              │            1 │
╘════╧═════════════╧═══════════════╧═══════════════════════════════════╧══════════════╛


Table : Score 

╒════╤════════════╤══════════════╤═════════╤══════════════╕
│    │   id_score │ type_score   │   score │   experiment │
╞════╪════════════╪══════════════╪═════════╪══════════════╡
│  0 │          1 │ train acc    │    0.96 │            1 │
├────┼────────────┼──────────────┼─────────┼──────────────┤
│  1 │          2 │ train loss   │    0.43 │            1 │
├────┼────────────┼──────────────┼─────────┼──────────────┤
│  2 │          3 │ val acc      │    0.94 │            1 │
├────┼────────────┼──────────────┼─────────┼──────────────┤
│  3 │          4 │ val loss     │    0.46 │            1 │
╘════╧════════════╧══════════════╧═════════╧══════════════╛


Table : Feature 

其他解决方案:

mlflow&;dvc

这些解决方案很好,它们还提供了一个用户界面,比我的库有更多的选项,但是对于一个简单的用途,你只想组织你的实验和做一个简单的查询。 这两种解决方案似乎都过分了。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Springboot数据JPA findByDate()   java是否可以有多个顶级树节点?   javahibernatehql。子查询中的多个   使用Twilio验证java Keyclope电话号码   java重写对象的toString()表示返回意外的符号   java Android最多每15分钟调用一个方法,否则使用保存的数据   在java swing中突出显示jeditorpane中的一些单词   java将时间戳转换为UTC时区   由于main中存在ArrayIndexOutOfBoundsException,导致java编译错误   java如何通过requestscope获取对象内部对象的值?   java访问安卓代码内的网站并检索生成的图像   java这种日期格式的模式是什么?   java解析包含超链接的xml字符串