简体   繁体   English

Scikit 优化和离散变量

[英]Scikit optimize and discrete variables

scikit-optimize has two classes for definind the variable type: Integer and Categorical. scikit-optimize有两个类用于定义变量类型:Integer 和 Categorical。 The issue is that integer space class handles only true integers, while categorical class does not interpret the values as numbers (does not define distance betwee points - as per ducumentation).问题是 integer 空间 class 只处理真正的整数,而分类 class 不将值解释为数字(不定义点之间的距离 - 根据数据)。

Is there a way to define a variable as a list of discrete values, like for example [1, 2, 4, 6, 8, 10, 20, 30, 40]?有没有办法将变量定义为离散值列表,例如 [1, 2, 4, 6, 8, 10, 20, 30, 40]?

skopt.space.Space offers three types that a search space dimension can take: Real , Integer or Categorical . skopt.space.Space提供了搜索空间维度可以采用的三种类型: RealIntegerCategorical

You can define a 3D space that contains only integer dimensions the following way:您可以通过以下方式定义仅包含 integer 尺寸的 3D 空间:

from skopt.space import Space, Integer
space = Space(Integer(1, 2, 4), Integer(2, 4, 6))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM