mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-04-14 19:00:15 +08:00
define activation function
This commit is contained in:
@@ -85,7 +85,7 @@ class adaline {
|
||||
// for (int i = 0; i < x.size(); i++) y += x[i] * weights[i];
|
||||
y = std::inner_product(x.begin(), x.end(), weights.begin(), y);
|
||||
|
||||
return y >= 0 ? 1 : -1; // quantizer: apply ADALINE threshold function
|
||||
return activation(y); // quantizer: apply ADALINE threshold function
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,6 +150,8 @@ class adaline {
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
friend int activation(double x) { return x > 0 ? 1 : -1; }
|
||||
|
||||
private:
|
||||
/**
|
||||
* convenient function to check if input feature vector size matches the
|
||||
|
||||
Reference in New Issue
Block a user