Everything should be made as simple as possible, but not simpler. (Albert Einstein)
Showing posts with label machine learning. Show all posts
Showing posts with label machine learning. Show all posts

Thursday, December 29, 2016

K-means Clustering: Geolocation EDA & Inference Using Cell-phone CDRs

I played with (real) CDRs data, doing some exploratory data analysis / EDA and inferential (clustering), in order to find out approximate geolocation of certain phone number. 

Sometimes we're curious e.g. "who is this woman?"
Does she work in a bank, or studio? Maybe she's a bus driver? ;)



Data science + machine learning tools: Python (pandas, sklearn, matplotlib).

Call Detail Records (CDRs) is cell phone usage information collected by cell phone service providers.
Providers record every voice call or text (SMS) message exchange between two cell phone numbers. Information collected includes:

  • calls and messages: phone number, reciprocal phone number, time, duration, length of messages, etc., relational to users' identity.
  • cell towers: transceiver station CID, LAC (location area code), etc., relational to latitude and longitude data.
  • devices: IMEI, MAC, name and type of device, etc.
  • wifis: name, MAC of base station, etc.
  • ... and other data for resource provisioning and billing.

It's a comprehensive data, and it's available almost in real-time (within minutes). 

We can also do similar EDA to social media's geotagged data. 

Saturday, September 24, 2016

Recommender Demo, "lenskit-hello" via Intellij Idea, Step by Step

For advanced programmer, it's easy. But a beginner might get a headache ;) 
Here is step by step: 

Prerequisites: Gradle, Intellij Idea. (and JDK for sure).

Sunday, October 4, 2015

Singular Value Decomposition and Dimensionality Reduction, Using R and Cat Image for Illustration Purposes

Singular Value Decomposition and Dimensionality Reduction, Using R and Cat Image for Illustration Purposes, by Soesilo Wijono,

SVD (singular value decomposition) is an important method used in data science, especially data mining. It can be used, e.g., in dimensionality reduction for recommender system.
Imagine online store, e.g. Amazon, to have million of items, and million of users. In order to perform algorithm for the recommender system, matrix to be used would have million by million dimension. Which is very expensive computation.
Theory for dimensionality reduction is everywhere, so we won’t repeat it again in here. Just remember the basic equation:
X = U A V.T
U matrix has dimension of n x n.
V matrix has dimension of d x d.
A matrix is diagonal matrix with dimension of n x d.
(T represents matrix transpose.)
We want to reduce the dimension of X matrix.
This is an illustration of the method by using a PNG cat image. To help understanding the method visually. In which we’ll use image raw data. In real world, the image data can be replaced by any data, e.g. items x users matrix used in an recommender system, etc.

Thursday, September 3, 2015

Demo of Recommender System with LensKit and Intellij Idea

Requirements: 
If they're not installed yet, then install Maven and LensKit inside a directory. 
Set environment variable M2_HOME, point it to the Maven directory. E.g. "C:\java\apache-maven-3.3.3" in Windows.
Add path of the LensKit's and Maven's binary directories, 
C:\java\lenskit-2.2\bin;%M2_HOME%\bin;%JAVA_HOME%\bin

Wednesday, March 4, 2015

Finding Good Lambda for Handwritten Digits Recognition (Neural Network) with Cross Validation Set

Finding good lambda ( λ ) for regularization in a machine learning model is important, to avoid under-fitting (high bias) or over-fitting (high variance).

If lambda is too large, then all theta ( θ ) values will be penalized heavily. Hypothesis ( h ) tends to zero. (High bias, under-fitting).
If lambda is too small, that's similar to very small regularization. (High variance, over-fitting).

Cross validation set principle can be used to select good lambda based on the plot of errors vs lambda, for both training data and validation data.

Friday, February 27, 2015

Some Introductory Machine Learning Books


Many Machine Learning books I encountered are too heavily math-wise (for a programmer). But I noted several introductory books,
  •  Machine Learning, Tom M. Mitchell, McGraw Hill. 
  •  Introduction to Machine Learning 2nd edition, Ethem Alpaydin, MIT Press. (without example code)
  •  Bayesian Reasoning and Machine Learning, David Barber (this has free online draft version, last draft is dated Dec 13, 2014) (ex. code in Matlab with BRMLToolbox).
  •  Machine Learning, A Probabilistic Perspective, Kevin P Murphy, MIT Press. (ex. code in Matlab with PMTK package.)
  •  Machine Learning, An Algorithmic Perspective, Stephen Marsland, CRC Press. (ex. code in Python)
  •  Machine Learning, Hands-On for Developers and Technical Professionals, Jason Bell, Wiley. (ex. code in Java with Weka toolkit.)
  •  Machine Learning In Action, Peter Harrington, Manning. (ex. code in Python.)
  •  Thoughtful Machine Learning, a Test Driven Approach, Matthew Kirk, O'Reilly. (ex. code in Ruby.)

More programming-wise books,
Python:
  •  Mastering Machine Learning with scikit-learn, Gavin Hackeling, Packt.
  •  Learning scikit-learn: Machine Learning in Python, Raúl Garreta et.al., Packt. 
  •  scikit-learn Cookbook, Trent Hauck, Packt.
  •  Building Machine Learning Systems with Python, Willi Richert et.al, Packt.
R:
  •  An Introduction to Statistical Learning with Applications in R, Gareth James et.al, Springer.
  •  Machine Learning with R, Brett Lantz, Packt.
Scala:
  •  Scala for Machine Learning, Patrick R Nicolas, Packt.

Best ML course, with easy understandable video lectures, very well-structured:
Stanford's Prof. Andrew Ng  https://www.coursera.org/course/ml (old regular format with SoA, already closed since 2015).
New format of the course is on-demand (self-paced),  currently without SoA, https://www.coursera.org/learn/machine-learning .

----

Thursday, February 26, 2015

Handwritten Digits Recognition, Experiment with Octave's Neural Network Package "nnet", and RSNNS

This is a note on implementation of handwritten digits recognition, with the neural network learning process, by using Octave nnet package (or MATLAB neural network toolbox).

At the end,  I play around with R code and RSNNS library (Stuttgart Neural Network Simulator for R).

GitHub, Octave/MATLAB:
    https://github.com/flyingdisc/handwritten-digits-recognition-octave-nnet
Github, R - RSNNS:
    https://github.com/flyingdisc/handwritten-digits-recognition-RSNNS  
----