【问题标题】:Inputs, ouputs layers sklearn python输入,输出层 sklearn python
【发布时间】:2018-04-11 21:40:20
【问题描述】:

我想我在这里遗漏了一些东西,但是来自 Sklearn 的 Mlp 回归器如何计算或定义输入和输出层中的神经元数量?

我在文档中找不到解释。

【问题讨论】:

    标签: python scikit-learn


    【解决方案1】:

    Sklean 在fit 方法中定义输入和输出形状。 事实上,sklearn 中的每个模型都是一个类,它实现了一个名为fit 的方法。

    下面是sklearn.neural_network.MLPRegressor 的代码:

    def fit(self, X, y):
        """Fit the model to data matrix X and target(s) y.
        Parameters
        ----------
        X : array-like or sparse matrix, shape (n_samples, n_features)
            The input data.
        y : array-like, shape (n_samples,) or (n_samples, n_outputs)
            The target values (class labels in classification, real numbers in
            regression).
        Returns
        -------
        self : returns a trained MLP model.
        """
        return self._fit(X, y, incremental=False)
    

    查看github 上的代码以了解更多信息如何协同工作。

    【讨论】:

      猜你喜欢
      • 2020-01-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-21
      • 2021-03-13
      • 2020-01-19
      相关资源
      最近更新 更多