from ConfigSpace.configuration_space import ConfigurationSpace
from ConfigSpace.hyperparameters import CategoricalHyperparameter, \
UniformIntegerHyperparameter, UniformFloatHyperparameter
import sklearn.metrics
import autosklearn.classification
import autosklearn.pipeline.components.classification
from autosklearn.pipeline.components.base \
import AutoSklearnClassificationAlgorithm
from autosklearn.pipeline.constants import DENSE, SIGNED_DATA, UNSIGNED_DATA, \
PREDICTIONS
# Create MLP classifier component for auto-sklearn.
class MLPClassifier(AutoSklearnClassificationAlgorithm):
def __init__(self,
hidden_layer_depth,
num_nodes_per_layer,
activation,
alpha,
solver,
random_state=None,
):
# 神经网络的隐藏层的深度
self.hidden_layer_depth = hidden_layer_depth
# 每一层的节点数
self.num_nodes_per_layer = num_nodes_per_layer
# 激活函数
self.activation = activation
# 学习率
self.alpha = alpha
# 优化器
self.solver = solver
# 随机种子
self.random_state = random_state
def fit(self, X, y):
self.num_nodes_per_layer = int(sel
python-autosklearn-MLPClassifier
最新推荐文章于 2023-01-07 08:52:53 发布