mirror of
https://github.com/WallabyLester/RBF-aPID-Controller.git
synced 2026-05-20 11:01:41 +08:00
Implemented adaptation.
This commit is contained in:
@@ -63,3 +63,12 @@ double RBFModel::predict(const double* input) {
|
||||
return output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Adapt weights based on the error and learning rate.
|
||||
*/
|
||||
void RBFModel::adapt(double error, double learningRate, const double* input) {
|
||||
for (int i = 0; i < numCenters; ++i) {
|
||||
double influence = gaussian(input, centers[i]); // Calculate influence based on input
|
||||
weights[i] += learningRate * error * influence; // Update weight based on error and influence
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user