当前位置:首页 > 编程笔记 > 正文
已解决

【函数讲解】botorch中的函数 NondominatedPartitioning()

来自网友在路上 157857提问 提问时间:2023-11-12 14:59:39阅读次数: 57

最佳答案 问答题库578位专家为你答疑解惑

基本介绍: 

这个函数的主要作用是将目标空间中的非支配点集分割成多个矩形区域。这种分割对于计算和优化超体积(Hypervolume)这一关键指标至关重要

函数的应用

在 BoTorch 的贝叶斯优化框架中,NondominatedPartitioning 通常与期望超体积改进(Expected Hypervolume Improvement, EHVI)等采集函数一起使用。EHVI 采集函数通过评估候选解对当前超体积的潜在改进来指导搜索过程。NondominatedPartitioning 提供了计算这种改进所需的空间划分。

参数:

  • ref_point:A `m`-dim tensor containing the reference point.【参考点(反映最差可接受的目标值)】
  • Y: A `(batch_shape) x n x m`-dim tensor.【当前的非支配解集】
  • alpha: A thresold fraction of total volume used in an approximate decomposition.

初始化源码:

    def __init__(self,ref_point: Tensor,Y: Optional[Tensor] = None,alpha: float = 0.0,) -> None:"""Initialize NondominatedPartitioning.Args:ref_point: A `m`-dim tensor containing the reference point.Y: A `(batch_shape) x n x m`-dim tensor.alpha: A thresold fraction of total volume used in an approximate decomposition."""self.alpha = alphasuper().__init__(ref_point=ref_point, sort=True, Y=Y)

示例:

来源于:https://github.com/aoiang/LaMOO/blob/a78c86bce1a9405894e7e0e9be1e352132db86f4/LaMOO/Classifier.py#L462

优化 qEHVI 采集函数,然后返回一个新的候选+观察值 

NondominatedPartitioning(划分支配空间为不相交的矩形)--> qExpectedHypervolumeImprovement(定义qEHVI 采集函数)--> optimize_acqf(优化 qEHVI)

        sampler = SobolQMCNormalSampler(num_samples=128)def optimize_qehvi_and_get_observation(model, train_obj, sampler, path):"""Optimizes the qEHVI acquisition function, and returns a new candidate and observation."""# 将非支配空间划分为不相交的矩形partitioning = NondominatedPartitioning(ref_point=func.ref_point, Y=train_obj)# 定义qEHVI acquisition functionacq_func = qExpectedHypervolumeImprovement(model=model,ref_point=func.ref_point.tolist(),  # use known reference pointpartitioning=partitioning,sampler=sampler,)# optimize qEHVIcandidates, _ = optimize_acqf(acq_function=acq_func,bounds=standard_bounds,q=BATCH_SIZE,num_restarts=20,raw_samples=186,  # used for intialization heuristicoptions={"batch_limit": 5, "maxiter": 48, "nonnegative": True},sequential=True,problem=func,lamcts_boundry=path,cur_iter=cur_iter,)new_x = candidates.detach()new_obj = func(new_x)return new_x, new_obj

查看全文

99%的人还看了

猜你感兴趣

版权申明

本文"【函数讲解】botorch中的函数 NondominatedPartitioning()":http://eshow365.cn/6-38146-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!