Skip to content
This repository was archived by the owner on Jul 27, 2021. It is now read-only.

Commit a7f0b26

Browse files
Homework 24 Final
1 parent 2d7dfc2 commit a7f0b26

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
Earned Bonuses:
22

3-
2. (5) --> Submit a project at C level by Saturday, Dec. 1 before 6:00 am
3+
2. (5) --> Submit a project at C level by Saturday, Dec. 1 before 6:00 am
4+
4. (5) --> Normalize your data, so that every value 0 <= data[i][j] <= 1.
5+
--> normData contains values ranging from 0 to 1

submissions/Bertrand/myKMeans.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,22 @@
1212
data = np.delete(data, np.s_[7,11,19,20], axis=1)
1313
data = np.delete(data, np.s_[0], axis=0) # remove column headers
1414
data = data.astype(float) # convert strings to floats
15+
16+
17+
# normalize the data
18+
normData = np.copy(data)
19+
maxVal = np.amax(normData)
20+
minVal = np.amin(normData)
21+
22+
normData = (np.subtract(normData, minVal) / (maxVal - minVal))
23+
1524
Examples = {
1625
'Airline Data': {
1726
'data': data,
1827
'k': [2, 3, 4],
1928
},
29+
'Normalized Airline Data': {
30+
'data': normData,
31+
'k': [2, 5, 18]
32+
},
2033
}

0 commit comments

Comments
 (0)