FDNN
A lightweight implementation of a Fuzzy Deep Neural Network (FDNN) in TensorFlow.
Installation
pip install FDNN
Usage
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
import FDNN as fd
# Load dataset
df = pd.read_csv("MAINDiagnostics.csv")
df["Gender"] = df["Gender"].map({"MALE": 1, "FEMALE": 0})
df = df.drop(columns=["IDFILENAME", "FileName", "Beat"], errors='ignore')
# Create binary target
normal_group = ["SR", "SB", "ST", "SI", "SAAWR"]
arrhythmia_group = ["AFIB", "AF", "SVT", "AT", "AVNRT", "AVRT"]
df["Rhythm_Binary"] = df["Rhythm"].apply(lambda x: 0 if x in normal_group else (1 if x in arrhythmia_group else None))
df = df.dropna(subset=["Rhythm_Binary"])
y = df["Rhythm_Binary"].astype(int)
X = df.drop(columns=["Rhythm", "Rhythm_Binary"], errors='ignore')
# Save feature names
feature_names = X.columns.tolist()
# Scale features
scaler = StandardScaler()
X_scaled = scaler.fit_transform(X)
# Train/test split
X_train, X_val, y_train, y_val = train_test_split(X_scaled, y, test_size=0.2, random_state=42, stratify=y)
input_dim = X_train.shape[1]
# Train the model
model = fd.build_fdnn(input_dim)
model.fit(X_train, y_train, validation_data=(X_val, y_val), epochs=20, batch_size=32, verbose=1)
You can find "MAINDiagnostics.csv" here.
License
MIT
Authors
- Arman Daliri
- Nora Mahdavi
Release files for FDNN 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fdnn-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Release files / fdnn-0.1.0-py3-none-any.whl
| Download URL | fdnn-0.1.0-py3-none-any.whl |
|---|---|
| Size | 3.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a6a1649c4f23582da630da426b730f5e6f8409bcc47e287745a32b731548f04f
|
|
BLAKE2b-256 checksum How to use checksums |
91b6a04ba1d5dd63fea81acd69c2a0ddb86f079e03c3a58a8e6af2463659c2ba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|