-
Notifications
You must be signed in to change notification settings - Fork 0
/
titanic_form.py
106 lines (97 loc) · 2.52 KB
/
titanic_form.py
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
from wtforms import Form, TextField, validators, SubmitField, DecimalField, IntegerField, SelectField
class TitanicForm(Form):
sex = SelectField(
"Sex:",
choices = [
("1", "Male"),
("0", "Female")
],
validators = [
validators.InputRequired()
]
)
title = SelectField(
"Title:",
choices = [
("Mr", "Mr"),
("Miss", "Miss"),
("Mrs", "Mrs"),
("Master", "Master")
],
validators = [
validators.InputRequired()
]
)
age = DecimalField(
"Age:",
default = 30,
places = 0,
validators = [
validators.InputRequired(),
validators.NumberRange(
min = 0.5,
max = 80,
message = "Age must be between 0.5 and 80"
)
]
)
Pclass = SelectField(
"Ticket class:",
choices = [
("1", "First Class"),
("2", "Second Class"),
("3", "Third Class")
],
default = "2",
validators = [
validators.InputRequired()
]
)
ticket_strategy = SelectField(
"How would you buy tickets?",
choices = [
("0", "As cheap as possible"),
("1", "Something decent, average within ticket class"),
("2", "Best possible cabin and deck")
],
default = "1",
validators = [
validators.InputRequired()
]
)
SibSp = IntegerField(
"Number of siblings and/or spouses aboard:",
default = 0,
validators = [
validators.InputRequired(),
validators.NumberRange(
min = 0,
max = 9,
message="Number must be between 0 and 9"
)
]
)
ParCh = IntegerField(
"Number of parents and/or children aboard:",
default = 0,
validators = [
validators.InputRequired(),
validators.NumberRange(
min = 0,
max = 9,
message = "Number must be between 0 and 9"
)
]
)
embarked = SelectField(
"Port of Embarkation:",
choices = [
("S", "Southampton, England"),
("C", "Cherbourg, France"),
("Q", "Queenstown, Ireland")
],
validators = [
validators.InputRequired()
]
)
submit = SubmitField("Predict")