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

Commit fc4fa61

Browse files
authored
Merge pull request #437 from dysomni/master
homework 24
2 parents ee7ec11 + c67104e commit fc4fa61

File tree

3 files changed

+120
-0
lines changed

3 files changed

+120
-0
lines changed

submissions/Brock/kMeansBonus.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Source of data:
2+
https://www.dataquest.io/blog/k-means-clustering-us-senators/
3+
The data represents the votes of US Senators on various bills.
4+
5+
Sample is 100 rows long and more than 3 columns, and the k value in the middle of the other two performed the best.
6+
7+
5 - my data is normalized, which is >= 0 and <= 1

submissions/Brock/kMeansVoting.csv

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
1,0,0,0,1,1,1,1,0,0,1,1,1,0,0,0,0,0
2+
1,0,0,0,1,1,1,1,0,0,1,0,1,0,1,0,1,0
3+
0,0,1,1,0,0,1,0,1,0,1,0,0,1,1,0,1,1
4+
1,0,0,0,1,1,1,1,0,1,1,1,1,0,0,1,0,0
5+
0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0,1,0
6+
0,0,1,1,0,0,1,0,1,0,1,0,0,1,1,0,1,1
7+
1,0,0,0,1,1,1,1,0,1,1,1,1,0,0,1,0,0
8+
0,0,1,1,0,0,1,0,1,0,1,0,0,1,1,0,1,1
9+
1,0,0,0,1,1,1,1,0,1,1,1,1,0,0,1,0,0
10+
0,0,1,0.5,0,0,1,0,1,0,1,0,0,1,1,0,1,1
11+
0,0,1,1,0,0,1,0,1,0,1,0,0,1,1,0,1,1
12+
1,0,0,0,1,0,1,1,0,1,1,1,1,0,0,1,0,0
13+
0,0,1,1,0,0,1,0,1,0,1,0,0,1,1,0,1,1
14+
1,0,0,0.5,1,1,1,1,0,1,1,1,1,0,0,1,0,0
15+
0,0,1,1,0,0,1,0,1,0,1,0,0,1,1,0,1,1
16+
0,0,1,0,0,0,1,0,1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0
94+
0,0,1,1,0,0,1,0,1,0,1,0,0,1,1,0,1,1
95+
1,0,0,0,1,1,1,1,0,1,1,1,1,0,0,1,0,0
96+
0,0,1,1,1,0,1,0,1,0,1,0,0,1,1,0,1,0
97+
0,0,1,1,0,0,1,0,1,0,1,0,0,1,1,0,1,1
98+
0,0,1,1,0,0,1,0,1,0,1,0,0,1,1,0,1,1
99+
1,0,0,0,1,1,1,1,0,1,0,1,1,0,0,1,0,0
100+
0,0,1,1,0,0,1,0,1,0,1,0,0,1,1,0,1,1

submissions/Brock/myKMeans.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import csv, numpy, keras_applications
2+
3+
with open('kMeansVoting.csv', newline='') as file:
4+
data = numpy.array(list(csv.reader(file)))
5+
data[0][0] = '0'
6+
data = data.astype(numpy.float)
7+
8+
Examples = {
9+
'Voing Data': {
10+
'data': data,
11+
'k': [7, 2, 9],
12+
},
13+
}

0 commit comments

Comments
 (0)