Home > other >  How to get fixed result from Extreme Learning Machine after each run
How to get fixed result from Extreme Learning Machine after each run

Time:01-12

I am using this GitHub package https://github.com/5663015/elm/blob/master/elm.py for Extreme Learning Machine models. I run the following code on my dataset.

# 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)

In the dataset, the target variable is rainfall, and the predictor is lag1 of the rainfall data. The data is time series and I put shafle=False. I used 70% of data for training the model and 30% of data as a test set. The model is working and I can get predictions. However, each time that I run the model, I get different prediction values and RMSE (for evaluating the model performance). Could you please let me know if this is common with ELM models? and is there any way to get fixed predictions and RMSE each time after running the model?

CodePudding user response:

Each time you train the model, a different random seed is chosen. As a result, the initialization changes and, thus, the optimization behaves differently.

To fix the random seed with numpy set np.random.seed(...) (docs).

  • Related