{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"line": {
"color": "blue",
"width": 10
},
"name": "Train",
"type": "scatter",
"x": [
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
],
"y": [
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1"
]
},
{
"line": {
"color": "goldenrod",
"width": 10
},
"name": "Test",
"type": "scatter",
"x": [
0,
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
],
"y": [
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1"
]
},
{
"line": {
"color": "blue",
"width": 10
},
"name": "Train",
"showlegend": false,
"type": "scatter",
"x": [
0,
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,
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
],
"y": [
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2"
]
},
{
"line": {
"color": "goldenrod",
"width": 10
},
"name": "Test",
"showlegend": false,
"type": "scatter",
"x": [
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
],
"y": [
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2"
]
},
{
"line": {
"color": "blue",
"width": 10
},
"name": "Train",
"showlegend": false,
"type": "scatter",
"x": [
0,
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,
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
],
"y": [
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3"
]
},
{
"line": {
"color": "goldenrod",
"width": 10
},
"name": "Test",
"showlegend": false,
"type": "scatter",
"x": [
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
],
"y": [
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3"
]
},
{
"line": {
"color": "blue",
"width": 10
},
"name": "Train",
"showlegend": false,
"type": "scatter",
"x": [
0,
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,
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
],
"y": [
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4"
]
},
{
"line": {
"color": "goldenrod",
"width": 10
},
"name": "Test",
"showlegend": false,
"type": "scatter",
"x": [
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
],
"y": [
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4"
]
},
{
"line": {
"color": "blue",
"width": 10
},
"name": "Train",
"showlegend": false,
"type": "scatter",
"x": [
0,
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
],
"y": [
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5"
]
},
{
"line": {
"color": "goldenrod",
"width": 10
},
"name": "Test",
"showlegend": false,
"type": "scatter",
"x": [
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
],
"y": [
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5"
]
}
],
"layout": {
"font": {
"size": 20
},
"height": 450,
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "rgb(36,36,36)"
},
"error_y": {
"color": "rgb(36,36,36)"
},
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "rgb(36,36,36)",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "rgb(36,36,36)"
},
"baxis": {
"endlinecolor": "rgb(36,36,36)",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "rgb(36,36,36)"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1,
"#fde725"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1,
"#fde725"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1,
"#fde725"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"line": {
"color": "white",
"width": 0.6
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1,
"#fde725"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1,
"#fde725"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"fillpattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1,
"#fde725"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "rgb(237,237,237)"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "rgb(217,217,217)"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"colorscale": {
"diverging": [
[
0,
"rgb(103,0,31)"
],
[
0.1,
"rgb(178,24,43)"
],
[
0.2,
"rgb(214,96,77)"
],
[
0.3,
"rgb(244,165,130)"
],
[
0.4,
"rgb(253,219,199)"
],
[
0.5,
"rgb(247,247,247)"
],
[
0.6,
"rgb(209,229,240)"
],
[
0.7,
"rgb(146,197,222)"
],
[
0.8,
"rgb(67,147,195)"
],
[
0.9,
"rgb(33,102,172)"
],
[
1,
"rgb(5,48,97)"
]
],
"sequential": [
[
0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1,
"#fde725"
]
],
"sequentialminus": [
[
0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1,
"#fde725"
]
]
},
"colorway": [
"#1F77B4",
"#FF7F0E",
"#2CA02C",
"#D62728",
"#9467BD",
"#8C564B",
"#E377C2",
"#7F7F7F",
"#BCBD22",
"#17BECF"
],
"font": {
"color": "rgb(36,36,36)"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "white",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "white",
"polar": {
"angularaxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
},
"bgcolor": "white",
"radialaxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
}
},
"scene": {
"xaxis": {
"backgroundcolor": "white",
"gridcolor": "rgb(232,232,232)",
"gridwidth": 2,
"linecolor": "rgb(36,36,36)",
"showbackground": true,
"showgrid": false,
"showline": true,
"ticks": "outside",
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
},
"yaxis": {
"backgroundcolor": "white",
"gridcolor": "rgb(232,232,232)",
"gridwidth": 2,
"linecolor": "rgb(36,36,36)",
"showbackground": true,
"showgrid": false,
"showline": true,
"ticks": "outside",
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
},
"zaxis": {
"backgroundcolor": "white",
"gridcolor": "rgb(232,232,232)",
"gridwidth": 2,
"linecolor": "rgb(36,36,36)",
"showbackground": true,
"showgrid": false,
"showline": true,
"ticks": "outside",
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
}
},
"shapedefaults": {
"fillcolor": "black",
"line": {
"width": 0
},
"opacity": 0.3
},
"ternary": {
"aaxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
},
"baxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
},
"bgcolor": "white",
"caxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside",
"title": {
"standoff": 15
},
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
},
"yaxis": {
"automargin": true,
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside",
"title": {
"standoff": 15
},
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
}
}
},
"title": {
"text": "Cross-Validation",
"x": 0.5
},
"width": 850,
"xaxis": {
"title": {
"text": "Index"
}
},
"yaxis": {
"title": {
"text": "Split"
}
}
}
}
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Import packages\n",
"import plotly.graph_objects as go\n",
"import pandas as pd\n",
"from sklearn.model_selection import KFold\n",
"\n",
"\n",
"def plot_cross_val(n_splits: int,\n",
" splitter_func,\n",
" df: pd.DataFrame,\n",
" title_text: str) -> None:\n",
" \n",
" \"\"\"Function to plot the cross validation of various\n",
" sklearn splitter objects.\"\"\"\n",
"\n",
" split = 1\n",
" plot_data = []\n",
"\n",
" for train_index, valid_index in splitter_func(n_splits=n_splits).split(df):\n",
" plot_data.append([train_index, 'Train', f'{split}'])\n",
" plot_data.append([valid_index, 'Test', f'{split}'])\n",
" split += 1\n",
"\n",
" plot_df = pd.DataFrame(plot_data,\n",
" columns=['Index', 'Dataset', 'Split'])\\\n",
" .explode('Index')\n",
"\n",
" fig = go.Figure()\n",
" for _, group in plot_df.groupby('Split'):\n",
" fig.add_trace(go.Scatter(x=group['Index'].loc[group['Dataset'] == 'Train'],\n",
" y=group['Split'].loc[group['Dataset'] == 'Train'],\n",
" name='Train',\n",
" line=dict(color=\"blue\", width=10)\n",
" ))\n",
" fig.add_trace(go.Scatter(x=group['Index'].loc[group['Dataset'] == 'Test'],\n",
" y=group['Split'].loc[group['Dataset'] == 'Test'],\n",
" name='Test',\n",
" line=dict(color=\"goldenrod\", width=10)\n",
" ))\n",
"\n",
" fig.update_layout(template=\"simple_white\", font=dict(size=20),\n",
" title_text=title_text, title_x=0.5, width=850,\n",
" height=450, xaxis_title='Index', yaxis_title='Split')\n",
"\n",
" legend_names = set()\n",
" fig.for_each_trace(\n",
" lambda trace:\n",
" trace.update(showlegend=False)\n",
" if (trace.name in legend_names) else legend_names.add(trace.name))\n",
"\n",
" return fig.show()\n",
" \n",
" \n",
"if __name__ == \"__main__\":\n",
"\n",
" # Read in the data\n",
" data = pd.read_csv('../coal-price-data/AirPassengers.csv')\n",
" data['Month'] = pd.to_datetime(data['Month'])\n",
" \n",
" # Plot the cross validation\n",
" plot_cross_val(n_splits=5,\n",
" splitter_func=KFold,\n",
" df=data,\n",
" title_text='Cross-Validation')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"line": {
"color": "blue",
"width": 10
},
"name": "Train",
"type": "scatter",
"x": [
0,
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
11,
12,
13,
14,
15,
16,
17,
18,
19,
20,
21,
22,
23
],
"y": [
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1"
]
},
{
"line": {
"color": "goldenrod",
"width": 10
},
"name": "Test",
"type": "scatter",
"x": [
24,
25,
26,
27,
28,
29,
30,
31,
32,
33,
34,
35,
36,
37,
38,
39,
40,
41,
42,
43,
44,
45,
46,
47
],
"y": [
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1",
"1"
]
},
{
"line": {
"color": "blue",
"width": 10
},
"name": "Train",
"showlegend": false,
"type": "scatter",
"x": [
0,
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
],
"y": [
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2"
]
},
{
"line": {
"color": "goldenrod",
"width": 10
},
"name": "Test",
"showlegend": false,
"type": "scatter",
"x": [
48,
49,
50,
51,
52,
53,
54,
55,
56,
57,
58,
59,
60,
61,
62,
63,
64,
65,
66,
67,
68,
69,
70,
71
],
"y": [
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2",
"2"
]
},
{
"line": {
"color": "blue",
"width": 10
},
"name": "Train",
"showlegend": false,
"type": "scatter",
"x": [
0,
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
],
"y": [
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3"
]
},
{
"line": {
"color": "goldenrod",
"width": 10
},
"name": "Test",
"showlegend": false,
"type": "scatter",
"x": [
72,
73,
74,
75,
76,
77,
78,
79,
80,
81,
82,
83,
84,
85,
86,
87,
88,
89,
90,
91,
92,
93,
94,
95
],
"y": [
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3",
"3"
]
},
{
"line": {
"color": "blue",
"width": 10
},
"name": "Train",
"showlegend": false,
"type": "scatter",
"x": [
0,
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
],
"y": [
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4"
]
},
{
"line": {
"color": "goldenrod",
"width": 10
},
"name": "Test",
"showlegend": false,
"type": "scatter",
"x": [
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107,
108,
109,
110,
111,
112,
113,
114,
115,
116,
117,
118,
119
],
"y": [
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4",
"4"
]
},
{
"line": {
"color": "blue",
"width": 10
},
"name": "Train",
"showlegend": false,
"type": "scatter",
"x": [
0,
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
],
"y": [
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5"
]
},
{
"line": {
"color": "goldenrod",
"width": 10
},
"name": "Test",
"showlegend": false,
"type": "scatter",
"x": [
120,
121,
122,
123,
124,
125,
126,
127,
128,
129,
130,
131,
132,
133,
134,
135,
136,
137,
138,
139,
140,
141,
142,
143
],
"y": [
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5",
"5"
]
}
],
"layout": {
"font": {
"size": 20
},
"height": 450,
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "rgb(36,36,36)"
},
"error_y": {
"color": "rgb(36,36,36)"
},
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "white",
"width": 0.5
},
"pattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "rgb(36,36,36)",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "rgb(36,36,36)"
},
"baxis": {
"endlinecolor": "rgb(36,36,36)",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "rgb(36,36,36)"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1,
"#fde725"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1,
"#fde725"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1,
"#fde725"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"line": {
"color": "white",
"width": 0.6
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1,
"#fde725"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1,
"#fde725"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"fillpattern": {
"fillmode": "overlay",
"size": 10,
"solidity": 0.2
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
},
"colorscale": [
[
0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1,
"#fde725"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "rgb(237,237,237)"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "rgb(217,217,217)"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowhead": 0,
"arrowwidth": 1
},
"autotypenumbers": "strict",
"coloraxis": {
"colorbar": {
"outlinewidth": 1,
"tickcolor": "rgb(36,36,36)",
"ticks": "outside"
}
},
"colorscale": {
"diverging": [
[
0,
"rgb(103,0,31)"
],
[
0.1,
"rgb(178,24,43)"
],
[
0.2,
"rgb(214,96,77)"
],
[
0.3,
"rgb(244,165,130)"
],
[
0.4,
"rgb(253,219,199)"
],
[
0.5,
"rgb(247,247,247)"
],
[
0.6,
"rgb(209,229,240)"
],
[
0.7,
"rgb(146,197,222)"
],
[
0.8,
"rgb(67,147,195)"
],
[
0.9,
"rgb(33,102,172)"
],
[
1,
"rgb(5,48,97)"
]
],
"sequential": [
[
0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1,
"#fde725"
]
],
"sequentialminus": [
[
0,
"#440154"
],
[
0.1111111111111111,
"#482878"
],
[
0.2222222222222222,
"#3e4989"
],
[
0.3333333333333333,
"#31688e"
],
[
0.4444444444444444,
"#26828e"
],
[
0.5555555555555556,
"#1f9e89"
],
[
0.6666666666666666,
"#35b779"
],
[
0.7777777777777778,
"#6ece58"
],
[
0.8888888888888888,
"#b5de2b"
],
[
1,
"#fde725"
]
]
},
"colorway": [
"#1F77B4",
"#FF7F0E",
"#2CA02C",
"#D62728",
"#9467BD",
"#8C564B",
"#E377C2",
"#7F7F7F",
"#BCBD22",
"#17BECF"
],
"font": {
"color": "rgb(36,36,36)"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "white",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "white",
"polar": {
"angularaxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
},
"bgcolor": "white",
"radialaxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
}
},
"scene": {
"xaxis": {
"backgroundcolor": "white",
"gridcolor": "rgb(232,232,232)",
"gridwidth": 2,
"linecolor": "rgb(36,36,36)",
"showbackground": true,
"showgrid": false,
"showline": true,
"ticks": "outside",
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
},
"yaxis": {
"backgroundcolor": "white",
"gridcolor": "rgb(232,232,232)",
"gridwidth": 2,
"linecolor": "rgb(36,36,36)",
"showbackground": true,
"showgrid": false,
"showline": true,
"ticks": "outside",
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
},
"zaxis": {
"backgroundcolor": "white",
"gridcolor": "rgb(232,232,232)",
"gridwidth": 2,
"linecolor": "rgb(36,36,36)",
"showbackground": true,
"showgrid": false,
"showline": true,
"ticks": "outside",
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
}
},
"shapedefaults": {
"fillcolor": "black",
"line": {
"width": 0
},
"opacity": 0.3
},
"ternary": {
"aaxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
},
"baxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
},
"bgcolor": "white",
"caxis": {
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside"
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside",
"title": {
"standoff": 15
},
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
},
"yaxis": {
"automargin": true,
"gridcolor": "rgb(232,232,232)",
"linecolor": "rgb(36,36,36)",
"showgrid": false,
"showline": true,
"ticks": "outside",
"title": {
"standoff": 15
},
"zeroline": false,
"zerolinecolor": "rgb(36,36,36)"
}
}
},
"title": {
"text": "Time Series Cross-Validation",
"x": 0.5
},
"width": 850,
"xaxis": {
"title": {
"text": "Index"
}
},
"yaxis": {
"title": {
"text": "Split"
}
}
}
}
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Import packages\n",
"from sklearn.model_selection import TimeSeriesSplit\n",
"\n",
"# Plot the time series cross validation splits\n",
"plot_cross_val(n_splits=5,\n",
" splitter_func=TimeSeriesSplit,\n",
" df=data,\n",
" title_text='Time Series Cross-Validation')"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"hovertemplate": "Date=%{x}
Passengers=%{y}
\n", " | Gamma | \n", "MAPE | \n", "
---|---|---|
0 | \n", "0.0 | \n", "0.048897 | \n", "
1 | \n", "0.1 | \n", "0.051128 | \n", "
2 | \n", "0.2 | \n", "0.052672 | \n", "
3 | \n", "0.3 | \n", "0.053538 | \n", "
4 | \n", "0.4 | \n", "0.052919 | \n", "
5 | \n", "0.5 | \n", "0.047107 | \n", "
6 | \n", "0.6 | \n", "0.044867 | \n", "
7 | \n", "0.7 | \n", "0.044603 | \n", "
8 | \n", "0.8 | \n", "0.046695 | \n", "
9 | \n", "0.9 | \n", "0.048922 | \n", "
10 | \n", "1.0 | \n", "0.046184 | \n", "