ASReview的超参数优化扩展

asreview-hyperopt的Python项目详细描述


ASReview hyperopt公司

Deploy and releaseBuild status

的超参数优化扩展 ASReview。它使用 hyperopt包快速优化参数 不同型号的。超参数及其采样空间在 ASReview包,以及 自动用于超参数优化。在

安装

安装超参数优化包的最简单方法是使用命令行:

pip install asreview-hyperopt

安装可视化软件包后,asreview应该自动检测到它。 测试方法:

^{pr2}$

它应该列出三个新的入口点:hyper-activehyper-passive和{}。在

基本用法

三个入口点的使用方式大致相似。它们之间的主要区别是 必须提供的型号类型:

  • 超级群集:功能提取
  • 超被动:模型,平衡策略,特征提取
  • 超主动:模型,平衡策略,查询策略,特征提取

要获取入口点的帮助,请键入:

asreview hyper-active --help

这将产生以下选项:

usage: hyper-active [-h][-n N_ITER][-r N_RUN][-d DATASETS][--mpi][--data_dir DATA_DIR][--output_dir OUTPUT_DIR][--server_job][-m MODEL][-q QUERY_STRATEGY][-b BALANCE_STRATEGY][-e FEATURE_EXTRACTION]

optional arguments:
  -h, --help            show this help message and exit
  -n N_ITER, --n_iter N_ITER
                        Number of iterations of Bayesian Optimization.
  -r N_RUN, --n_run N_RUN
                        Number of runs per dataset.
  -d DATASETS, --datasets DATASETS
                        Datasets to use in the hyper parameter optimization
                        Separate by commas to use multiple at the same time[default: all].
  --mpi                 Use the mpi implementation.
  --data_dir DATA_DIR   Base directory with data files.
  --output_dir OUTPUT_DIR
                        Output directory for trials.
  --server_job          Run job on the server. It will incur less overhead of
                        used CPUs, but more latency of workers waiting for the
                        server to finish its own job. Only makes sense in
                        combination with the flag --mpi.
  -m MODEL, --model MODEL
                        Prediction model for active learning.
  -q QUERY_STRATEGY, --query_strategy QUERY_STRATEGY
                        Query strategy for active learning.
  -b BALANCE_STRATEGY, --balance_strategy BALANCE_STRATEGY
                        Balance strategy for active learning.
  -e FEATURE_EXTRACTION, --feature_extraction FEATURE_EXTRACTION
                        Feature extraction method.

数据结构

默认情况下,扩展将在data目录中搜索相对于当前 工作目录。或者将数据集放在那里,或者指定and data directory。在

{cd5>的输出默认存储在cd5>的相对输出中 当前路径。在

已创建的结构示例:

output/
├── active_learning
│   ├── nb_max_double_tfidf
│   │   └── depression_hall_ace_ptsd_nagtegaal
│   │       ├── best
│   │       │   ├── ace
│   │       │   ├── depression
│   │       │   ├── hall
│   │       │   ├── nagtegaal
│   │       │   └── ptsd
│   │       ├── current
│   │       │   ├── ace
│   │       │   ├── depression
│   │       │   ├── hall
│   │       │   ├── nagtegaal
│   │       │   └── ptsd
│   │       └── trials.pkl
│   └── nb_max_random_double_tfidf
│       └── nagtegaal
│           ├── best
│           │   └── nagtegaal
│           ├── current
│           │   └── nagtegaal
│           └── trials.pkl
├── cluster
│   └── doc2vec
│       ├── ace
│       │   ├── best
│       │   │   └── ace
│       │   ├── current
│       │   │   └── ace
│       │   └── trials.pkl
│       ├── depression_hall_ace_ptsd_nagtegaal
│       │   └── current
│       │       ├── ace
│       │       ├── depression
│       │       ├── hall
│       │       ├── nagtegaal
│       │       └── ptsd
│       └── nagtegaal
│           └── current
│               └── nagtegaal
└── passive
    └── nb_double_tfidf
        └── depression
            ├── best
            │   └── depression
            ├── current
            │   └── depression
            └── trials.pkl

名为trials.pkl的文件是特殊文件,其中包含运行试验的数据。在

要列出这些试验,请使用以下命令:

asreview show $SOME_DIRECTORY/trials.pkl

它应该给出一份按损失排序的试验清单(越低越好)。列名(分开 从损失)前缀的参数是:

  • mdl:模型参数
  • bal:平衡策略参数
  • qry:查询策略参数
  • fex:特征提取参数

选项

默认的迭代次数是1,您可能需要增加。这取决于 需要优化的超参数数量,但可能需要几百次迭代 对大多数组合的一个很好的估计,可以合理地接近最优值。在所有情况下, 使用良好的常识;如果损失仍在快速下降,请多做几次迭代。在

hyperopt扩展具有对MPI的内置支持。MPI用于运行的并行化。打开 安装了MPI实现(如OpenMPI)的本地PC可以运行4个内核:

mpirun -n 4 asreview hyper-active --mpi

如果您想在具有低核心数的计算机上稍微提高效率,可以运行 MPI服务器上的作业也:

mpirun -n 4 asreview hyper-active --mpi --server_job

在超级计算机上,有时应该将mpirun替换为srun。在

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

推荐PyPI第三方库


热门话题
来自偏移量的java JavaPairInputStream流   gzip Java TarInputStream读取tar的文件名。包含另一个tar的gz文件。gz文件   如何在Linux shell脚本中确定和使用实际的java路径   java请求太多FirebaseError   java错误json解析   java在localserver上发送安卓应用程序的输出   JavaSpring:启动和停止webapplication时更新DBtable条目   java如何使用JavaFX在矩形处设置文本?   java SQL查询在Hibernate中出现异常   java我无法使用javamail代码通过outlook(hotmail帐户)配置发送邮件,但在gmail中工作正常   java是不同的持久性。测试运行/JPA装置的xml属性   无头Eclipse的java导出战   使用ContentVersionStrategy的java Spring引导缓存禁止使用gzip进行资源压缩   java如何获取计算机的设备令牌?   图像文件的java ImageInfo不包含有效值   继承强制在Java中使用基类方法