![Page 1: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/1.jpg)
17 OCTOBER 2018
Dave Liner
A practical guide to machine learning for actuaries
![Page 2: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/2.jpg)
![Page 3: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/3.jpg)
![Page 4: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/4.jpg)
Rank 2009 2010 2011 2012 2013 2014 2015 2016 2017
1
2
3
4
5
6
7
8
9
10
11
CareerCast top job rankings by year
Actuary
![Page 5: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/5.jpg)
Rank 2009 2010 2011 2012 2013 2014 2015 2016 2017
1
2
3
4
5
6
7
8
9
10
11
CareerCast top job rankings by year
Actuary
Data Scientist
Statistician
![Page 6: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/6.jpg)
![Page 7: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/7.jpg)
![Page 8: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/8.jpg)
![Page 9: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/9.jpg)
9
![Page 10: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/10.jpg)
![Page 11: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/11.jpg)
![Page 12: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/12.jpg)
12
What I learned about machine learning
1. Machine learning drives disruption and innovation in many sectors globally
2. Many actuaries already do most of the machine learning process
3. Most popular machine learning methods are based on concepts that actuaries already understand
4. There is a staggering amount of free resources to develop machine learning skills
![Page 13: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/13.jpg)
13
Actuaries already do most of the machine learning process
1. Get data
2. Prepare data
3. Build model
4. Use model to gain insight
5. Tell others about model results
![Page 14: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/14.jpg)
14
We will review five machine learning methods today
k-Nearest neighbors
k-Means clustering
Decision trees
Logistic regression
Neural networks
![Page 15: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/15.jpg)
Illustrative dataset
15
![Page 16: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/16.jpg)
16
X1 = Petal length
X2 = Petal width
Y = Species
![Page 17: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/17.jpg)
17
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
Setosa
Versicolor
Virginica
It is easier to illustrate methods using 2-dimensional data
![Page 18: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/18.jpg)
k-Nearest neighbors
18
![Page 19: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/19.jpg)
19
What is the species of a new sample based on Petal width and length using kNN?
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
Setosa
Virginica
Versicolor
![Page 20: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/20.jpg)
20
What is the species of a new sample based on petal width and length using kNN?
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
Setosa
Virginica
Versicolor
![Page 21: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/21.jpg)
21
Four lines of Python code gets same result as Excel kNN file
import sklearn.datasets as ds, sklearn.model_selection as ms, sklearn.preprocessing as pp, sklearn.neighbors, sklearn.metrics
X_train,X_test,y_train,y_test = ms.train_test_split(pp.scale(ds.load_iris().data),ds.load_iris().target,test_size=30,random_state=0)
y_pred_kNN = sklearn.neighbors.KNeighborsClassifier(n_neighbors=3).fit(X_train,y_train).predict(X_test)
print(sklearn.metrics.confusion_matrix(y_test, y_pred_kNN))
![Page 22: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/22.jpg)
k-Means clustering
![Page 23: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/23.jpg)
23
What is the species of a new sample based on Petal width and length using clustering?
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
Unsupervised learning does not require labels (Y)
![Page 24: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/24.jpg)
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length24
Step 1: select random centroids (k=3 in this case)
![Page 25: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/25.jpg)
25
Step 2: move centroids based on data
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
![Page 26: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/26.jpg)
26
Step 3: keep moving centroids until no points are reassigned
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
![Page 27: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/27.jpg)
27
Step 4: assign each point to a centroid cluster
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
![Page 28: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/28.jpg)
28
Step 4: assign each point to a centroid cluster
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
Setosa
Virginica
Versicolor
![Page 29: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/29.jpg)
29
Step 5: use clusters to assign new data points
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
Setosa
Virginica
Versicolor
![Page 30: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/30.jpg)
30
Step 5: use clusters to assign new data points
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
Setosa
Virginica
Versicolor
![Page 31: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/31.jpg)
31
Step 5: use clusters to assign new data points
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
Setosa
Virginica
Versicolor
![Page 32: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/32.jpg)
Decision trees
![Page 33: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/33.jpg)
33
![Page 34: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/34.jpg)
34
Decision trees provide another method for classification
Setosa VirginicaVersicolor
Root Node
Decision Node
Leaf Nodes
![Page 35: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/35.jpg)
35
Decision trees provide another method for classification
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
Setosa
Versicolor
Virginica
![Page 36: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/36.jpg)
36
Decision trees provide another method for classification
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
Setosa
Versicolor
Virginica
![Page 37: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/37.jpg)
37
Decision trees provide another method for classification
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
Setosa
Versicolor
Virginica
![Page 38: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/38.jpg)
38
Decision trees provide another method for classification
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
Setosa
Versicolor
Virginica
![Page 39: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/39.jpg)
39
Decision trees provide another method for classification
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
Setosa
Versicolor
Virginica
![Page 40: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/40.jpg)
40
Decision trees provide another method for classification
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
Setosa
Versicolor
Virginica
![Page 41: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/41.jpg)
Logistic regression
![Page 42: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/42.jpg)
42
Linear regression uses line of best fit to make numerical predictions
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
![Page 43: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/43.jpg)
43
Logistic regression is a classification algorithm
0.0
0.5
1.0
0.0 0.5 1.0 1.5 2.0 2.5
Is it Virginica?
Petal Width
Setosa
Versicolor
Virginica
Yes
No
![Page 44: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/44.jpg)
44
Is it virginica?
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
Setosa
Versicolor
Virginica
0.0
0.5
1.0
0.0 0.5 1.0 1.5 2.0 2.5
Virginica?
Petal Width
Yes
No
![Page 45: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/45.jpg)
45
Is it virginica?
0.0
0.5
1.0
1.5
2.0
2.5
1.0 2.0 3.0 4.0 5.0 6.0 7.0
Petal Width
Petal Length
Setosa
Versicolor
Virginica
0.0
0.5
1.0
0.0 0.5 1.0 1.5 2.0 2.5
Virginica?
Petal Width
Yes
No
![Page 46: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/46.jpg)
Neural networks
![Page 47: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/47.jpg)
47
Neural can model non-linear situations
Setosa
Versicolor
Virginica
Sepal Length
Petal Width
Sepal Width
Petal Length
Activation Functions
Input Hidden Output
![Page 48: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/48.jpg)
48
Neural Networks
Input Layer Hidden Layer Output Layer
![Page 49: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/49.jpg)
49
Neural Networks
Input Layer Hidden Layer Output Layer
![Page 50: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/50.jpg)
50
Neural Networks
Input Layer Hidden Layer Output Layer
![Page 51: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/51.jpg)
51
Neural Networks
Input Layer Hidden Layer Output Layer
![Page 52: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/52.jpg)
52
Summary of methods
Unsupervised Deep Regression
k-Nearest Neighbors
k-Means Clustering
Decision Trees
Linear Regression
Logistic Regression
Neural Networks
![Page 53: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/53.jpg)
Next steps
![Page 54: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/54.jpg)
54
Possible machine learning applications in healthcare include
Predicting non-adherent drug event before it happens
Predict opioid drug abuse before it happens
Estimate member persistency based on member and dependent characteristics
Project medical costs using personal and clinical data
Develop clinical best-practices by linking clinical and financial data
![Page 55: A practical guide to machine learning for actuaries · What I learned about machine learning 1. Machine learning drives disruption and innovation in many sectors globally 2. Many](https://reader030.vdocuments.site/reader030/viewer/2022040215/5f0284797e708231d404a80f/html5/thumbnails/55.jpg)