You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 11, 2026. It is now read-only.
Copy file name to clipboardExpand all lines: docs/ml/logregress.md
+90-1Lines changed: 90 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,4 +48,93 @@ When you have the final values from your derivative calculation, you can use it
48
48
49
49
## The code
50
50
51
-
Coming soon
51
+
The data used here is the [Breast Cancer Wisconsin (Diagnostic) Data Set](https://www.kaggle.com/datasets/uciml/breast-cancer-wisconsin-data) which has bee modified to look like [this](https://gitlab.com/adwaithrajesh/linear-ml-test/-/blob/main/data/bcancer.csv), where we
52
+
don't have id's and M=0, and B=1
53
+
54
+
```c
55
+
#defineINCLUDE_MAT_CONVERSIONS
56
+
#include"ds/mat.h"
57
+
#include"ml/logisticregress.h"
58
+
#include"model/metrics.h"
59
+
#include"model/train_test_split.h"
60
+
#include"parsers/csv.h"
61
+
62
+
intmain(void) {
63
+
CSV *csv_reader = csv_init(569, 31, ',');
64
+
csv_parse(csv_reader, "data/bcancer.csv");
65
+
66
+
Mat *X = csv_get_mat_slice(csv_reader, (Slice){1, 31});
67
+
Mat *Y = csv_get_mat_slice(csv_reader, (Slice){0, 1});
68
+
Mat *X_train, *X_test, *Y_train, *Y_test;
69
+
70
+
train_test_split(X, Y, &X_train, &X_test, &Y_train, &Y_test, 0.3, 101);
0 commit comments