赞
踩
人工智能AI:Keras PyTorch MXNet TensorFlow PaddlePaddle 深度学习实战(不定时更新)
泰坦尼克号沉没是历史上最臭名昭着的沉船之一。1912年4月15日,在她的处女航中,泰坦尼克号在与冰山相撞后沉没,在2224名乘客和机组人员中造成1502人死亡。这场耸人听闻的悲剧震惊了国际社会,并为船舶制定了更好的安全规定。 造成海难失事的原因之一是乘客和机组人员没有足够的救生艇。尽管幸存下沉有一些运气因素,但有些人比其他人更容易生存,例如妇女,儿童和上流社会。 在这个案例中,我们要求您完成对哪些人可能存活的分析。特别是,我们要求您运用机器学习工具来预测哪些乘客幸免于悲剧。
我们提取到的数据集中的特征包括票的类别,是否存活,乘坐班次,年龄,登陆home.dest,房间,船和性别等。
数据:http://biostat.mc.vanderbilt.edu/wiki/pub/Main/DataSets/titanic.txt
经过观察数据得到:
1 乘坐班是指乘客班(1,2,3),是社会经济阶层的代表。
2 其中age数据存在缺失。
- import pandas as pd
- import numpy as np
- from sklearn.feature_extraction import DictVectorizer
- from sklearn.model_selection import train_test_split
- from sklearn.tree import DecisionTreeClassifier, export_graphviz
- # 1、获取数据
- titan = pd.read_csv("http://biostat.mc.vanderbilt.edu/wiki/pub/Main/DataSets/titanic.txt")
2.数据基本处理
- x = titan[["pclass", "age", "sex"]]
- y = titan["survived"]
- # 缺失值需要处理,将特征当中有类别的这些特征进行字典特征抽取
- x['age'].fillna(x['age'].mean(), inplace=True)
x_train, x_test, y_train, y_test = train_test_split(x, y, random_state=22)
3.特征工程(字典特征抽取)
特征中出现类别符号,需要进行one-hot编码处理(DictVectorizer)
x.to_dict(orient="records") 需要将数组特征转换成字典数据
- # 对于x转换成字典数据x.to_dict(orient="records")
- # [{"pclass": "1st", "age": 29.00, "sex": "female"}, {}]
-
- transfer = DictVectorizer(sparse=False)
-
- x_train = transfer.fit_transform(x_train.to_dict(orient="records"))
- x_test = transfer.fit_transform(x_test.to_dict(orient="records"))
决策树API当中,如果没有指定max_depth那么会根据信息熵的条件直到最终结束。这里我们可以指定树的深度来进行限制树的大小
- # 4.机器学习(决策树)
- estimator = DecisionTreeClassifier(criterion="entropy", max_depth=5)
- estimator.fit(x_train, y_train)
-
- # 5.模型评估
- estimator.score(x_test, y_test)
-
- estimator.predict(x_test)
决策树的结构是可以直接显示
export_graphviz(estimator, out_file="./data/tree.dot", feature_names=['age', 'pclass=1st', 'pclass=2nd', 'pclass=3rd', '女性', '男性'])
dot文件当中的内容如下
- digraph Tree {
- node [shape=box] ;
- 0 [label="petal length (cm) <= 2.45\nentropy = 1.584\nsamples = 112\nvalue = [39, 37, 36]"] ;
- 1 [label="entropy = 0.0\nsamples = 39\nvalue = [39, 0, 0]"] ;
- 0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="True"] ;
- 2 [label="petal width (cm) <= 1.75\nentropy = 1.0\nsamples = 73\nvalue = [0, 37, 36]"] ;
- 0 -> 2 [labeldistance=2.5, labelangle=-45, headlabel="False"] ;
- 3 [label="petal length (cm) <= 5.05\nentropy = 0.391\nsamples = 39\nvalue = [0, 36, 3]"] ;
- 2 -> 3 ;
- 4 [label="sepal length (cm) <= 4.95\nentropy = 0.183\nsamples = 36\nvalue = [0, 35, 1]"] ;
- 3 -> 4 ;
- 5 [label="petal length (cm) <= 3.9\nentropy = 1.0\nsamples = 2\nvalue = [0, 1, 1]"] ;
- 4 -> 5 ;
- 6 [label="entropy = 0.0\nsamples = 1\nvalue = [0, 1, 0]"] ;
- 5 -> 6 ;
- 7 [label="entropy = 0.0\nsamples = 1\nvalue = [0, 0, 1]"] ;
- 5 -> 7 ;
- 8 [label="entropy = 0.0\nsamples = 34\nvalue = [0, 34, 0]"] ;
- 4 -> 8 ;
- 9 [label="petal width (cm) <= 1.55\nentropy = 0.918\nsamples = 3\nvalue = [0, 1, 2]"] ;
- 3 -> 9 ;
- 10 [label="entropy = 0.0\nsamples = 2\nvalue = [0, 0, 2]"] ;
- 9 -> 10 ;
- 11 [label="entropy = 0.0\nsamples = 1\nvalue = [0, 1, 0]"] ;
- 9 -> 11 ;
- 12 [label="petal length (cm) <= 4.85\nentropy = 0.191\nsamples = 34\nvalue = [0, 1, 33]"] ;
- 2 -> 12 ;
- 13 [label="entropy = 0.0\nsamples = 1\nvalue = [0, 1, 0]"] ;
- 12 -> 13 ;
- 14 [label="entropy = 0.0\nsamples = 33\nvalue = [0, 0, 33]"] ;
- 12 -> 14 ;
- }
那么这个结构不能看清结构,所以可以在一个网站上显示
注:企业重要决策,由于决策树很好的分析能力,在决策过程应用较多, 可以选择特征
In [1]:
# 1.获取数据
# 2.数据基本处理
# 2.1 确定特征值,目标值
# 2.2 缺失值处理
# 2.3 数据集划分
# 3.特征工程(字典特征抽取)
# 4.机器学习(决策树)
# 5.模型评估
In [2]:
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn.feature_extraction import DictVectorizer
from sklearn.tree import DecisionTreeClassifier, export_graphviz
In [3]:
# 1.获取数据
titan = pd.read_csv("http://biostat.mc.vanderbilt.edu/wiki/pub/Main/DataSets/titanic.txt")
In [4]:
titan
Out[4]:
row.names | pclass | survived | name | age | embarked | home.dest | room | ticket | boat | sex | |
---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 1st | 1 | Allen, Miss Elisabeth Walton | 29.0000 | Southampton | St Louis, MO | B-5 | 24160 L221 | 2 | female |
1 | 2 | 1st | 0 | Allison, Miss Helen Loraine | 2.0000 | Southampton | Montreal, PQ / Chesterville, ON | C26 | NaN | NaN | female |
2 | 3 | 1st | 0 | Allison, Mr Hudson Joshua Creighton | 30.0000 | Southampton | Montreal, PQ / Chesterville, ON | C26 | NaN | (135) | male |
3 | 4 | 1st | 0 | Allison, Mrs Hudson J.C. (Bessie Waldo Daniels) | 25.0000 | Southampton | Montreal, PQ / Chesterville, ON | C26 | NaN | NaN | female |
4 | 5 | 1st | 1 | Allison, Master Hudson Trevor | 0.9167 | Southampton | Montreal, PQ / Chesterville, ON | C22 | NaN | 11 | male |
5 | 6 | 1st | 1 | Anderson, Mr Harry | 47.0000 | Southampton | New York, NY | E-12 | NaN | 3 | male |
6 | 7 | 1st | 1 | Andrews, Miss Kornelia Theodosia | 63.0000 | Southampton | Hudson, NY | D-7 | 13502 L77 | 10 | female |
7 | 8 | 1st | 0 | Andrews, Mr Thomas, jr | 39.0000 | Southampton | Belfast, NI | A-36 | NaN | NaN | male |
8 | 9 | 1st | 1 | Appleton, Mrs Edward Dale (Charlotte Lamson) | 58.0000 | Southampton | Bayside, Queens, NY | C-101 | NaN | 2 | female |
9 | 10 | 1st | 0 | Artagaveytia, Mr Ramon | 71.0000 | Cherbourg | Montevideo, Uruguay | NaN | NaN | (22) | male |
10 | 11 | 1st | 0 | Astor, Colonel John Jacob | 47.0000 | Cherbourg | New York, NY | NaN | 17754 L224 10s 6d | (124) | male |
11 | 12 | 1st | 1 | Astor, Mrs John Jacob (Madeleine Talmadge Force) | 19.0000 | Cherbourg | New York, NY | NaN | 17754 L224 10s 6d | 4 | female |
12 | 13 | 1st | 1 | Aubert, Mrs Leontine Pauline | NaN | Cherbourg | Paris, France | B-35 | 17477 L69 6s | 9 | female |
13 | 14 | 1st | 1 | Barkworth, Mr Algernon H. | NaN | Southampton | Hessle, Yorks | A-23 | NaN | B | male |
14 | 15 | 1st | 0 | Baumann, Mr John D. | NaN | Southampton | New York, NY | NaN | NaN | NaN | male |
15 | 16 | 1st | 1 | Baxter, Mrs James (Helene DeLaudeniere Chaput) | 50.0000 | Cherbourg | Montreal, PQ | B-58/60 | NaN | 6 | female |
16 | 17 | 1st | 0 | Baxter, Mr Quigg Edmond | 24.0000 | Cherbourg | Montreal, PQ | B-58/60 | NaN | NaN | male |
17 | 18 | 1st | 0 | Beattie, Mr Thomson | 36.0000 | Cherbourg | Winnipeg, MN | C-6 | NaN | NaN | male |
18 | 19 | 1st | 1 | Beckwith, Mr Richard Leonard | 37.0000 | Southampton | New York, NY | D-35 | NaN | 5 | male |
19 | 20 | 1st | 1 | Beckwith, Mrs Richard Leonard (Sallie Monypeny) | 47.0000 | Southampton | New York, NY | D-35 | NaN | 5 | female |
20 | 21 | 1st | 1 | Behr, Mr Karl Howell | 26.0000 | Cherbourg | New York, NY | C-148 | NaN | 5 | male |
21 | 22 | 1st | 0 | Birnbaum, Mr Jakob | 25.0000 | Cherbourg | San Francisco, CA | NaN | NaN | (148) | male |
22 | 23 | 1st | 1 | Bishop, Mr Dickinson H. | 25.0000 | Cherbourg | Dowagiac, MI | B-49 | NaN | 7 | male |
23 | 24 | 1st | 1 | Bishop, Mrs Dickinson H. (Helen Walton) | 19.0000 | Cherbourg | Dowagiac, MI | B-49 | NaN | 7 | female |
24 | 25 | 1st | 1 | Bjornstrm-Steffansson, Mr Mauritz Hakan | 28.0000 | Southampton | Stockholm, Sweden / Washington, DC | NaN | D | male | |
25 | 26 | 1st | 0 | Blackwell, Mr Stephen Weart | 45.0000 | Southampton | Trenton, NJ | NaN | NaN | (241) | male |
26 | 27 | 1st | 1 | Blank, Mr Henry | 39.0000 | Cherbourg | Glen Ridge, NJ | A-31 | NaN | 7 | male |
27 | 28 | 1st | 1 | Bonnell, Miss Caroline | 30.0000 | Southampton | Youngstown, OH | C-7 | NaN | 8 | female |
28 | 29 | 1st | 1 | Bonnell, Miss Elizabeth | 58.0000 | Southampton | Birkdale, England Cleveland, Ohio | C-103 | NaN | 8 | female |
29 | 30 | 1st | 0 | Borebank, Mr John James | NaN | Southampton | London / Winnipeg, MB | D-21/2 | NaN | NaN | male |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
1283 | 1284 | 3rd | 0 | Vestrom, Miss Hulda Amanda Adolfina | NaN | NaN | NaN | NaN | NaN | NaN | female |
1284 | 1285 | 3rd | 0 | Vonk, Mr Jenko | NaN | NaN | NaN | NaN | NaN | NaN | male |
1285 | 1286 | 3rd | 0 | Ware, Mr Frederick | NaN | NaN | NaN | NaN | NaN | NaN | male |
1286 | 1287 | 3rd | 0 | Warren, Mr Charles William | NaN | NaN | NaN | NaN | NaN | NaN | male |
1287 | 1288 | 3rd | 0 | Wazli, Mr Yousif | NaN | NaN | NaN | NaN | NaN | NaN | male |
1288 | 1289 | 3rd | 0 | Webber, Mr James | NaN | NaN | NaN | NaN | NaN | NaN | male |
1289 | 1290 | 3rd | 1 | Wennerstrom, Mr August Edvard | NaN | NaN | NaN | NaN | NaN | NaN | male |
1290 | 1291 | 3rd | 0 | Wenzel, Mr Linhart | NaN | NaN | NaN | NaN | NaN | NaN | male |
1291 | 1292 | 3rd | 0 | Widegren, Mr Charles Peter | NaN | NaN | NaN | NaN | NaN | NaN | male |
1292 | 1293 | 3rd | 0 | Wiklund, Mr Jacob Alfred | NaN | NaN | NaN | NaN | NaN | NaN | male |
1293 | 1294 | 3rd | 1 | Wilkes, Mrs Ellen | NaN | NaN | NaN | NaN | NaN | NaN | female |
1294 | 1295 | 3rd | 0 | Willer, Mr Aaron | NaN | NaN | NaN | NaN | NaN | NaN | male |
1295 | 1296 | 3rd | 0 | Willey, Mr Edward | NaN | NaN | NaN | NaN | NaN | NaN | male |
1296 | 1297 | 3rd | 0 | Williams, Mr Howard Hugh | NaN | NaN | NaN | NaN | NaN | NaN | male |
1297 | 1298 | 3rd | 0 | Williams, Mr Leslie | NaN | NaN | NaN | NaN | NaN | NaN | male |
1298 | 1299 | 3rd | 0 | Windelov, Mr Einar | NaN | NaN | NaN | NaN | NaN | NaN | male |
1299 | 1300 | 3rd | 0 | Wirz, Mr Albert | NaN | NaN | NaN | NaN | NaN | NaN | male |
1300 | 1301 | 3rd | 0 | Wiseman, Mr Phillippe | NaN | NaN | NaN | NaN | NaN | NaN | male |
1301 | 1302 | 3rd | 0 | Wittevrongel, Mr Camiel | NaN | NaN | NaN | NaN | NaN | NaN | male |
1302 | 1303 | 3rd | 1 | Yalsevac, Mr Ivan | NaN | NaN | NaN | NaN | NaN | NaN | male |
1303 | 1304 | 3rd | 0 | Yasbeck, Mr Antoni | NaN | NaN | NaN | NaN | NaN | NaN | male |
1304 | 1305 | 3rd | 1 | Yasbeck, Mrs Antoni | NaN | NaN | NaN | NaN | NaN | NaN | female |
1305 | 1306 | 3rd | 0 | Youssef, Mr Gerios | NaN | NaN | NaN | NaN | NaN | NaN | male |
1306 | 1307 | 3rd | 0 | Zabour, Miss Hileni | NaN | NaN | NaN | NaN | NaN | NaN | female |
1307 | 1308 | 3rd | 0 | Zabour, Miss Tamini | NaN | NaN | NaN | NaN | NaN | NaN | female |
1308 | 1309 | 3rd | 0 | Zakarian, Mr Artun | NaN | NaN | NaN | NaN | NaN | NaN | male |
1309 | 1310 | 3rd | 0 | Zakarian, Mr Maprieder | NaN | NaN | NaN | NaN | NaN | NaN | male |
1310 | 1311 | 3rd | 0 | Zenn, Mr Philip | NaN | NaN | NaN | NaN | NaN | NaN | male |
1311 | 1312 | 3rd | 0 | Zievens, Rene | NaN | NaN | NaN | NaN | NaN | NaN | female |
1312 | 1313 | 3rd | 0 | Zimmerman, Leo | NaN | NaN | NaN | NaN | NaN | NaN | male |
1313 rows × 11 columns
In [5]:
titan.describe()
Out[5]:
row.names | survived | age | |
---|---|---|---|
count | 1313.000000 | 1313.000000 | 633.000000 |
mean | 657.000000 | 0.341965 | 31.194181 |
std | 379.174762 | 0.474549 | 14.747525 |
min | 1.000000 | 0.000000 | 0.166700 |
25% | 329.000000 | 0.000000 | 21.000000 |
50% | 657.000000 | 0.000000 | 30.000000 |
75% | 985.000000 | 1.000000 | 41.000000 |
max | 1313.000000 | 1.000000 | 71.000000 |
In [6]:
# 2.数据基本处理
# 2.1 确定特征值,目标值
x = titan[["pclass", "age", "sex"]]
y = titan["survived"]
In [7]:
x.head()
Out[7]:
pclass | age | sex | |
---|---|---|---|
0 | 1st | 29.0000 | female |
1 | 1st | 2.0000 | female |
2 | 1st | 30.0000 | male |
3 | 1st | 25.0000 | female |
4 | 1st | 0.9167 | male |
In [8]:
y.head()
Out[8]:
- 0 1
- 1 0
- 2 0
- 3 0
- 4 1
- Name: survived, dtype: int64
In [9]:
# 2.2 缺失值处理
x['age'].fillna(value=titan["age"].mean(), inplace=True)
In [10]:
x.head()
Out[10]:
pclass | age | sex | |
---|---|---|---|
0 | 1st | 29.0000 | female |
1 | 1st | 2.0000 | female |
2 | 1st | 30.0000 | male |
3 | 1st | 25.0000 | female |
4 | 1st | 0.9167 | male |
In [11]:
# 2.3 数据集划分
x_train, x_test, y_train, y_test = train_test_split(x, y, random_state=22, test_size=0.2)
In [12]:
# 3.特征工程(字典特征抽取)
In [13]:
x_train.head()
Out[13]:
pclass | age | sex | |
---|---|---|---|
649 | 3rd | 45.000000 | female |
1078 | 3rd | 31.194181 | male |
59 | 1st | 31.194181 | female |
201 | 1st | 18.000000 | male |
61 | 1st | 31.194181 | female |
In [14]:
x_train = x_train.to_dict(orient="records")
x_test = x_test.to_dict(orient="records")
In [15]:
x_train
Out[15]:
[{'pclass': '3rd', 'age': 45.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 18.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 6.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 27.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 21.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 4.0, 'sex': 'female'}, {'pclass': '1st', 'age': 31.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 13.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 30.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 30.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 50.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 22.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 26.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 49.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 62.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 32.0, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 64.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 23.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 55.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 24.0, 'sex': 'male'}, {'pclass': '1st', 'age': 6.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 10.0, 'sex': 'female'}, {'pclass': '1st', 'age': 53.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 18.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 36.0, 'sex': 'female'}, {'pclass': '1st', 'age': 19.0, 'sex': 'male'}, {'pclass': '1st', 'age': 28.0, 'sex': 'male'}, {'pclass': '1st', 'age': 17.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 21.0, 'sex': 'female'}, {'pclass': '1st', 'age': 25.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 19.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 26.0, 'sex': 'male'}, {'pclass': '1st', 'age': 21.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 48.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 27.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 46.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 26.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 29.0, 'sex': 'female'}, {'pclass': '1st', 'age': 35.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 38.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 32.0, 'sex': 'male'}, {'pclass': '1st', 'age': 16.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 30.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 18.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 16.0, 'sex': 'male'}, {'pclass': '1st', 'age': 33.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 17.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 18.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 36.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 30.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 20.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 33.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 52.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 35.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 25.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 45.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 50.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 52.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 20.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 32.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 34.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 33.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 21.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 45.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 43.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 59.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 47.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 38.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 51.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 36.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 23.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 6.0, 'sex': 'female'}, {'pclass': '1st', 'age': 58.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 4.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 20.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 35.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 12.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 19.0, 'sex': 'male'}, {'pclass': '1st', 'age': 64.0, 'sex': 'male'}, {'pclass': '1st', 'age': 27.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 34.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 18.0, 'sex': 'male'}, {'pclass': '1st', 'age': 48.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 50.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 18.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 34.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 21.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 44.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 19.0, 'sex': 'male'}, {'pclass': '1st', 'age': 39.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 42.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 69.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 2.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 22.0, 'sex': 'male'}, {'pclass': '1st', 'age': 47.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 22.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 42.0, 'sex': 'male'}, {'pclass': '1st', 'age': 21.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 48.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 45.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 45.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 39.0, 'sex': 'male'}, {'pclass': '1st', 'age': 14.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 30.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 32.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 54.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 36.0, 'sex': 'female'}, {'pclass': '1st', 'age': 47.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 0.8333, 'sex': 'male'}, {'pclass': '1st', 'age': 53.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 24.0, 'sex': 'female'}, {'pclass': '1st', 'age': 37.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 25.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 23.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 40.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 20.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 26.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 23.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 22.0, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 29.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 30.0, 'sex': 'male'}, {'pclass': '1st', 'age': 55.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 26.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 30.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 49.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 18.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 24.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 22.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 54.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 38.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 42.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 52.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 19.0, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 8.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 57.0, 'sex': 'male'}, {'pclass': '1st', 'age': 22.0, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 16.0, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 45.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 28.0, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 30.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 19.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 28.0, 'sex': 'male'}, {'pclass': '1st', 'age': 24.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 38.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 36.0, 'sex': 'female'}, {'pclass': '1st', 'age': 55.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 25.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 32.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 9.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 30.0, 'sex': 'male'}, {'pclass': '1st', 'age': 29.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 40.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 39.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 25.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 26.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 49.0, 'sex': 'male'}, {'pclass': '1st', 'age': 36.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 23.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 23.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 26.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 20.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 17.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 24.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 28.0, 'sex': 'male'}, {'pclass': '1st', 'age': 40.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 6.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 17.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 34.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 30.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 41.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 28.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 61.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 17.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 3.0, 'sex': 'male'}, {'pclass': '1st', 'age': 24.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 30.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 41.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 42.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 28.0, 'sex': 'male'}, {'pclass': '1st', 'age': 48.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 50.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 16.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 40.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 30.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 23.0, 'sex': 'female'}, {'pclass': '1st', 'age': 34.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 39.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 34.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 22.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 9.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 22.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 30.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 25.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 24.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 26.0, 'sex': 'female'}, {'pclass': '1st', 'age': 57.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 39.0, 'sex': 'male'}, {'pclass': '1st', 'age': 35.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 41.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 67.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 11.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 22.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 20.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 50.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 26.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 33.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 36.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 48.0, 'sex': 'female'}, {'pclass': '1st', 'age': 59.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 25.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 17.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 45.0, 'sex': 'female'}, {'pclass': '1st', 'age': 49.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 33.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 46.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 52.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 36.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 28.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 28.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 30.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 19.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 43.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 36.0, 'sex': 'male'}, {'pclass': '1st', 'age': 51.0, 'sex': 'male'}, {'pclass': '1st', 'age': 36.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 3.0, 'sex': 'male'}, {'pclass': '1st', 'age': 48.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 48.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 16.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 26.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 36.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 44.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 36.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 37.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 30.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 32.0, 'sex': 'male'}, {'pclass': '1st', 'age': 30.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 22.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 40.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 24.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 65.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 26.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 30.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 37.0, 'sex': 'female'}, {'pclass': '1st', 'age': 52.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 23.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 0.8333, 'sex': 'male'}, {'pclass': '2nd', 'age': 35.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 26.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 27.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 27.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 41.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 18.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 33.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 56.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 40.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 9.0, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 28.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 26.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 30.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 25.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 48.0, 'sex': 'female'}, {'pclass': '1st', 'age': 36.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 35.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 1.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 2.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 32.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 25.0, 'sex': 'male'}, {'pclass': '1st', 'age': 29.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 21.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 20.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 27.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 38.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 28.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 0.9167, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 39.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 9.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 45.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 20.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 36.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 14.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 30.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 22.0, 'sex': 'male'}, {'pclass': '1st', 'age': 60.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 20.0, 'sex': 'male'}, {'pclass': '1st', 'age': 48.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 28.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 23.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 32.0, 'sex': 'male'}, {'pclass': '1st', 'age': 30.0, 'sex': 'male'}, {'pclass': '1st', 'age': 46.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 32.0, 'sex': 'male'}, {'pclass': '1st', 'age': 27.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 61.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 39.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 0.1667, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 15.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 18.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 24.0, 'sex': 'male'}, {'pclass': '1st', 'age': 17.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 42.0, 'sex': 'female'}, {'pclass': '1st', 'age': 20.0, 'sex': 'female'}, {'pclass': '1st', 'age': 62.0, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 49.0, 'sex': 'male'}, {'pclass': '1st', 'age': 23.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 33.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 19.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 45.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 70.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 37.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 28.0, 'sex': 'male'}, {'pclass': '1st', 'age': 54.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 51.0, 'sex': 'female'}, {'pclass': '1st', 'age': 21.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 64.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 29.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 33.0, 'sex': 'male'}, {'pclass': '1st', 'age': 50.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 19.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 59.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 18.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 49.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 38.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 48.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 54.0, 'sex': 'female'}, {'pclass': '1st', 'age': 19.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 3.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 18.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 22.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 34.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 28.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 20.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 15.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 40.0, 'sex': 'female'}, {'pclass': '1st', 'age': 46.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 8.0, 'sex': 'female'}, {'pclass': '1st', 'age': 63.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 43.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 16.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 38.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 1.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 35.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.0, 'sex': 'male'}, {'pclass': '1st', 'age': 42.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 38.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 17.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 40.0, 'sex': 'male'}, {'pclass': '1st', 'age': 4.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 29.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 22.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 57.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 40.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 47.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 37.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 42.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 21.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 20.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 5.0, 'sex': 'female'}, {'pclass': '1st', 'age': 21.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 40.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 9.0, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 41.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 36.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 28.0, 'sex': 'male'}, {'pclass': '1st', 'age': 39.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 35.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 24.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 45.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 24.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 50.0, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 56.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 32.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 19.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 18.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 20.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 45.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 22.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 20.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 50.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 30.0, 'sex': 'male'}, {'pclass': '1st', 'age': 24.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 40.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 21.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 52.0, 'sex': 'male'}, {'pclass': '1st', 'age': 45.0, 'sex': 'male'}, {'pclass': '1st', 'age': 11.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 23.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 26.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 40.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 49.0, 'sex': 'male'}, {'pclass': '1st', 'age': 18.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 18.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 9.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 25.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 35.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 32.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 21.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 32.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 45.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 30.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 26.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 30.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 21.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 25.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 20.0, 'sex': 'male'}, {'pclass': '1st', 'age': 36.0, 'sex': 'male'}, {'pclass': '1st', 'age': 27.0, 'sex': 'male'}, {'pclass': '1st', 'age': 24.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 18.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 56.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 16.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 18.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 64.0, 'sex': 'male'}, {'pclass': '1st', 'age': 46.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 18.0, 'sex': 'male'}, {'pclass': '1st', 'age': 46.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 29.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 18.0, 'sex': 'female'}, {'pclass': '1st', 'age': 33.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 34.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 0.8333, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 58.0, 'sex': 'female'}, {'pclass': '1st', 'age': 60.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 23.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 44.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 71.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 13.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 58.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 4.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 16.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 33.0, 'sex': 'female'}, {'pclass': '1st', 'age': 33.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 48.0, 'sex': 'male'}, {'pclass': '1st', 'age': 28.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 55.0, 'sex': 'female'}, {'pclass': '1st', 'age': 54.0, 'sex': 'male'}, {'pclass': '1st', 'age': 71.0, 'sex': 'male'}, {'pclass': '1st', 'age': 47.0, 'sex': 'female'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 21.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 21.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 24.0, 'sex': 'male'}, {'pclass': '1st', 'age': 23.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 18.0, 'sex': 'female'}, {'pclass': '1st', 'age': 54.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 17.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 6.0, 'sex': 'male'}, {'pclass': '1st', 'age': 45.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 36.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 55.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 26.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '1st', 'age': 65.0, 'sex': 'male'}, {'pclass': '1st', 'age': 27.0, 'sex': 'male'}, {'pclass': '1st', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 22.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '2nd', 'age': 7.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 30.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 39.0, 'sex': 'female'}, {'pclass': '1st', 'age': 19.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 19.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 20.0, 'sex': 'male'}, {'pclass': '1st', 'age': 56.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 38.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 23.0, 'sex': 'female'}, {'pclass': '2nd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 42.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 23.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 25.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '2nd', 'age': 16.0, 'sex': 'male'}, {'pclass': '2nd', 'age': 42.0, 'sex': 'male'}, {'pclass': '3rd', 'age': 2.0, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'female'}, {'pclass': '3rd', 'age': 31.19418104265403, 'sex': 'male'}, {'pclass': '1st', 'age': 36.0, 'sex': 'male'}, ...]
In [16]:
transfer = DictVectorizer()
x_train = transfer.fit_transform(x_train)
x_test = transfer.fit_transform(x_test)
In [17]:
x_test
Out[17]:
- <263x6 sparse matrix of type '<class 'numpy.float64'>'
- with 789 stored elements in Compressed Sparse Row format>
In [18]:
# 4.机器学习(决策树)
estimator = DecisionTreeClassifier(max_depth=15)
estimator.fit(x_train, y_train)
Out[18]:
- DecisionTreeClassifier(ccp_alpha=0.0, class_weight=None, criterion='gini',
- max_depth=15, max_features=None, max_leaf_nodes=None,
- min_impurity_decrease=0.0, min_impurity_split=None,
- min_samples_leaf=1, min_samples_split=2,
- min_weight_fraction_leaf=0.0, presort='deprecated',
- random_state=None, splitter='best')
In [19]:
# 5.模型评估
y_pre = estimator.predict(x_test)
In [20]:
y_pre
Out[20]:
- array([0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
- 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,
- 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1,
- 1, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1])
In [21]:
ret = estimator.score(x_test, y_test)
print(ret)
0.779467680608365
In [22]:
export_graphviz(estimator, out_file="./data/tree.dot", feature_names=['age', 'pclass=1st', 'pclass=2nd', 'pclass=3rd', '女性', '男性'])
In [23]:
# 实例化一个随机森林
from sklearn.ensemble import RandomForestClassifier
rf = RandomForestClassifier()
In [26]:
# 通过超参数调优
from sklearn.model_selection import GridSearchCV
param = {"n_estimators":[100, 120, 300], "max_depth":[3, 7, 11]}
gc = GridSearchCV(rf, param_grid=param, cv=3)
gc.fit(x_train, y_train)
Out[26]:
GridSearchCV(cv=3, error_score=nan, estimator=RandomForestClassifier(bootstrap=True, ccp_alpha=0.0, class_weight=None, criterion='gini', max_depth=None, max_features='auto', max_leaf_nodes=None, max_samples=None, min_impurity_decrease=0.0, min_impurity_split=None, min_samples_leaf=1, min_samples_split=2, min_weight_fraction_leaf=0.0, n_estimators=100, n_jobs=None, oob_score=False, random_state=None, verbose=0, warm_start=False), iid='deprecated', n_jobs=None, param_grid={'max_depth': [3, 7, 11], 'n_estimators': [100, 120, 300]}, pre_dispatch='2*n_jobs', refit=True, return_train_score=False, scoring=None, verbose=0)
In [27]:
print("随机森林预测结果是:\n", gc.score(x_test, y_test))
- 随机森林预测结果是:
- 0.779467680608365
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。