计算Pareto(非指定)集,即skyline操作符/查询。

paretoset的Python项目详细描述


帕累托集

计算Pareto(非支配)集,即skyline操作符/查询。在

优化多变量函数有两种常用方法:

  • ^{str1}$Scalarization通过加权和组合目标:这将给出一个线性排序,single一个最小值。在
  • Pareto集包含有效的(非支配的)解:这给出了一个偏序,一组最小值。在

标量化的缺点是目标必须事先加权。 Pareto集包含所有可以通过标量化获得的值,但也包含可能无法通过标量化找到的值。在

示例-用于数据分析和洞察的Skyline查询

便宜且靠近海滩的酒店

在数据库上下文中,Pareto集称为skyline,计算Pareto集称为skyline query。 下面的例子来自Börzsönyi等人的论文“The Skyline Operator

Suppose you are going on holiday and you are looking for a hotel that is cheap and close to the beach. These two goals are complementary as the hotels near the beach tend to be more expensive. The database system is unable to decide which hotel is best for you, but it can at least present you all interesting hotels. Interesting are all hotels that are not worse than any other hotel in both dimensions. You can now make your final decision, weighing your personal preferences for price and distance to the beach.

下面是一个显示帕累托集合中的酒店的示例。在

fromparetosetimportparetosetimportpandasaspdhotels=pd.DataFrame({"price":[50,53,62,87,83,39,60,44],"distance_to_beach":[13,21,19,13,5,22,22,25]})mask=paretoset(hotels,sense=["min","min"])paretoset_hotels=hotels[mask]

优秀销售人员

假设您希望查询数据库中可能有资格加薪的销售人员。 要找到每个部门的最佳员工(薪水低,但销售额高):

^{pr2}$

多目标优化问题的Pareto有效解

假设您希望查询数据库中可能有资格加薪的销售人员。 要找到每个部门的最佳员工(薪水低,但销售额高):

fromparetosetimportparetosetimportnumpyasnpfromcollectionsimportnamedtuple# Create Solution objects holding the problem solution and objective valuesSolution=namedtuple("Solution",["solution","obj_value"])solutions=[Solution(solution=object,obj_value=np.random.randn(2))for_inrange(999)]# Create an array of shape (solutions, objectives) and compute the non-dominated setobjective_values_array=np.vstack([s.obj_valueforsinsolutions])mask=paretoset(objective_values_array,sense=["min","max"])# Filter the list of solutions, keeping only the non-dominated solutionsefficient_solutions=[solutionfor(solution,m)inzip(solutions,mask)ifm]

安装

该软件可通过GitHub和PyPI获得。 您可以使用pip安装软件。在

pip install paretoset

贡献

如果您有建议和改进,欢迎您仔细检查代码并提出请求。 您提交的代码必须符合PEP8,并且所有测试都必须通过。在

性能

下图显示了计算Pareto集所需的时间。 高斯数据在Pareto集中只有少数观测值,而单纯形上的均匀分布数据具有Pareto集中的所有观测值。在

参考文献

  • Börzsönyi等人的“The Skyline Operator”在数据库上下文中引入了Skyline操作符。在

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

推荐PyPI第三方库


热门话题
创建一个bash别名来编译任何文件。当前目录中的java程序   java JSoup逐个标记解析HTML   java Jdk更新121 URLClassloader更改   为什么使用Instant将1582之前的Java日期转换为LocalDate会给出不同的日期?   java JPA有没有一种方法可以从<table>groupby<field>   批处理文件Java关于运行时的混淆。memory()与Windows的物理内存使用历史记录图   Neo4j 2.1.7,用于使用Neo4j的Java API进行社交网络分析   java文件。太慢了!   java解析Joptionpane中的多个int   导入我可以删除任何隐式导入的Java库吗?   java如何使用数组在内部存储不同的数据类型   java通过curl命令发送POST请求   java使所有数组元素相等的最小递增操作数   java FocusPanel事件仅在边缘上?