Python Starter Code for Asia Actuarial Analytics Challenge 2016 

AUC 0.63

As most people are new to Machine Learning, in addition to my earlier blog on Getting Started Tips, I have decided to post the following Python script which uses Logistic Regression to make predictions.

You should be able to get auc score of around 0.63, which will put you in approximately 8th position as at the time of writing this blog.

Any comments please post here or in the competition forum.

__author__ = 'Teh Loo Hai'
__website__ = ''

import pandas as pd
import numpy as np
from sklearn import linear_model

if __name__ == "__main__":
    train = pd.read_csv('../input/SAStraining.csv')
    test = pd.read_csv('../input/SAStest.csv')

    # select numeric features
    features = ['time_in_hospital', 'num_lab_procedures',
                'num_procedures', 'num_medications',
                'number_outpatient', 'number_emergency',
                'number_inpatient', 'number_diagnoses']

    # fill nan with 0
    train[features].fillna(0, inplace=True)

    # set random number seed

    # build logistic regression model using numeric features only
    model = linear_model.LogisticRegression()[features], train['readmitted'])

    # make predictions on test data
    preds = model.predict_proba(test[features])

    # create submission file
    submission = pd.DataFrame({'patientID': test.patientID,
                               'readmitted': preds[:, 1]})
    submission.to_csv('submission-logistic.csv', index=False)

Posted by Loo Hai Tuesday, May 24, 2016 2:00:00 PM Categories: Machine Learning SAS
Rate this Content 0 Votes

Asia Actuarial Analytics Challenge 2016 

- Getting Started Tips

Singapore Actuarial Society (SAS) has recently launched the above competition to promote development of data analytics talent in Asia. If you don't know how to get started, the following are some tips:

  1. You need to have an invitation link before you can participate. You can find the invitation link in our April 2016 newsletter. Not sure whether you are eligible to participate, check the competition forum and if still unsure, ask the admin.
  2. Submit an all zeros submission by downloading and submitting the sample submission file. There you have it, you should achieve a score of 0.50000 and at par with the benchmark.
  3. Not happy with your score? Use a random number generator to generate your predictions. Submit your predictions and you should get a score either higher or lower than 0.50000. If you get a score higher than 0.50000, congratulations, you have beaten the benchmark! If your score is lower than 0.50000, just change your previous predictions by subtracting each one of them from 1 and submit again. Amazing, now you have outperformed the benchmark.
  4. Try something more actuarial. Fit a least squares regression line (e.g. using Excel) with "readmitted" as your y variables and choosing say "time_in_hospital" as your x variables. Use your regression line to make predictions and submit them.
  5. Improve your model by trying multiple regression (can still use Excel).
  6. Do more advanced stuff like GLM.
  7. Sign up for a machine learning course like the one run by SAS.

Good luck!

Posted by Loo Hai Friday, April 22, 2016 2:51:00 PM Categories: Machine Learning SAS
Rate this Content 0 Votes

Is peer review necessary? 

Is peer review on appointed actuaries' work necessary?  Australia introduced peer reviews back in 2006 but is now having second thought.  Apparently the cost of the annual reviews outweigh the benefits and insurers will save AUD3.5 - 6.1 million if the requirement is dropped.

Posted by Loo Hai Monday, April 20, 2015 5:49:00 PM
Rate this Content 0 Votes

Actuarial brain drain 

How serious is the problem?

It is no secret that we have a lot of Malaysian actuarial talents working overseas. In fact sometimes I joke that our country is the largest exporter of actuarial talents! So how serious is the actuarial brain drain problem? Until now there is no official statistics.

I attempt to answer this question by basing on some facts collected and making certain actuarial assumptions, a natural thing for an actuary to do I guess. Before I reveal the results, I invite you to take an actuarial guess of the ratio of Malaysian actuarial workforce residing in Malaysia to those residing outside Malaysia. 80:20? 50:50? Take your guess before scrolling down for the answer.

The Singapore Actuarial Society (SAS) in its recently published Annual Report 2014/2015 has a pie chart that shows its membership by country of origin. Malaysia makes up of 28% of SAS' membership. Based on SAS' total membership of 976, this translates to 273 Malaysians.

A quick check on the Actuarial Society of Malaysia (ASM)'s website shows that its membership as at 31 December 2014 stood at 708. I make an assumption that 95% of its membership are Malaysians, which translates to 673 Malaysians. Further I estimate that there are 150 to 250 Malaysians with actuarial qualifications working outside Malaysia and Singapore. We are now all set to answer the question I posed earlier.

  Malaysia Singapore Others Total
Scenario 1 673 (61.4%) 273 (24.9%) 150 (13.7%) 1,096 (100%)
Scenario 2 673 (56.3%) 273 (22.8%) 250 (20.9%) 1,196 (100%)

Based on the above, I conclude that we have a 40-45% actuarial brain drain problem. So, are you surprised with the results?

***You may also enjoy reading our blog on How Secure is the Insurance Company's CEO Job***

Posted by Loo Hai Tuesday, March 17, 2015 5:30:00 PM Categories: ASM SAS
Rate this Content 0 Votes

ASM elects new Council 

On 16 February 2015, ASM elected its new Council for 2015-17.


President Wan Saifulrizal Wan Ismail
Vice President Kelvin Hii
Secretary Wong Li Kuan
Treasurer Gary Lim
Committee Members Nur Amin Nur Azmi
  Yeoh Eng Hun
  Kelvin Yeong
  Agnes Kuan
Auditor Tan Teoh Guan
Immediate Past President Yap Chee Keong


Posted by Loo Hai Friday, February 27, 2015 4:08:00 PM Categories: ASM
Rate this Content 0 Votes
Page 1 of 2 1 2 > >>