|
21 | 21 | "metadata": {}, |
22 | 22 | "outputs": [], |
23 | 23 | "source": [ |
24 | | - "data = pd.read_csv(\"../data/adult-data.csv\", names=['age', 'workclass', 'fnlwgt', 'education-num',\n", |
| 24 | + "data = pd.read_csv(\"data/adult-data.csv\", names=['age', 'workclass', 'education-num',\n", |
25 | 25 | " 'occupation', 'capital-gain', 'capital-loss',\n", |
26 | 26 | " 'hours-per-week', 'income'])" |
27 | 27 | ] |
|
56 | 56 | " <th></th>\n", |
57 | 57 | " <th>age</th>\n", |
58 | 58 | " <th>workclass</th>\n", |
59 | | - " <th>fnlwgt</th>\n", |
60 | 59 | " <th>education-num</th>\n", |
61 | 60 | " <th>occupation</th>\n", |
62 | 61 | " <th>capital-gain</th>\n", |
|
70 | 69 | " <th>0</th>\n", |
71 | 70 | " <td>39</td>\n", |
72 | 71 | " <td>State-gov</td>\n", |
73 | | - " <td>77516</td>\n", |
74 | 72 | " <td>13</td>\n", |
75 | 73 | " <td>Adm-clerical</td>\n", |
76 | 74 | " <td>2174</td>\n", |
|
82 | 80 | " <th>1</th>\n", |
83 | 81 | " <td>50</td>\n", |
84 | 82 | " <td>Self-emp-not-inc</td>\n", |
85 | | - " <td>83311</td>\n", |
86 | 83 | " <td>13</td>\n", |
87 | 84 | " <td>Exec-managerial</td>\n", |
88 | 85 | " <td>0</td>\n", |
|
94 | 91 | " <th>2</th>\n", |
95 | 92 | " <td>38</td>\n", |
96 | 93 | " <td>Private</td>\n", |
97 | | - " <td>215646</td>\n", |
98 | 94 | " <td>9</td>\n", |
99 | 95 | " <td>Handlers-cleaners</td>\n", |
100 | 96 | " <td>0</td>\n", |
|
106 | 102 | " <th>3</th>\n", |
107 | 103 | " <td>53</td>\n", |
108 | 104 | " <td>Private</td>\n", |
109 | | - " <td>234721</td>\n", |
110 | 105 | " <td>7</td>\n", |
111 | 106 | " <td>Handlers-cleaners</td>\n", |
112 | 107 | " <td>0</td>\n", |
|
118 | 113 | " <th>4</th>\n", |
119 | 114 | " <td>28</td>\n", |
120 | 115 | " <td>Private</td>\n", |
121 | | - " <td>338409</td>\n", |
122 | 116 | " <td>13</td>\n", |
123 | 117 | " <td>Prof-specialty</td>\n", |
124 | 118 | " <td>0</td>\n", |
|
131 | 125 | "</div>" |
132 | 126 | ], |
133 | 127 | "text/plain": [ |
134 | | - " age workclass fnlwgt education-num occupation \\\n", |
135 | | - "0 39 State-gov 77516 13 Adm-clerical \n", |
136 | | - "1 50 Self-emp-not-inc 83311 13 Exec-managerial \n", |
137 | | - "2 38 Private 215646 9 Handlers-cleaners \n", |
138 | | - "3 53 Private 234721 7 Handlers-cleaners \n", |
139 | | - "4 28 Private 338409 13 Prof-specialty \n", |
| 128 | + " age workclass education-num occupation capital-gain \\\n", |
| 129 | + "0 39 State-gov 13 Adm-clerical 2174 \n", |
| 130 | + "1 50 Self-emp-not-inc 13 Exec-managerial 0 \n", |
| 131 | + "2 38 Private 9 Handlers-cleaners 0 \n", |
| 132 | + "3 53 Private 7 Handlers-cleaners 0 \n", |
| 133 | + "4 28 Private 13 Prof-specialty 0 \n", |
140 | 134 | "\n", |
141 | | - " capital-gain capital-loss hours-per-week income \n", |
142 | | - "0 2174 0 40 <=50K \n", |
143 | | - "1 0 0 13 <=50K \n", |
144 | | - "2 0 0 40 <=50K \n", |
145 | | - "3 0 0 40 <=50K \n", |
146 | | - "4 0 0 40 <=50K " |
| 135 | + " capital-loss hours-per-week income \n", |
| 136 | + "0 0 40 <=50K \n", |
| 137 | + "1 0 13 <=50K \n", |
| 138 | + "2 0 40 <=50K \n", |
| 139 | + "3 0 40 <=50K \n", |
| 140 | + "4 0 40 <=50K " |
147 | 141 | ] |
148 | 142 | }, |
149 | 143 | "execution_count": 3, |
|
175 | 169 | }, |
176 | 170 | { |
177 | 171 | "cell_type": "code", |
178 | | - "execution_count": 8, |
| 172 | + "execution_count": 6, |
179 | 173 | "metadata": {}, |
180 | 174 | "outputs": [], |
181 | 175 | "source": [ |
|
184 | 178 | }, |
185 | 179 | { |
186 | 180 | "cell_type": "code", |
187 | | - "execution_count": 9, |
| 181 | + "execution_count": 7, |
188 | 182 | "metadata": {}, |
189 | 183 | "outputs": [], |
190 | 184 | "source": [ |
|
198 | 192 | }, |
199 | 193 | { |
200 | 194 | "cell_type": "code", |
201 | | - "execution_count": 10, |
| 195 | + "execution_count": 8, |
202 | 196 | "metadata": {}, |
203 | 197 | "outputs": [], |
204 | 198 | "source": [ |
|
207 | 201 | }, |
208 | 202 | { |
209 | 203 | "cell_type": "code", |
210 | | - "execution_count": 11, |
| 204 | + "execution_count": 9, |
211 | 205 | "metadata": {}, |
212 | 206 | "outputs": [], |
213 | 207 | "source": [ |
|
218 | 212 | }, |
219 | 213 | { |
220 | 214 | "cell_type": "code", |
221 | | - "execution_count": 12, |
| 215 | + "execution_count": 10, |
222 | 216 | "metadata": {}, |
223 | 217 | "outputs": [], |
224 | 218 | "source": [ |
|
228 | 222 | }, |
229 | 223 | { |
230 | 224 | "cell_type": "code", |
231 | | - "execution_count": 13, |
| 225 | + "execution_count": 11, |
232 | 226 | "metadata": {}, |
233 | 227 | "outputs": [], |
234 | 228 | "source": [ |
|
238 | 232 | }, |
239 | 233 | { |
240 | 234 | "cell_type": "code", |
241 | | - "execution_count": 14, |
| 235 | + "execution_count": 12, |
242 | 236 | "metadata": {}, |
243 | 237 | "outputs": [], |
244 | 238 | "source": [ |
|
249 | 243 | }, |
250 | 244 | { |
251 | 245 | "cell_type": "code", |
252 | | - "execution_count": 15, |
| 246 | + "execution_count": 13, |
253 | 247 | "metadata": {}, |
254 | 248 | "outputs": [], |
255 | 249 | "source": [ |
|
258 | 252 | }, |
259 | 253 | { |
260 | 254 | "cell_type": "code", |
261 | | - "execution_count": 16, |
| 255 | + "execution_count": 14, |
262 | 256 | "metadata": {}, |
263 | 257 | "outputs": [ |
264 | 258 | { |
265 | 259 | "name": "stdout", |
266 | 260 | "output_type": "stream", |
267 | 261 | "text": [ |
268 | | - "Accuracy: 83.63%\n" |
| 262 | + "Accuracy: 83.66%\n" |
269 | 263 | ] |
270 | 264 | } |
271 | 265 | ], |
|
276 | 270 | }, |
277 | 271 | { |
278 | 272 | "cell_type": "code", |
279 | | - "execution_count": 17, |
| 273 | + "execution_count": 15, |
280 | 274 | "metadata": {}, |
281 | 275 | "outputs": [], |
282 | 276 | "source": [ |
|
0 commit comments