当前位置: 首页 > news >正文

asp技校网站优化教程网

asp技校网站,优化教程网,公司网站首页制作教程,做网站优化公司报价# 获取训练目标值,计算Pareto前沿(非支配解集合),然后从样本中提取出Pareto最优解。train_obj self.samples[1]pareto_mask is_non_dominated(train_obj)pareto_y train_obj[pareto_mask] 源码 这里用到了一个函数 is_non_dom…
        # 获取训练目标值,计算Pareto前沿(非支配解集合),然后从样本中提取出Pareto最优解。train_obj = self.samples[1]pareto_mask = is_non_dominated(train_obj)pareto_y = train_obj[pareto_mask]

源码

这里用到了一个函数 is_non_dominated(),来看下该函数的源码:

from __future__ import annotationsimport torch
from torch import Tensordef is_non_dominated(Y: Tensor, deduplicate: bool = True) -> Tensor:r"""Computes the non-dominated front.Note: this assumes maximization.Args:输入:张量 Y,其维度为 (batch_shape) x n x m,这里 n 代表样本数量,m 代表每个样本的目标数量。,其中括号括住的batch_shape意思是可选,可以有这个维度或者没有Y: A `(batch_shape) x n x m`-dim tensor of outcomes.deduplicate: A boolean indicating whether to only return unique points on the pareto frontier.Returns:返回:布尔张量,指示每个样本是否是非支配点A `(batch_shape) x n`-dim boolean tensor indicating whether each point is non-dominated."""Y1 = Y.unsqueeze(-3)Y2 = Y.unsqueeze(-2)dominates = (Y1 >= Y2).all(dim=-1) & (Y1 > Y2).any(dim=-1)nd_mask = ~(dominates.any(dim=-1))if deduplicate:# remove duplicates# find index of first occurrence of each unique elementindices = (Y1 == Y2).all(dim=-1).long().argmax(dim=-1)keep = torch.zeros_like(nd_mask)keep.scatter_(dim=-1, index=indices, value=1.0)return nd_mask & keepreturn nd_mask

示例:

有一组解,每个解有两个目标值,找出这组解中的非支配解:

import torch
from botorch.utils.multi_objective import is_non_dominated# 假设有5个解,每个解有2个目标
Y = torch.tensor([[0.5, 0.7],[0.6, 0.6],[0.8, 0.3],[0.4, 0.9],[0.7, 0.5]
])# 调用 is_non_dominated 函数
non_dominated_mask = is_non_dominated(Y)# 打印非支配解
print("Non-dominated solutions:", Y[non_dominated_mask])

实例:

这里就是先拿到所有的目标值,然后计算哪些是Pareto(True或者False),最后再原始数据中选出所有True的数据

        # 获取训练目标值,计算Pareto前沿(非支配解集合),然后从样本中提取出Pareto最优解。train_obj = self.samples[1]pareto_mask = is_non_dominated(train_obj)pareto_y = train_obj[pareto_mask]

http://www.tj-hxxt.cn/news/119542.html

相关文章:

  • 未来做哪些网站能致富推荐几个靠谱的网站
  • 怎么自己做导购网站免费的网站软件
  • 博彩网站开发违法吗百度提问在线回答问题
  • 做网站好公司有哪些北京seo薪资
  • 英国小子做房产网站珠海网络推广公司
  • 建设网站的优点跟缺点国际财经新闻
  • wordpress 主题 love谷歌seo代运营
  • 做网站需要服务器google免费入口
  • 宝鸡公司做网站拉新项目官方一手平台
  • wordpress无法进入登录页面天津优化公司哪家好
  • 建湖做网站哪家好西安seo建站
  • 某网站安全建设方案关键词收录
  • 洛阳市建设监理协会网站拓客最有效方案
  • 网站后台是怎么做出来的seo的培训班
  • 公司网站做推广支出分录seo搜索引擎优化就业指导
  • 外贸商城网站制作公司谷歌外贸
  • 4s店网站建设一个产品的网络营销方案
  • 微站和网站数据路由器优化大师
  • 如何做好电商网站软文推广发布
  • 石家庄网站制作找谁网络推广渠道都有哪些
  • 专业做公司网站北京网络推广公司wyhseo
  • 网络规划设计师有什么用seo广告投放
  • 目前做网站需要什么cms常用的网络推广方法
  • 通过门户网站做单点登录SAP百度推广助手app下载
  • 做微商有哪些网站可以免费宣传在什么网站可以免费
  • 厦门网站建设推广市场调研报告500字
  • 软件技术ui设计专业怎么样惠州搜索引擎seo
  • 做动效网站百度一下点击搜索
  • 网站正在建设中av亚洲seo技术交流
  • 现工作室专做网站建设等应用程序项目,但工作室名暂为厦门seo屈兴东