层的线性堆叠是否等于多元线性回归?

Is a linear stack of layers equal to multilinear regression?

因此,对于我正在制作的应用程序,我正在使用 tf.keras.models.Sequential。我知道机器学习有线性和多元线性回归模型。在 Whosebug 上的 the documentation of Sequential is said that the model is a linear stack of layers. Is that equal to multilinear regression? The only explaination of linear stack of layers I could find was 个问题中。

def trainModel(bow,unitlabels,units):
    x_train = np.array(bow)
    print("X_train: ", x_train)
    y_train = np.array(unitlabels)
    print("Y_train: ", y_train)
    model = tf.keras.models.Sequential([
            tf.keras.layers.Dense(256, activation=tf.nn.relu),
            tf.keras.layers.Dropout(0.2),
            tf.keras.layers.Dense(len(units), activation=tf.nn.softmax)])
    model.compile(optimizer='adam',
                         loss='sparse_categorical_crossentropy',
                         metrics=['accuracy'])
    model.fit(x_train, y_train, epochs=50)
    return model

你在这里混淆了两件非常重要的事情。一个是模型,一个是模型的模型

  • 模型的模型确实是线性的,因为它从头到尾都遵循一条直线(straightforward)。

  • 模型本身是非线性的:relu 激活是为了确保解不是线性的。

线性堆栈既不是线性回归也不是多线性回归。线性堆栈在这里不是 ML 术语,而是直截了当的英语术语。 如果我在任何方面误解了这个问题,请告诉我。

In the documentation of Sequential is said that the model is a linear stack of layers. Is that equal to multilinear regression?

假设你的意思是多变量回归,不。

tf.keras.models.Sequential() 定义模型中各层的连接方式,特别是在这种情况下,这意味着它们是完全连接的(第一层的每个输出都作为输入连接到下一层的每个神经元层)。线性一词用于表示没有有趣的事情在进行,例如循环(连接可以向后)或剩余连接(连接可以跳过层)。

对于上下文,具有多个变量的回归与具有具有多个输入且没有传递函数的单个神经元的单层网络相当。