Skip to content

Commit 4dbb1da

Browse files
committed
Change verbosity paramter and remove fnlwgt column
1 parent 4108fee commit 4dbb1da

File tree

2 files changed

+25
-31
lines changed

2 files changed

+25
-31
lines changed

Chapter 6/Exercise 1 - Install the XGBoost library for Python and use it to perform classification.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@
310310
}
311311
],
312312
"source": [
313-
"param = {'max_depth':6, 'eta':0.1, 'verbosity':4, 'objective':'multi:softmax', 'num_class': 3}\n",
313+
"param = {'max_depth':6, 'eta':0.1, 'silent':1, 'objective':'multi:softmax', 'num_class': 3}\n",
314314
"num_round = 5\n",
315315
"model = xgb.train(param, train, num_round)"
316316
]

Chapter 6/Exercise 3 - Creating a Python script that predicts based on real-time input.ipynb

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"metadata": {},
2222
"outputs": [],
2323
"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",
2525
" 'occupation', 'capital-gain', 'capital-loss',\n",
2626
" 'hours-per-week', 'income'])"
2727
]
@@ -56,7 +56,6 @@
5656
" <th></th>\n",
5757
" <th>age</th>\n",
5858
" <th>workclass</th>\n",
59-
" <th>fnlwgt</th>\n",
6059
" <th>education-num</th>\n",
6160
" <th>occupation</th>\n",
6261
" <th>capital-gain</th>\n",
@@ -70,7 +69,6 @@
7069
" <th>0</th>\n",
7170
" <td>39</td>\n",
7271
" <td>State-gov</td>\n",
73-
" <td>77516</td>\n",
7472
" <td>13</td>\n",
7573
" <td>Adm-clerical</td>\n",
7674
" <td>2174</td>\n",
@@ -82,7 +80,6 @@
8280
" <th>1</th>\n",
8381
" <td>50</td>\n",
8482
" <td>Self-emp-not-inc</td>\n",
85-
" <td>83311</td>\n",
8683
" <td>13</td>\n",
8784
" <td>Exec-managerial</td>\n",
8885
" <td>0</td>\n",
@@ -94,7 +91,6 @@
9491
" <th>2</th>\n",
9592
" <td>38</td>\n",
9693
" <td>Private</td>\n",
97-
" <td>215646</td>\n",
9894
" <td>9</td>\n",
9995
" <td>Handlers-cleaners</td>\n",
10096
" <td>0</td>\n",
@@ -106,7 +102,6 @@
106102
" <th>3</th>\n",
107103
" <td>53</td>\n",
108104
" <td>Private</td>\n",
109-
" <td>234721</td>\n",
110105
" <td>7</td>\n",
111106
" <td>Handlers-cleaners</td>\n",
112107
" <td>0</td>\n",
@@ -118,7 +113,6 @@
118113
" <th>4</th>\n",
119114
" <td>28</td>\n",
120115
" <td>Private</td>\n",
121-
" <td>338409</td>\n",
122116
" <td>13</td>\n",
123117
" <td>Prof-specialty</td>\n",
124118
" <td>0</td>\n",
@@ -131,19 +125,19 @@
131125
"</div>"
132126
],
133127
"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",
140134
"\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 "
147141
]
148142
},
149143
"execution_count": 3,
@@ -175,7 +169,7 @@
175169
},
176170
{
177171
"cell_type": "code",
178-
"execution_count": 8,
172+
"execution_count": 6,
179173
"metadata": {},
180174
"outputs": [],
181175
"source": [
@@ -184,7 +178,7 @@
184178
},
185179
{
186180
"cell_type": "code",
187-
"execution_count": 9,
181+
"execution_count": 7,
188182
"metadata": {},
189183
"outputs": [],
190184
"source": [
@@ -198,7 +192,7 @@
198192
},
199193
{
200194
"cell_type": "code",
201-
"execution_count": 10,
195+
"execution_count": 8,
202196
"metadata": {},
203197
"outputs": [],
204198
"source": [
@@ -207,7 +201,7 @@
207201
},
208202
{
209203
"cell_type": "code",
210-
"execution_count": 11,
204+
"execution_count": 9,
211205
"metadata": {},
212206
"outputs": [],
213207
"source": [
@@ -218,7 +212,7 @@
218212
},
219213
{
220214
"cell_type": "code",
221-
"execution_count": 12,
215+
"execution_count": 10,
222216
"metadata": {},
223217
"outputs": [],
224218
"source": [
@@ -228,7 +222,7 @@
228222
},
229223
{
230224
"cell_type": "code",
231-
"execution_count": 13,
225+
"execution_count": 11,
232226
"metadata": {},
233227
"outputs": [],
234228
"source": [
@@ -238,7 +232,7 @@
238232
},
239233
{
240234
"cell_type": "code",
241-
"execution_count": 14,
235+
"execution_count": 12,
242236
"metadata": {},
243237
"outputs": [],
244238
"source": [
@@ -249,7 +243,7 @@
249243
},
250244
{
251245
"cell_type": "code",
252-
"execution_count": 15,
246+
"execution_count": 13,
253247
"metadata": {},
254248
"outputs": [],
255249
"source": [
@@ -258,14 +252,14 @@
258252
},
259253
{
260254
"cell_type": "code",
261-
"execution_count": 16,
255+
"execution_count": 14,
262256
"metadata": {},
263257
"outputs": [
264258
{
265259
"name": "stdout",
266260
"output_type": "stream",
267261
"text": [
268-
"Accuracy: 83.63%\n"
262+
"Accuracy: 83.66%\n"
269263
]
270264
}
271265
],
@@ -276,7 +270,7 @@
276270
},
277271
{
278272
"cell_type": "code",
279-
"execution_count": 17,
273+
"execution_count": 15,
280274
"metadata": {},
281275
"outputs": [],
282276
"source": [

0 commit comments

Comments
 (0)