Skip to content

Commit fd11161

Browse files
fix(calculation): consider input alyer when calculating weights and bias count to display in tui
1 parent c7454e7 commit fd11161

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

try1 (OOP Approach)/cpp/src/classes.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,10 @@ namespace NeuralNet
140140
printInColor("| Neural Network |\n", "32");
141141
printInColor("+-----------------------------------------+\n", "32");
142142

143-
std::cout << "Layer Count : " << this->hidOutLayerCount << endl;
143+
std::cout << "Layer Count : " << this->hidOutLayerCount+1 << endl;
144144
printInColor("Layer Sizes: \n", "36"); // Cyan
145145

146+
std::cout << setw(4) << this->inputLayerSize << " | ";
146147
for (int i = 0; i < this->hidOutLayerCount; i++)
147148
{
148149
std::cout << setw(4) << this->hidOutLayerSizes[i]; // Formatting for better spacing
@@ -341,14 +342,13 @@ namespace NeuralNet
341342
void MLP::printParamsCount()
342343
{
343344
int weightsCount = this->inputLayerSize;
345+
int prevLayerNeuronsCount = this->inputLayerSize;
344346
int biasesCount = 0;
345347

346-
for (int i = 1; i < this->hidOutLayerCount; i++)
347-
{
348-
weightsCount += this->hidOutLayerSizes[i] * this->hidOutLayerSizes[i - 1];
349-
}
350348
for (int i = 0; i < this->hidOutLayerCount; i++)
351349
{
350+
weightsCount += this->hidOutLayerSizes[i] * prevLayerNeuronsCount;
351+
prevLayerNeuronsCount = this->hidOutLayerSizes[i];
352352
biasesCount += this->hidOutLayerSizes[i];
353353
}
354354
std::cout << "Weights Count : " << weightsCount << endl;

0 commit comments

Comments
 (0)