Skip to content

Commit cc241f5

Browse files
authored
feat: Add endlines in machine_learning/adaline_learning.c (#846)
Add endlines in `machine_learning/adaline_learning.c`. Co-authored-by: David Leal <[email protected]>
1 parent 1b30b89 commit cc241f5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

machine_learning/adaline_learning.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -240,20 +240,20 @@ void test1(double eta)
240240
}
241241

242242
printf("------- Test 1 -------\n");
243-
printf("Model before fit: %s", adaline_get_weights_str(&ada));
243+
printf("Model before fit: %s\n", adaline_get_weights_str(&ada));
244244

245245
adaline_fit(&ada, X, Y, N);
246246
printf("Model after fit: %s\n", adaline_get_weights_str(&ada));
247247

248248
double test_x[] = {5, -3};
249249
int pred = adaline_predict(&ada, test_x, NULL);
250-
printf("Predict for x=(5,-3): % d", pred);
250+
printf("Predict for x=(5,-3): % d\n", pred);
251251
assert(pred == -1);
252252
printf(" ...passed\n");
253253

254254
double test_x2[] = {5, 8};
255255
pred = adaline_predict(&ada, test_x2, NULL);
256-
printf("Predict for x=(5, 8): % d", pred);
256+
printf("Predict for x=(5, 8): % d\n", pred);
257257
assert(pred == 1);
258258
printf(" ...passed\n");
259259

@@ -294,7 +294,7 @@ void test2(double eta)
294294
}
295295

296296
printf("------- Test 2 -------\n");
297-
printf("Model before fit: %s", adaline_get_weights_str(&ada));
297+
printf("Model before fit: %s\n", adaline_get_weights_str(&ada));
298298

299299
adaline_fit(&ada, X, Y, N);
300300
printf("Model after fit: %s\n", adaline_get_weights_str(&ada));
@@ -309,7 +309,7 @@ void test2(double eta)
309309
test_x[0] = x0;
310310
test_x[1] = x1;
311311
int pred = adaline_predict(&ada, test_x, NULL);
312-
printf("Predict for x=(% 3.2f,% 3.2f): % d", x0, x1, pred);
312+
printf("Predict for x=(% 3.2f,% 3.2f): % d\n", x0, x1, pred);
313313

314314
int expected_val = (x0 + 3. * x1) > -1 ? 1 : -1;
315315
assert(pred == expected_val);
@@ -362,7 +362,7 @@ void test3(double eta)
362362
}
363363

364364
printf("------- Test 3 -------\n");
365-
printf("Model before fit: %s", adaline_get_weights_str(&ada));
365+
printf("Model before fit: %s\n", adaline_get_weights_str(&ada));
366366

367367
adaline_fit(&ada, X, Y, N);
368368
printf("Model after fit: %s\n", adaline_get_weights_str(&ada));
@@ -381,7 +381,7 @@ void test3(double eta)
381381
test_x[4] = x1 * x1;
382382
test_x[5] = x2 * x2;
383383
int pred = adaline_predict(&ada, test_x, NULL);
384-
printf("Predict for x=(% 3.2f,% 3.2f): % d", x0, x1, pred);
384+
printf("Predict for x=(% 3.2f,% 3.2f): % d\n", x0, x1, pred);
385385

386386
int expected_val = (x0 * x0 + x1 * x1 + x2 * x2) <= 1 ? 1 : -1;
387387
assert(pred == expected_val);

0 commit comments

Comments
 (0)