-
Notifications
You must be signed in to change notification settings - Fork 27
/
2013-02-22-Gini.html
165 lines (115 loc) · 4.6 KB
/
2013-02-22-Gini.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>2013-02-22-Gini</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<meta name="title" content="2013-02-22-Gini"/>
<meta name="generator" content="Org-mode"/>
<meta name="generated" content="2013-02-23 16:11:38 PST"/>
<meta name="author" content="Jim Blomo"/>
<meta name="description" content=""/>
<meta name="keywords" content=""/>
<link rel="stylesheet" type="text/css" href="production/common.css" />
<link rel="stylesheet" type="text/css" href="production/screen.css" media="screen" />
<link rel="stylesheet" type="text/css" href="production/projection.css" media="projection" />
<link rel="stylesheet" type="text/css" href="production/color-blue.css" media="projection" />
<link rel="stylesheet" type="text/css" href="production/presenter.css" media="presenter" />
<link href='http://fonts.googleapis.com/css?family=Lobster+Two:700|Yanone+Kaffeesatz:700|Open+Sans' rel='stylesheet' type='text/css'>
</head>
<body>
<div id="preamble">
</div>
<div id="content">
<h1 class="title">2013-02-22-Gini</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#sec-1">1 HW: Gini</a></li>
<li><a href="#sec-2">2 Gini Index</a></li>
<li><a href="#sec-3">3 Data: Campaign Contributions</a></li>
<li><a href="#sec-4">4 Extra Credit</a></li>
<li><a href="#sec-5">5 Python Tips</a></li>
<li><a href="#sec-6">6 Git Tips</a></li>
</ul>
</div>
</div>
<div id="outline-container-1" class="outline-2">
<h2 id="sec-1"><span class="section-number-2">1</span> HW: Gini <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-1">
<ul>
<li>Calculate Gini Index
</li>
</ul>
</div>
</div>
<div id="outline-container-2" class="outline-2">
<h2 id="sec-2"><span class="section-number-2">2</span> Gini Index <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-2">
<pre class="src src-python">Gini(D) = 1 - <span style="color: #7a378b;">sum</span>(frac**2 <span style="color: #a020f0;">for</span> frac <span style="color: #a020f0;">in</span> classes)
</pre>
<p>
Sum of the squares of the fraction of items in each class
</p>
</div>
</div>
<div id="outline-container-3" class="outline-2">
<h2 id="sec-3"><span class="section-number-2">3</span> Data: Campaign Contributions <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-3">
<ul>
<li>Calculating the Gini Index for the Candidate Names for the enitre data set
</li>
<li>Partition by zip code, calculate the weighted average Gini Index score over
all partitions
</li>
<li>Partitions are weighted by the number of records they contain divided by the
total number of records in the data set
</li>
</ul>
</div>
</div>
<div id="outline-container-4" class="outline-2">
<h2 id="sec-4"><span class="section-number-2">4</span> Extra Credit <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-4">
<ul>
<li>Find a best split of a continuous field
</li>
</ul>
</div>
</div>
<div id="outline-container-5" class="outline-2">
<h2 id="sec-5"><span class="section-number-2">5</span> Python Tips <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-5">
<ul>
<li><a href="http://docs.python.org/2/library/collections.html">collections</a>
</li>
<li><code>defaultdict</code> autovivifies keys
</li>
<li><code>Counter</code> autovivifies integer keys
</li>
</ul>
<pre class="src src-python"><span style="color: #a0522d;">zipcodes</span> = defaultdict(Counter)
</pre>
</div>
</div>
<div id="outline-container-6" class="outline-2">
<h2 id="sec-6"><span class="section-number-2">6</span> Git Tips <span class="tag"><span class="slide">slide</span></span></h2>
<div class="outline-text-2" id="text-6">
<pre class="src src-bash">$ git checkout master
$ git pull jblomo master
$ git checkout -b hw-gini
</pre>
<script type="text/javascript" src="production/org-html-slideshow.js"></script>
</div>
</div>
</div>
<div id="postamble">
<p class="date">Date: 2013-02-23 16:11:38 PST</p>
<p class="author">Author: Jim Blomo</p>
<p class="creator">Org version 7.8.02 with Emacs version 23</p>
<a href="http://validator.w3.org/check?uri=referer">Validate XHTML 1.0</a>
</div>
</body>
</html>