Update Main Models/bai-3.0 Epilepsy/README.md
Browse files
Main Models/bai-3.0 Epilepsy/README.md
CHANGED
@@ -1,72 +1,72 @@
|
|
1 |
-
# bai-3.0 Epilepsy (45851parametre)
|
2 |
-
|
3 |
-
## "bai-3.0 Epilepsy" modeli, hastanın epilepsi nöbeti durumunu tespit eder.
|
4 |
-
|
5 |
-
#### NOT: Gerçek zamanlı EEG veri takibi uygulamasına modeli entegre ederseniz, gerçek zamanlı olarak
|
6 |
-
|
7 |
-
## -----------------------------------------------------------------------------------
|
8 |
-
|
9 |
-
# bai-3.0 Epilepsy (45851 parameters)
|
10 |
-
|
11 |
-
## The "bai-3.0 Epilepsy" model detects the patient's epileptic seizure status.
|
12 |
-
|
13 |
-
#### NOTE: If you integrate the model into a real-time EEG data tracking application, it can predict
|
14 |
-
**Doğruluk/Accuracy: %68,90829694323143**
|
15 |
-
|
16 |
-
# Kullanım / Usage
|
17 |
-
|
18 |
-
```python
|
19 |
-
import pandas as pd
|
20 |
-
import numpy as np
|
21 |
-
import ast
|
22 |
-
from tensorflow.keras.models import load_model, Sequential
|
23 |
-
from sklearn.metrics import accuracy_score
|
24 |
-
|
25 |
-
model_path = 'model/path'
|
26 |
-
|
27 |
-
model = load_model(model_path)
|
28 |
-
|
29 |
-
test_data_path = 'epilepsy/dataset'
|
30 |
-
test_data = pd.read_csv(test_data_path)
|
31 |
-
|
32 |
-
test_data['sample'] = test_data['sample'].apply(ast.literal_eval)
|
33 |
-
|
34 |
-
X_test = np.array(test_data['sample'].tolist())
|
35 |
-
y_test = test_data['label'].values.astype(int)
|
36 |
-
|
37 |
-
timesteps = 10
|
38 |
-
|
39 |
-
X_test_reshaped = []
|
40 |
-
|
41 |
-
for i in range(len(X_test) - timesteps):
|
42 |
-
X_test_reshaped.append(X_test[i:i + timesteps])
|
43 |
-
|
44 |
-
X_test_reshaped = np.array(X_test_reshaped)
|
45 |
-
|
46 |
-
y_pred = model.predict(X_test_reshaped)
|
47 |
-
y_pred_classes = (y_pred > 0.77).astype(int) # En kararlı sonuçlar -> 0.78 ve 0.77. Eşik değeri: çıkan sonucun yuvarlama değerini artırıp azaltma.
|
48 |
-
# Örn. Olasılık < 0.77 ise "0", olasılık >= 0.77 ise "1" tahminini yap.
|
49 |
-
|
50 |
-
accuracy = accuracy_score(y_test[timesteps:], y_pred_classes)
|
51 |
-
|
52 |
-
print("Gerçek Değerler (1: Nöbet, 0: Nöbet Değil) ve Tahminler:")
|
53 |
-
for i in range(len(y_pred_classes)):
|
54 |
-
print(f"Gerçek: {y_test[i + timesteps]}, Tahmin: {y_pred_classes[i][0]}")
|
55 |
-
print(f"Modelin doğruluk oranı: %{accuracy * 100}")
|
56 |
-
model.summary()
|
57 |
-
```
|
58 |
-
|
59 |
-
# Python Sürümü / Python Version
|
60 |
-
|
61 |
-
### 3.9 <=> 3.13
|
62 |
-
|
63 |
-
# Modüller / Modules
|
64 |
-
|
65 |
-
```bash
|
66 |
-
matplotlib==3.8.0
|
67 |
-
matplotlib-inline==0.1.6
|
68 |
-
numpy==1.26.4
|
69 |
-
pandas==2.2.2
|
70 |
-
scikit-learn==1.3.1
|
71 |
-
tensorflow==2.15.0
|
72 |
```
|
|
|
1 |
+
# bai-3.0 Epilepsy (45851parametre)
|
2 |
+
|
3 |
+
## "bai-3.0 Epilepsy" modeli, hastanın epilepsi nöbeti durumunu tespit eder.
|
4 |
+
|
5 |
+
#### NOT: Gerçek zamanlı EEG veri takibi uygulamasına modeli entegre ederseniz, gerçek zamanlı olarak nöbet durumu tahmini yapabilmektedir. Uygulamaya erişebilmek için: https://github.com/neurazum/Realtime-EEG-Monitoring
|
6 |
+
|
7 |
+
## -----------------------------------------------------------------------------------
|
8 |
+
|
9 |
+
# bai-3.0 Epilepsy (45851 parameters)
|
10 |
+
|
11 |
+
## The "bai-3.0 Epilepsy" model detects the patient's epileptic seizure status.
|
12 |
+
|
13 |
+
#### NOTE: If you integrate the model into a real-time EEG data tracking application, it can predict epilepsy seizure state in real time. To access the application: https://github.com/neurazum/Realtime-EEG-Monitoring
|
14 |
+
**Doğruluk/Accuracy: %68,90829694323143**
|
15 |
+
|
16 |
+
# Kullanım / Usage
|
17 |
+
|
18 |
+
```python
|
19 |
+
import pandas as pd
|
20 |
+
import numpy as np
|
21 |
+
import ast
|
22 |
+
from tensorflow.keras.models import load_model, Sequential
|
23 |
+
from sklearn.metrics import accuracy_score
|
24 |
+
|
25 |
+
model_path = 'model/path'
|
26 |
+
|
27 |
+
model = load_model(model_path)
|
28 |
+
|
29 |
+
test_data_path = 'epilepsy/dataset'
|
30 |
+
test_data = pd.read_csv(test_data_path)
|
31 |
+
|
32 |
+
test_data['sample'] = test_data['sample'].apply(ast.literal_eval)
|
33 |
+
|
34 |
+
X_test = np.array(test_data['sample'].tolist())
|
35 |
+
y_test = test_data['label'].values.astype(int)
|
36 |
+
|
37 |
+
timesteps = 10
|
38 |
+
|
39 |
+
X_test_reshaped = []
|
40 |
+
|
41 |
+
for i in range(len(X_test) - timesteps):
|
42 |
+
X_test_reshaped.append(X_test[i:i + timesteps])
|
43 |
+
|
44 |
+
X_test_reshaped = np.array(X_test_reshaped)
|
45 |
+
|
46 |
+
y_pred = model.predict(X_test_reshaped)
|
47 |
+
y_pred_classes = (y_pred > 0.77).astype(int) # En kararlı sonuçlar -> 0.78 ve 0.77. Eşik değeri: çıkan sonucun yuvarlama değerini artırıp azaltma.
|
48 |
+
# Örn. Olasılık < 0.77 ise "0", olasılık >= 0.77 ise "1" tahminini yap.
|
49 |
+
|
50 |
+
accuracy = accuracy_score(y_test[timesteps:], y_pred_classes)
|
51 |
+
|
52 |
+
print("Gerçek Değerler (1: Nöbet, 0: Nöbet Değil) ve Tahminler:")
|
53 |
+
for i in range(len(y_pred_classes)):
|
54 |
+
print(f"Gerçek: {y_test[i + timesteps]}, Tahmin: {y_pred_classes[i][0]}")
|
55 |
+
print(f"Modelin doğruluk oranı: %{accuracy * 100}")
|
56 |
+
model.summary()
|
57 |
+
```
|
58 |
+
|
59 |
+
# Python Sürümü / Python Version
|
60 |
+
|
61 |
+
### 3.9 <=> 3.13
|
62 |
+
|
63 |
+
# Modüller / Modules
|
64 |
+
|
65 |
+
```bash
|
66 |
+
matplotlib==3.8.0
|
67 |
+
matplotlib-inline==0.1.6
|
68 |
+
numpy==1.26.4
|
69 |
+
pandas==2.2.2
|
70 |
+
scikit-learn==1.3.1
|
71 |
+
tensorflow==2.15.0
|
72 |
```
|