-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
127 lines (121 loc) · 4.96 KB
/
Copy pathindex.html
File metadata and controls
127 lines (121 loc) · 4.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ML Library in C++</title>
<style>
body {
font-family: Georgia, serif;
margin: 0;
padding: 0;
background-color: #f9f9f9;
color: #333;
}
.container {
max-width: 800px;
margin: 40px auto;
padding: 20px;
border-radius: 8px;
}
h1 {
font-size: 2.5rem;
margin-bottom: 10px;
}
.meta {
color: #777;
font-size: 0.9rem;
margin-bottom: 20px;
}
.content {
font-size: 1.2rem;
line-height: 1.8;
}
img {
max-width: 100%;
height: auto;
border-radius: 5px;
margin: 20px 0;
}
blockquote {
font-style: italic;
border-left: 4px solid #ccc;
padding-left: 15px;
margin: 20px 0;
color: #555;
}
details {
margin-top: 20px;
background: #eeeeee;
padding: 10px;
border-radius: 5px;
}
details summary {
cursor: pointer;
font-weight: bold;
color: #333333;
}
@media (max-width: 600px) {
.container {
padding: 15px;
margin: 20px;
}
h1 {
font-size: 2rem;
}
}
</style>
</head>
<body>
<div class="container">
<h1>A Machine Learning Library in C++</code></h1>
<p class="meta">By Mateus Riff • Feb. 2025</p>
<div class="content">
<h2>C++ Machine Learning Library</h2>
<p>
This project is a simple yet effective Machine Learning library implemented in C++ using Object-Oriented Programming (OOP) principles.
It provides an abstraction layer for regression models, allowing users to easily train and use them for predictive tasks.
</p>
<h3>OOP Principles in Action</h3>
<p>
The library follows OOP principles such as encapsulation, inheritance, abstraction, and polymorphism. The core class, <code>Regression</code>,
is an abstract base class that defines shared attributes and methods for its derived classes: <code>LinearRegression</code> and <code>LogisticRegression</code>.
</p>
<ul>
<li><strong>Encapsulation:</strong> The base class holds common data members such as model parameters and learning functions.</li>
<li><strong>Inheritance:</strong> The concrete regression classes inherit from <code>Regression</code>, ensuring code reuse and structure.</li>
<li><strong>Abstraction:</strong> Clients only interact with the interface without needing to know implementation details.</li>
<li><strong>Polymorphism:</strong> Each derived class implements its own version of cost computation and prediction methods.</li>
</ul>
<p>
For more information, you can read the <a href="https://docs.google.com/document/d/1avqy3lKtND2OwwKUXkevZPl6yp-b8wLQ7Cvuwg35exU/edit?usp=sharing">full project report</a>.
</p>
<h3>Usage</h3>
<p>
The library can be built using CMake and easily integrated into other C++ projects. Clients can create, train, and use models with just a few lines of code:
</p>
<pre>
#include <vector>
#include "ml_lib/ml.h"
int main() {
ml::LinearRegression model;
model.fit(X, y, 0.01f, 1000);
float prediction = model.predict({5.0f, 6.0f});
return 0;
}
</pre>
<h3>Evaluation</h3>
<p>
The library's models were tested against <code>scikit-learn</code> implementations. The <code>ml_cpp</code> Linear Regression model achieved a lower Mean Squared Error (MSE) than the equivalent in <code>scikit-learn</code>, demonstrating its efficiency. However, the Logistic Regression model performed worse, highlighting areas for potential improvement.
</p>
<h3>Project Demo Video (Portuguese)</h3>
<div>
<iframe width="800" height="450" src="https://www.youtube.com/embed/QAVnnVag_t4" frameborder="0" allowfullscreen></iframe>
</div>
<h3>Contributors & Resources</h3>
<p>
The project was developed by Mateus da Nóbrega Riff. It was guided by the course <a href="https://www.coursera.org/learn/machine-learning" target="_blank">Supervised Machine Learning: Regression and Classification</a>, and OpenAI models were occasionally consulted for troubleshooting and documentation.
</p>
</div>
</div>
</body>