mllabkitbyvh 1.0.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.
- mllabkitbyvh-1.0.0/LICENSE +6 -0
- mllabkitbyvh-1.0.0/PKG-INFO +40 -0
- mllabkitbyvh-1.0.0/README.md +25 -0
- mllabkitbyvh-1.0.0/mllabkit/__init__.py +13 -0
- mllabkitbyvh-1.0.0/mllabkit/experiments.py +338 -0
- mllabkitbyvh-1.0.0/mllabkitbyvh.egg-info/PKG-INFO +40 -0
- mllabkitbyvh-1.0.0/mllabkitbyvh.egg-info/SOURCES.txt +10 -0
- mllabkitbyvh-1.0.0/mllabkitbyvh.egg-info/dependency_links.txt +1 -0
- mllabkitbyvh-1.0.0/mllabkitbyvh.egg-info/requires.txt +4 -0
- mllabkitbyvh-1.0.0/mllabkitbyvh.egg-info/top_level.txt +1 -0
- mllabkitbyvh-1.0.0/pyproject.toml +25 -0
- mllabkitbyvh-1.0.0/setup.cfg +4 -0
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mllabkitbyvh
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Machine Learning Laboratory Programs
|
|
5
|
+
Author: Harish
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: numpy
|
|
11
|
+
Requires-Dist: pandas
|
|
12
|
+
Requires-Dist: matplotlib
|
|
13
|
+
Requires-Dist: scikit-learn
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# ML Lab Kit
|
|
17
|
+
|
|
18
|
+
Machine Learning Laboratory Programs using Python.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install mllabkit
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
import mllabkit as ml
|
|
30
|
+
|
|
31
|
+
ml.list()
|
|
32
|
+
ml.exp1()
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Features:
|
|
36
|
+
- 10 Machine Learning Lab Programs
|
|
37
|
+
- NumPy
|
|
38
|
+
- Pandas
|
|
39
|
+
- Matplotlib
|
|
40
|
+
- Scikit-learn
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# ML Lab Kit
|
|
2
|
+
|
|
3
|
+
Machine Learning Laboratory Programs using Python.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install mllabkit
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
import mllabkit as ml
|
|
15
|
+
|
|
16
|
+
ml.list()
|
|
17
|
+
ml.exp1()
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Features:
|
|
21
|
+
- 10 Machine Learning Lab Programs
|
|
22
|
+
- NumPy
|
|
23
|
+
- Pandas
|
|
24
|
+
- Matplotlib
|
|
25
|
+
- Scikit-learn
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Machine Learning Lab Kit
|
|
3
|
+
Author: Harish
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
def list():
|
|
7
|
+
print("""
|
|
8
|
+
=========================================================
|
|
9
|
+
MACHINE LEARNING LAB PROGRAMS
|
|
10
|
+
=========================================================
|
|
11
|
+
|
|
12
|
+
1. Install and Import Python Libraries
|
|
13
|
+
2. Introduction to Scikit-learn
|
|
14
|
+
3. Verify Scikit-learn Installation
|
|
15
|
+
4. Load and Explore Dataset
|
|
16
|
+
5. Visualize Dataset
|
|
17
|
+
6. Data Preprocessing
|
|
18
|
+
7. K-Nearest Neighbours (KNN)
|
|
19
|
+
8. Linear Regression
|
|
20
|
+
9. Decision Tree
|
|
21
|
+
10. K-Means Clustering
|
|
22
|
+
|
|
23
|
+
Usage:
|
|
24
|
+
|
|
25
|
+
>>> import mllabkit as ml
|
|
26
|
+
|
|
27
|
+
>>> ml.list()
|
|
28
|
+
>>> ml.exp1()
|
|
29
|
+
>>> ml.exp2()
|
|
30
|
+
>>> ml.exp3()
|
|
31
|
+
>>> ml.exp4()
|
|
32
|
+
>>> ml.exp5()
|
|
33
|
+
>>> ml.exp6()
|
|
34
|
+
>>> ml.exp7()
|
|
35
|
+
>>> ml.exp8()
|
|
36
|
+
>>> ml.exp9()
|
|
37
|
+
>>> ml.exp10()
|
|
38
|
+
|
|
39
|
+
=========================================================
|
|
40
|
+
""")
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def exp1():
|
|
44
|
+
"""Install and Import Libraries"""
|
|
45
|
+
|
|
46
|
+
import numpy as np
|
|
47
|
+
import pandas as pd
|
|
48
|
+
import matplotlib.pyplot as plt
|
|
49
|
+
import sklearn
|
|
50
|
+
|
|
51
|
+
print("\n========== EXPERIMENT 1 ==========")
|
|
52
|
+
print("Install and Import Libraries\n")
|
|
53
|
+
|
|
54
|
+
print("NumPy Version :", np.__version__)
|
|
55
|
+
print("Pandas Version :", pd.__version__)
|
|
56
|
+
print("Matplotlib Version :", plt.matplotlib.__version__)
|
|
57
|
+
print("Scikit-learn Version:", sklearn.__version__)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def exp2():
|
|
61
|
+
"""Introduction to Scikit-learn"""
|
|
62
|
+
|
|
63
|
+
import sklearn
|
|
64
|
+
|
|
65
|
+
print("\n========== EXPERIMENT 2 ==========")
|
|
66
|
+
print("Introduction to Scikit-learn\n")
|
|
67
|
+
|
|
68
|
+
print("Scikit-learn is an open-source Machine Learning library.")
|
|
69
|
+
print("Version :", sklearn.__version__)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def exp3():
|
|
73
|
+
"""Verify Installation"""
|
|
74
|
+
|
|
75
|
+
print("\n========== EXPERIMENT 3 ==========")
|
|
76
|
+
|
|
77
|
+
try:
|
|
78
|
+
import numpy
|
|
79
|
+
import pandas
|
|
80
|
+
import matplotlib
|
|
81
|
+
import sklearn
|
|
82
|
+
|
|
83
|
+
print("\nAll required libraries are installed successfully.")
|
|
84
|
+
|
|
85
|
+
except Exception as e:
|
|
86
|
+
print(e)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def exp4():
|
|
90
|
+
"""Load Dataset"""
|
|
91
|
+
|
|
92
|
+
import pandas as pd
|
|
93
|
+
|
|
94
|
+
print("\n========== EXPERIMENT 4 ==========")
|
|
95
|
+
|
|
96
|
+
filename = input("Enter CSV File Name : ")
|
|
97
|
+
|
|
98
|
+
df = pd.read_csv(filename)
|
|
99
|
+
|
|
100
|
+
print("\nFirst 5 Rows\n")
|
|
101
|
+
print(df.head())
|
|
102
|
+
|
|
103
|
+
print("\nInformation\n")
|
|
104
|
+
print(df.info())
|
|
105
|
+
|
|
106
|
+
print("\nStatistics\n")
|
|
107
|
+
print(df.describe())
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def exp5():
|
|
111
|
+
"""Visualize Dataset"""
|
|
112
|
+
|
|
113
|
+
import pandas as pd
|
|
114
|
+
import matplotlib.pyplot as plt
|
|
115
|
+
|
|
116
|
+
print("\n========== EXPERIMENT 5 ==========")
|
|
117
|
+
|
|
118
|
+
filename = input("Enter CSV File Name : ")
|
|
119
|
+
|
|
120
|
+
df = pd.read_csv(filename)
|
|
121
|
+
|
|
122
|
+
plt.scatter(df.iloc[:,0],df.iloc[:,1])
|
|
123
|
+
|
|
124
|
+
plt.title("Scatter Plot")
|
|
125
|
+
|
|
126
|
+
plt.show()
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def exp6():
|
|
130
|
+
"""Data Preprocessing"""
|
|
131
|
+
|
|
132
|
+
import pandas as pd
|
|
133
|
+
|
|
134
|
+
from sklearn.preprocessing import LabelEncoder
|
|
135
|
+
|
|
136
|
+
from sklearn.preprocessing import StandardScaler
|
|
137
|
+
|
|
138
|
+
print("\n========== EXPERIMENT 6 ==========")
|
|
139
|
+
|
|
140
|
+
filename = input("Enter CSV File Name : ")
|
|
141
|
+
|
|
142
|
+
df = pd.read_csv(filename)
|
|
143
|
+
|
|
144
|
+
df = df.fillna(df.mean(numeric_only=True))
|
|
145
|
+
|
|
146
|
+
le = LabelEncoder()
|
|
147
|
+
|
|
148
|
+
for col in df.select_dtypes(include='object'):
|
|
149
|
+
|
|
150
|
+
df[col] = le.fit_transform(df[col])
|
|
151
|
+
|
|
152
|
+
scaler = StandardScaler()
|
|
153
|
+
|
|
154
|
+
data = scaler.fit_transform(df)
|
|
155
|
+
|
|
156
|
+
print(data)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def exp7():
|
|
160
|
+
"""KNN"""
|
|
161
|
+
|
|
162
|
+
import pandas as pd
|
|
163
|
+
|
|
164
|
+
from sklearn.model_selection import train_test_split
|
|
165
|
+
|
|
166
|
+
from sklearn.neighbors import KNeighborsClassifier
|
|
167
|
+
|
|
168
|
+
from sklearn.metrics import accuracy_score
|
|
169
|
+
|
|
170
|
+
print("\n========== EXPERIMENT 7 ==========")
|
|
171
|
+
|
|
172
|
+
filename = input("Enter CSV File Name : ")
|
|
173
|
+
|
|
174
|
+
df = pd.read_csv(filename)
|
|
175
|
+
|
|
176
|
+
X = df.iloc[:,:-1]
|
|
177
|
+
|
|
178
|
+
y = df.iloc[:,-1]
|
|
179
|
+
|
|
180
|
+
X_train,X_test,y_train,y_test = train_test_split(
|
|
181
|
+
|
|
182
|
+
X,
|
|
183
|
+
|
|
184
|
+
y,
|
|
185
|
+
|
|
186
|
+
test_size=0.2,
|
|
187
|
+
|
|
188
|
+
random_state=42
|
|
189
|
+
|
|
190
|
+
)
|
|
191
|
+
|
|
192
|
+
model = KNeighborsClassifier(n_neighbors=3)
|
|
193
|
+
|
|
194
|
+
model.fit(X_train,y_train)
|
|
195
|
+
|
|
196
|
+
pred = model.predict(X_test)
|
|
197
|
+
|
|
198
|
+
print("\nAccuracy :",accuracy_score(y_test,pred))
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def exp8():
|
|
202
|
+
"""Linear Regression"""
|
|
203
|
+
|
|
204
|
+
import pandas as pd
|
|
205
|
+
|
|
206
|
+
from sklearn.model_selection import train_test_split
|
|
207
|
+
|
|
208
|
+
from sklearn.linear_model import LinearRegression
|
|
209
|
+
|
|
210
|
+
print("\n========== EXPERIMENT 8 ==========")
|
|
211
|
+
|
|
212
|
+
filename = input("Enter CSV File Name : ")
|
|
213
|
+
|
|
214
|
+
df = pd.read_csv(filename)
|
|
215
|
+
|
|
216
|
+
X = df.iloc[:,:-1]
|
|
217
|
+
|
|
218
|
+
y = df.iloc[:,-1]
|
|
219
|
+
|
|
220
|
+
X_train,X_test,y_train,y_test = train_test_split(
|
|
221
|
+
|
|
222
|
+
X,
|
|
223
|
+
|
|
224
|
+
y,
|
|
225
|
+
|
|
226
|
+
test_size=0.2,
|
|
227
|
+
|
|
228
|
+
random_state=42
|
|
229
|
+
|
|
230
|
+
)
|
|
231
|
+
|
|
232
|
+
model = LinearRegression()
|
|
233
|
+
|
|
234
|
+
model.fit(X_train,y_train)
|
|
235
|
+
|
|
236
|
+
print("\nPrediction")
|
|
237
|
+
|
|
238
|
+
print(model.predict(X_test))
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
def exp9():
|
|
242
|
+
"""Decision Tree"""
|
|
243
|
+
|
|
244
|
+
import pandas as pd
|
|
245
|
+
|
|
246
|
+
import matplotlib.pyplot as plt
|
|
247
|
+
|
|
248
|
+
from sklearn.tree import DecisionTreeClassifier
|
|
249
|
+
|
|
250
|
+
from sklearn.tree import plot_tree
|
|
251
|
+
|
|
252
|
+
from sklearn.model_selection import train_test_split
|
|
253
|
+
|
|
254
|
+
print("\n========== EXPERIMENT 9 ==========")
|
|
255
|
+
|
|
256
|
+
filename = input("Enter CSV File Name : ")
|
|
257
|
+
|
|
258
|
+
df = pd.read_csv(filename)
|
|
259
|
+
|
|
260
|
+
X = df.iloc[:,:-1]
|
|
261
|
+
|
|
262
|
+
y = df.iloc[:,-1]
|
|
263
|
+
|
|
264
|
+
X_train,X_test,y_train,y_test = train_test_split(
|
|
265
|
+
|
|
266
|
+
X,
|
|
267
|
+
|
|
268
|
+
y,
|
|
269
|
+
|
|
270
|
+
test_size=0.2,
|
|
271
|
+
|
|
272
|
+
random_state=42
|
|
273
|
+
|
|
274
|
+
)
|
|
275
|
+
|
|
276
|
+
model = DecisionTreeClassifier()
|
|
277
|
+
|
|
278
|
+
model.fit(X_train,y_train)
|
|
279
|
+
|
|
280
|
+
plt.figure(figsize=(12,7))
|
|
281
|
+
|
|
282
|
+
plot_tree(model,filled=True)
|
|
283
|
+
|
|
284
|
+
plt.show()
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
def exp10():
|
|
288
|
+
"""K-Means"""
|
|
289
|
+
|
|
290
|
+
import pandas as pd
|
|
291
|
+
|
|
292
|
+
import matplotlib.pyplot as plt
|
|
293
|
+
|
|
294
|
+
from sklearn.cluster import KMeans
|
|
295
|
+
|
|
296
|
+
print("\n========== EXPERIMENT 10 ==========")
|
|
297
|
+
|
|
298
|
+
filename = input("Enter CSV File Name : ")
|
|
299
|
+
|
|
300
|
+
df = pd.read_csv(filename)
|
|
301
|
+
|
|
302
|
+
X = df.iloc[:,:2]
|
|
303
|
+
|
|
304
|
+
model = KMeans(
|
|
305
|
+
|
|
306
|
+
n_clusters=3,
|
|
307
|
+
|
|
308
|
+
random_state=42,
|
|
309
|
+
|
|
310
|
+
n_init=10
|
|
311
|
+
|
|
312
|
+
)
|
|
313
|
+
|
|
314
|
+
label = model.fit_predict(X)
|
|
315
|
+
|
|
316
|
+
plt.scatter(
|
|
317
|
+
|
|
318
|
+
X.iloc[:,0],
|
|
319
|
+
|
|
320
|
+
X.iloc[:,1],
|
|
321
|
+
|
|
322
|
+
c=label
|
|
323
|
+
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
plt.scatter(
|
|
327
|
+
|
|
328
|
+
model.cluster_centers_[:,0],
|
|
329
|
+
|
|
330
|
+
model.cluster_centers_[:,1],
|
|
331
|
+
|
|
332
|
+
marker='X',
|
|
333
|
+
|
|
334
|
+
s=200
|
|
335
|
+
|
|
336
|
+
)
|
|
337
|
+
|
|
338
|
+
plt.show()
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mllabkitbyvh
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Machine Learning Laboratory Programs
|
|
5
|
+
Author: Harish
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.9
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: numpy
|
|
11
|
+
Requires-Dist: pandas
|
|
12
|
+
Requires-Dist: matplotlib
|
|
13
|
+
Requires-Dist: scikit-learn
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# ML Lab Kit
|
|
17
|
+
|
|
18
|
+
Machine Learning Laboratory Programs using Python.
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install mllabkit
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
import mllabkit as ml
|
|
30
|
+
|
|
31
|
+
ml.list()
|
|
32
|
+
ml.exp1()
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Features:
|
|
36
|
+
- 10 Machine Learning Lab Programs
|
|
37
|
+
- NumPy
|
|
38
|
+
- Pandas
|
|
39
|
+
- Matplotlib
|
|
40
|
+
- Scikit-learn
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
mllabkit/__init__.py
|
|
5
|
+
mllabkit/experiments.py
|
|
6
|
+
mllabkitbyvh.egg-info/PKG-INFO
|
|
7
|
+
mllabkitbyvh.egg-info/SOURCES.txt
|
|
8
|
+
mllabkitbyvh.egg-info/dependency_links.txt
|
|
9
|
+
mllabkitbyvh.egg-info/requires.txt
|
|
10
|
+
mllabkitbyvh.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mllabkit
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "mllabkitbyvh"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Machine Learning Laboratory Programs"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Harish" }
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
dependencies = [
|
|
18
|
+
"numpy",
|
|
19
|
+
"pandas",
|
|
20
|
+
"matplotlib",
|
|
21
|
+
"scikit-learn"
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[tool.setuptools]
|
|
25
|
+
packages = ["mllabkit"]
|