Update app.py
Browse files
app.py
CHANGED
|
@@ -187,9 +187,44 @@ def knn():
|
|
| 187 |
def svm():
|
| 188 |
svm = '''
|
| 189 |
### ⚡ Support Vector Machines (SVM)
|
| 190 |
-
SVM is a powerful classifier that works well for high-dimensional data. It tries to find the hyperplane that best separates the data points of different
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 191 |
'''
|
| 192 |
return svm
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
# Sidebar for content navigation with emojis
|
| 194 |
st.sidebar.header("📚 Contents")
|
| 195 |
|
|
|
|
| 187 |
def svm():
|
| 188 |
svm = '''
|
| 189 |
### ⚡ Support Vector Machines (SVM)
|
| 190 |
+
SVM is a powerful classifier that works well for high-dimensional data. It tries to find the hyperplane that best separates the data points of different classes.
|
| 191 |
+
|
| 192 |
+
**📚 Example**:
|
| 193 |
+
- **🌸 Classifying Iris Flowers**: An SVM can be used to classify Iris flowers into different species.
|
| 194 |
+
```python
|
| 195 |
+
from sklearn.svm import SVC
|
| 196 |
+
from sklearn.datasets import load_iris
|
| 197 |
+
data = load_iris()
|
| 198 |
+
X = data.data
|
| 199 |
+
y = data.target
|
| 200 |
+
model = SVC(kernel='linear')
|
| 201 |
+
model.fit(X, y)
|
| 202 |
+
predictions = model.predict(X)
|
| 203 |
+
```
|
| 204 |
'''
|
| 205 |
return svm
|
| 206 |
+
|
| 207 |
+
# Neural Networks
|
| 208 |
+
def neural_networks():
|
| 209 |
+
neural = '''
|
| 210 |
+
### 🧠 Neural Networks
|
| 211 |
+
Neural networks are modeled after the human brain, with layers of interconnected nodes (neurons) used for tasks like image and speech recognition.
|
| 212 |
+
|
| 213 |
+
**📚 Example**:
|
| 214 |
+
- **1️⃣2️⃣3️⃣ Classifying Handwritten Digits**: A simple neural network can be used to classify digits from the MNIST dataset.
|
| 215 |
+
```python
|
| 216 |
+
from sklearn.neural_network import MLPClassifier
|
| 217 |
+
from sklearn.datasets import load_iris
|
| 218 |
+
data = load_iris()
|
| 219 |
+
X = data.data
|
| 220 |
+
y = data.target
|
| 221 |
+
model = MLPClassifier(hidden_layer_sizes=(10,), max_iter=1000)
|
| 222 |
+
model.fit(X, y)
|
| 223 |
+
predictions = model.predict(X)
|
| 224 |
+
```
|
| 225 |
+
'''
|
| 226 |
+
return neural
|
| 227 |
+
|
| 228 |
# Sidebar for content navigation with emojis
|
| 229 |
st.sidebar.header("📚 Contents")
|
| 230 |
|