modelit 0.2.1__tar.gz → 0.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {modelit-0.2.1 → modelit-0.2.3}/.gitignore +2 -1
- {modelit-0.2.1 → modelit-0.2.3}/PKG-INFO +1 -1
- {modelit-0.2.1/modelit/templates/backpropogation → modelit-0.2.3/modelit/templates/backpropagation}/template.py +9 -66
- {modelit-0.2.1 → modelit-0.2.3}/modelit.egg-info/PKG-INFO +1 -1
- {modelit-0.2.1 → modelit-0.2.3}/modelit.egg-info/SOURCES.txt +1 -1
- {modelit-0.2.1 → modelit-0.2.3}/.github/workflows/publish.yml +0 -0
- {modelit-0.2.1 → modelit-0.2.3}/.github/workflows/test.yml +0 -0
- {modelit-0.2.1 → modelit-0.2.3}/LICENSE +0 -0
- {modelit-0.2.1 → modelit-0.2.3}/MANIFEST.in +0 -0
- {modelit-0.2.1 → modelit-0.2.3}/README.md +0 -0
- {modelit-0.2.1 → modelit-0.2.3}/modelit/__init__.py +0 -0
- {modelit-0.2.1 → modelit-0.2.3}/modelit/__main__.py +0 -0
- {modelit-0.2.1 → modelit-0.2.3}/modelit/cli.py +0 -0
- {modelit-0.2.1 → modelit-0.2.3}/modelit/registry.py +0 -0
- {modelit-0.2.1 → modelit-0.2.3}/modelit/templates/perceptron/template.py +0 -0
- {modelit-0.2.1 → modelit-0.2.3}/modelit.egg-info/dependency_links.txt +0 -0
- {modelit-0.2.1 → modelit-0.2.3}/modelit.egg-info/entry_points.txt +0 -0
- {modelit-0.2.1 → modelit-0.2.3}/modelit.egg-info/top_level.txt +0 -0
- {modelit-0.2.1 → modelit-0.2.3}/pyproject.toml +0 -0
- {modelit-0.2.1 → modelit-0.2.3}/setup.cfg +0 -0
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import numpy as np
|
|
14
14
|
import pandas as pd
|
|
15
15
|
|
|
16
|
+
from sklearn.datasets import load_breast_cancer
|
|
16
17
|
from sklearn.model_selection import train_test_split
|
|
17
18
|
from sklearn.neural_network import MLPClassifier
|
|
18
19
|
from sklearn.preprocessing import StandardScaler
|
|
@@ -386,28 +387,11 @@ print(w2_xavier)
|
|
|
386
387
|
# =========================================================
|
|
387
388
|
|
|
388
389
|
print("\n=================================================")
|
|
389
|
-
print("
|
|
390
|
+
print("Breast Cancer Dataset using MLPClassifier")
|
|
390
391
|
print("=================================================")
|
|
391
392
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
# pip install kagglehub
|
|
395
|
-
|
|
396
|
-
import kagglehub
|
|
397
|
-
|
|
398
|
-
path = kagglehub.dataset_download(
|
|
399
|
-
"yasserh/titanic-dataset"
|
|
400
|
-
)
|
|
401
|
-
|
|
402
|
-
print("\nPath to dataset files:")
|
|
403
|
-
print(path)
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
# =========================================================
|
|
407
|
-
# LOAD DATASET
|
|
408
|
-
# =========================================================
|
|
409
|
-
|
|
410
|
-
df = pd.read_csv(f"{path}/Titanic-Dataset.csv")
|
|
393
|
+
dataset = load_breast_cancer(as_frame=True)
|
|
394
|
+
df = dataset.frame
|
|
411
395
|
|
|
412
396
|
print("\nDataset Head:")
|
|
413
397
|
print(df.head())
|
|
@@ -417,48 +401,8 @@ print(df.head())
|
|
|
417
401
|
# FEATURES AND LABELS
|
|
418
402
|
# =========================================================
|
|
419
403
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
X_titanic = df.drop(
|
|
423
|
-
columns=[
|
|
424
|
-
"Survived",
|
|
425
|
-
"Name",
|
|
426
|
-
"Ticket",
|
|
427
|
-
"Cabin"
|
|
428
|
-
]
|
|
429
|
-
)
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
# =========================================================
|
|
433
|
-
# ENCODE SEX COLUMN
|
|
434
|
-
# =========================================================
|
|
435
|
-
|
|
436
|
-
X_titanic["Sex"] = X_titanic["Sex"].map(
|
|
437
|
-
{
|
|
438
|
-
"male": 0,
|
|
439
|
-
"female": 1
|
|
440
|
-
}
|
|
441
|
-
)
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
# =========================================================
|
|
445
|
-
# ONE HOT ENCODING
|
|
446
|
-
# =========================================================
|
|
447
|
-
|
|
448
|
-
X_titanic = pd.get_dummies(
|
|
449
|
-
X_titanic,
|
|
450
|
-
columns=["Embarked"],
|
|
451
|
-
drop_first=True
|
|
452
|
-
)
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
# =========================================================
|
|
456
|
-
# HANDLE MISSING VALUES
|
|
457
|
-
# =========================================================
|
|
458
|
-
|
|
459
|
-
X_titanic = X_titanic.fillna(
|
|
460
|
-
X_titanic.mean()
|
|
461
|
-
)
|
|
404
|
+
X_cancer = df.drop(columns=["target"])
|
|
405
|
+
y_cancer = df["target"]
|
|
462
406
|
|
|
463
407
|
|
|
464
408
|
# =========================================================
|
|
@@ -466,8 +410,7 @@ X_titanic = X_titanic.fillna(
|
|
|
466
410
|
# =========================================================
|
|
467
411
|
|
|
468
412
|
scaler = StandardScaler()
|
|
469
|
-
|
|
470
|
-
X_scaled = scaler.fit_transform(X_titanic)
|
|
413
|
+
X_scaled = scaler.fit_transform(X_cancer)
|
|
471
414
|
|
|
472
415
|
|
|
473
416
|
# =========================================================
|
|
@@ -476,7 +419,7 @@ X_scaled = scaler.fit_transform(X_titanic)
|
|
|
476
419
|
|
|
477
420
|
X_train, X_test, y_train, y_test = train_test_split(
|
|
478
421
|
X_scaled,
|
|
479
|
-
|
|
422
|
+
y_cancer,
|
|
480
423
|
test_size=0.2,
|
|
481
424
|
random_state=42
|
|
482
425
|
)
|
|
@@ -537,4 +480,4 @@ accuracy = mlp.score(X_test, y_test)
|
|
|
537
480
|
|
|
538
481
|
print("\n=================================================")
|
|
539
482
|
print(f"Model Accuracy: {accuracy * 100:.2f}%")
|
|
540
|
-
print("=================================================")
|
|
483
|
+
print("=================================================")
|
|
@@ -14,5 +14,5 @@ modelit.egg-info/SOURCES.txt
|
|
|
14
14
|
modelit.egg-info/dependency_links.txt
|
|
15
15
|
modelit.egg-info/entry_points.txt
|
|
16
16
|
modelit.egg-info/top_level.txt
|
|
17
|
-
modelit/templates/
|
|
17
|
+
modelit/templates/backpropagation/template.py
|
|
18
18
|
modelit/templates/perceptron/template.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|