skelearn 0.1.0__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.
- skelearn-0.1.0/MANIFEST.in +1 -0
- skelearn-0.1.0/PKG-INFO +11 -0
- skelearn-0.1.0/README.md +0 -0
- skelearn-0.1.0/setup.cfg +4 -0
- skelearn-0.1.0/setup.py +14 -0
- skelearn-0.1.0/skelearn/__init__.py +10 -0
- skelearn-0.1.0/skelearn/prac.py +74 -0
- skelearn-0.1.0/skelearn.egg-info/PKG-INFO +11 -0
- skelearn-0.1.0/skelearn.egg-info/SOURCES.txt +9 -0
- skelearn-0.1.0/skelearn.egg-info/dependency_links.txt +1 -0
- skelearn-0.1.0/skelearn.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include skelearn/*.ipynb
|
skelearn-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: skelearn
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: practice
|
|
5
|
+
Author: kingmufaz
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Dynamic: author
|
|
9
|
+
Dynamic: description-content-type
|
|
10
|
+
Dynamic: requires-python
|
|
11
|
+
Dynamic: summary
|
skelearn-0.1.0/README.md
ADDED
|
File without changes
|
skelearn-0.1.0/setup.cfg
ADDED
skelearn-0.1.0/setup.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name="skelearn",
|
|
5
|
+
version="0.1.0",
|
|
6
|
+
author="kingmufaz",
|
|
7
|
+
description="practice",
|
|
8
|
+
long_description=open("README.md").read(),
|
|
9
|
+
long_description_content_type="text/markdown",
|
|
10
|
+
packages=find_packages(),
|
|
11
|
+
include_package_data=True,
|
|
12
|
+
package_data={"skelearn": ["*.ipynb"]},
|
|
13
|
+
python_requires=">=3.8",
|
|
14
|
+
)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import matplotlib.pyplot as plt
|
|
2
|
+
|
|
3
|
+
from sklearn.datasets import load_iris
|
|
4
|
+
from sklearn.model_selection import train_test_split
|
|
5
|
+
from sklearn.preprocessing import StandardScaler
|
|
6
|
+
from tensorflow.keras.utils import to_categorical
|
|
7
|
+
|
|
8
|
+
import tensorflow as tf
|
|
9
|
+
|
|
10
|
+
# Load dataset
|
|
11
|
+
iris = load_iris()
|
|
12
|
+
X = iris.data
|
|
13
|
+
Y = iris.target
|
|
14
|
+
|
|
15
|
+
# Split dataset
|
|
16
|
+
x_train, x_test, y_train, y_test = train_test_split(
|
|
17
|
+
X, Y, test_size=0.2, random_state=42
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
# Normalize
|
|
21
|
+
scaler = StandardScaler()
|
|
22
|
+
x_train = scaler.fit_transform(x_train)
|
|
23
|
+
x_test = scaler.transform(x_test)
|
|
24
|
+
|
|
25
|
+
# One-hot encoding
|
|
26
|
+
y_train = to_categorical(y_train, 3)
|
|
27
|
+
y_test = to_categorical(y_test, 3)
|
|
28
|
+
|
|
29
|
+
# Activation functions list
|
|
30
|
+
activations = ['sigmoid', 'relu', 'tanh']
|
|
31
|
+
|
|
32
|
+
# Train separate models
|
|
33
|
+
for act in activations:
|
|
34
|
+
print(f"\n--- Using {act.upper()} Activation ---")
|
|
35
|
+
|
|
36
|
+
model = tf.keras.Sequential([
|
|
37
|
+
tf.keras.layers.Dense(128, activation=act, input_shape=(4,)),
|
|
38
|
+
tf.keras.layers.Dense(64, activation=act),
|
|
39
|
+
tf.keras.layers.Dense(3, activation='softmax')
|
|
40
|
+
])
|
|
41
|
+
|
|
42
|
+
model.compile(
|
|
43
|
+
optimizer='adam',
|
|
44
|
+
loss='categorical_crossentropy',
|
|
45
|
+
metrics=['accuracy']
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
history = model.fit(
|
|
49
|
+
x_train,
|
|
50
|
+
y_train,
|
|
51
|
+
epochs=50,
|
|
52
|
+
batch_size=8,
|
|
53
|
+
verbose=0
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
loss, accuracy = model.evaluate(
|
|
57
|
+
x_test,
|
|
58
|
+
y_test,
|
|
59
|
+
verbose=0
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
print("Final Loss:", loss)
|
|
63
|
+
print("Final Accuracy:", accuracy)
|
|
64
|
+
|
|
65
|
+
# Plot loss convergence for each activation
|
|
66
|
+
plt.plot(history.history['loss'], label=act)
|
|
67
|
+
|
|
68
|
+
# Final graph
|
|
69
|
+
plt.title("Iris Dataset Loss Convergence Comparison")
|
|
70
|
+
plt.xlabel("Epoch")
|
|
71
|
+
plt.ylabel("Loss")
|
|
72
|
+
plt.legend()
|
|
73
|
+
|
|
74
|
+
plt.show()
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: skelearn
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: practice
|
|
5
|
+
Author: kingmufaz
|
|
6
|
+
Requires-Python: >=3.8
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
Dynamic: author
|
|
9
|
+
Dynamic: description-content-type
|
|
10
|
+
Dynamic: requires-python
|
|
11
|
+
Dynamic: summary
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
skelearn
|