【问题标题】:How to get fixed result from Extreme Learning Machine after each run每次运行后如何从极限学习机获得固定结果
【发布时间】:2023-01-10 14:36:33
【问题描述】:

我将这个 GitHub 包 https://github.com/5663015/elm/blob/master/elm.py 用于极限学习机模型。我在我的数据集上运行以下代码。

# Create target series and data splits
y = df['rain'].copy()
X= df[['lag1']]
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=200, shuffle=False)
# model
model = ELM(hid_num=10).fit(X_train, y_train)
# predictions
prediction = model.predict(X_test)

在数据集中,目标变量是降雨量,预测变量是降雨量数据的lag1。数据是时间序列,我设置了 shafle=False。我使用 70% 的数据来训练模型,30% 的数据作为测试集。 该模型正在运行,我可以获得预测。但是,每次运行模型时,我都会得到不同的预测值和 RMSE(用于评估模型性能)。您能否告诉我这是否与 ELM 模型很常见,每次在数据集上运行模型并获得不同的预测和 RMSE?每次运行模型后,有什么办法可以得到固定的预测和RMSE?

【问题讨论】:

    标签: python numpy machine-learning elm


    【解决方案1】:

    您需要将 random_state 参数添加到您的函数中;

    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=200, shuffle=False, random_state=1)
    

    这应该工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-11-18
      • 2017-04-11
      • 2021-10-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多