DNNPowerCurve

Deep Neural Network (DNN) based power curve estimation.

from dwse import DNNPowerCurve
model = DNNPowerCurve()
model.train(X_train, y_train)
predictions = model.predict(X_test)
rmse = model.calculate_rmse(X_test, y_test)
class dswe.dnn.DNNPowerCurve(feats_scale=12, train_all=False, n_folds=5, batch_size=64, lr=0.1, n_epochs=30, optimizer='sgd', loss_fn='l2_loss', momentum=0.8, print_log=False, save_fig=True)[source]
Parameters
  • feats_scale (int) – It multiplies the neurons count in each layer. Suppose, a DNN has four 4 hidden layers with default neurons count as [8, 16, 32, 64], after giving feats_scale=12, it increases the number of neurons to [8*12, 16*12, 32*12, 64*12], which is equal to [96, 192, 384, 768]. Default value is 12.

  • train_all (bool) – A boolean (True/False) to specify whether to train the model on the entire dataset or separate the dataset for cross-validation. Generally, it should be set to False to check how the model is performing on validation set. Once it’s verified that the model is converging and performing well then, set this to True to train it on the entire dataset. Default is set to False.

  • n_folds (int) – Number of folds for cross-validation. Default value is 5.

  • batch_size (int) – Number of training points sampled at each iteration of the model training. Default value is 64.

  • lr (float) – The step size or learning rate for the optimizer. Default value is 0.1.

  • n_epochs (int) – Number of epochs for training the model. Default value is 30.

  • optimizer (string) – A string specifying which optimization algorithm to be used to update model weights. The available optimizers are [‘sgd’, ‘adam’, ‘rmsprop’, ‘adagrad’]. Default is set to ‘sgd’.

  • loss_fn (string) – A string specifying which loss functions to be used to compute the errors. The common loss functions for continuous response variables are [‘l1_loss’, ‘l2_loss’]. Default is set to ‘l2_loss’.

  • momentum (float) – Momentum value for ‘sgd’ and ‘rmsprop’ optimizers. Default is set to 0.

  • print_loss (bool) – A boolean (True/False) to specify whether to print loss values after each epoch during training. Default is set to False.

  • save_fig (bool) – A boolean (True/False) to specify whether to plot and save loss values during training and validation. The plot(s) save in a pdf format. Default is set to True.

calculate_rmse(X_test, y_test)[source]
Parameters
  • X_test (np.ndarray or pd.DataFrame) – A matrix or dataframe of test input variable values to compute predictions.

  • y_test (np.array) – A numeric array for response values in the testing dataset.

Returns

A numeric Root Mean Square Error (RMSE) value calculated on the X_test.

Return type

float

predict(X_test)[source]
Parameters

X_test (np.ndarray or pd.DataFrame) – A matrix or dataframe of test input variable values to compute predictions.

Returns

A numeric array for predictions at the data points in X_test.

Return type

np.array

train(X_train, y_train)[source]
Parameters
  • X_train (np.ndarray or pd.DataFrame) – A matrix or dataframe of input variable values in the training dataset.

  • y_train (np.array) – A numeric array for response values in the training dataset.

Reference

Karami, Kehtarnavaz, and Rotea, 2021, “Probabilistic neural network to quantify uncertainty of wind power estimation,” arXiv:2106.04656.