ASReview的超参数优化扩展
asreview-hyperopt的Python项目详细描述
ASReview hyperopt公司
的超参数优化扩展 ASReview。它使用 hyperopt包快速优化参数 不同型号的。超参数及其采样空间在 ASReview包,以及 自动用于超参数优化。在
安装
安装超参数优化包的最简单方法是使用命令行:
pip install asreview-hyperopt
安装可视化软件包后,asreview应该自动检测到它。 测试方法:
^{pr2}$它应该列出三个新的入口点:hyper-active
,hyper-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
。在
- 项目
标签: