Friday, June 14, 2013

Tutorial: Conditional Random Field (CRF)

Conditional Random Field (CRF) is a probabilistic model for labeling a sequence of words. CRF has found applications in address parsing, NER (names entity recognition), NP chunking etc.

In order to understand how CRF works, it is important to understand the basic concepts like:
  • what are probabilistic models
  • what are graphical models
  • basics of probability
  • basic probabilistic models such as naive bayes, maximum entropy and HMM
All these concepts will lead to a concrete understanding of CRFs.  Below presentation will help you in understanding the details of CRF.

Open Fullscreen

This is the version 1.0 of the presentation I'm developing. I'm planning to add more details like Baum-Welch algorithm, Perceptron/SGD training algorithm, Regularization etc.

Stay tuned and feel free to suggest additional CRF topic to be included.

Friday, March 8, 2013

Basics of Machine Learning (Video)

This is a basic video course on machine learning (ML) that covers the basic theory, algorithms, and applications.
  • Lecture 1: The Learning Problem
  • Lecture 2: Is Learning Feasible?
  • Lecture 3: The Linear Model I
  • Lecture 4: Error and Noise
  • Lecture 5: Training versus Testing
  • Lecture 6: Theory of Generalization
  • Lecture 7: The VC Dimension
  • Lecture 8: Bias-Variance Tradeoff
  • Lecture 9: The Linear Model II
  • Lecture 10: Neural Networks
  • Lecture 11: Overfitting
  • Lecture 12: Regularization
  • Lecture 13: Validation
  • Lecture 14: Support Vector Machines
  • Lecture 15: Kernel Methods
  • Lecture 16: Radial Basis Functions
  • Lecture 17: Three Learning Principles
  • Lecture 18: Epilogue
theory - mathematical
technique - practical
analysis - conceptual


Monday, January 23, 2012

Differential & Integral Calculus (lim, ∂, ∫) [Video Lectures]

The Calculus is an important branch of mathematics. In this post we'll go through the lectures on differential and integral calculus, which are one of the hard problems students face during their college.

The "Derivative" is a measure of how a function changes as its input changes.Loosely speaking, a derivative can be thought of as how much one quantity is changing in response to changes in some other quantity; for example, the derivative of the position of a moving object with respect to time is the object's instantaneous velocity. Or how fast the temperature of a room is changing with respect to time. The derivative of a function at a chosen input value describes the best linear approximation of the function near that input value. For a real-valued function of a single real variable, the derivative at a point equals the slope of the tangent line to the graph of the function at that point. In higher dimensions, the derivative of a function at a point is a linear transformation called the linearization.

Understanding "Limits" is important before starting with derivatives or integration. Informally, a function f assigns an output f(x) to every input x. The function has a limit L at an input p if f(x) is "close" to L whenever x is "close" to p. In other words, f(x) becomes closer and closer to L as x moves closer and closer to p. More specifically, when f is applied to each input sufficiently close to p, the result is an output value that is arbitrarily close to L. If the inputs "close" to p are taken to values that are very different, the limit is said to not exist.

Above stuff seems confusing, let's take a deeper look at these concepts using the video lectures:

A Big Thanks to UCLA for posting these lectures.

Wednesday, July 7, 2010

Machine Learning - Tutorial & Stanford Lecture Videos

What is Machine Learning?
A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P, if its performance at tasks in T, as measured by P, improves with experience E. - Tom M. Mitchell (1997).

Following are the recommended prerequisites for this course:

Lecture handouts
cs229-notes1.pdf Linear Regression, Classification and logistic regression, Generalized Linear Models
cs229-notes2.pdf Generative Learning algorithms
cs229-notes3.pdf Support Vector Machines
cs229-notes4.pdf Learning Theory
cs229-notes5.pdf Regularization and model selection
cs229-notes6.pdf The perceptron and large margin classifiers
cs229-notes7a.pdf The k-means clustering algorithm
cs229-notes7b.pdf Mixtures of Gaussians and the EM algorithm
cs229-notes8.pdf The EM algorithm
cs229-notes9.pdf Factor analysis
cs229-notes10.pdf Principal components analysis
cs229-notes11.pdf Independent Components Analysis
cs229-notes12.pdf Reinforcement Learning and Control

Machine Learning - Standford University Lectures

A Big thanks to the Standford University for posting these lectures.

Monday, February 1, 2010

How To: Execute and Save SSRS Report using C#

It is often required to execute a SSRS report from within C# and save it in the required file format like PDF, XLS etc.

SQL Server Reporting Services (SSRS) exposes two web services using which we can execute a report and save it in the required file format. The two web services are:

  • Reporting Service 2005 : http://[SERVER]/reportserver/reportservice2005.asmx
  • Report Execution Service : http://[SERVER]/reportserver/reportexecution2005.asmx

Add the above two web services as "Web Reference" to your project with the following namespace RS2005 and RE2005:

Use the C# code below to execute and save the report:

      public static void SaveReport()

RS2005.ReportingService2005 rs;
RE2005.ReportExecutionService rsExec;

// Create a new proxy to the web service
rs = new RS2005.ReportingService2005();
rsExec = new RE2005.ReportExecutionService();

// Authenticate to the Web service using Windows credentials
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
rsExec.Credentials = System.Net.CredentialCache.DefaultCredentials;

rs.Url = "http://<SERVER>/reportserver/reportservice2005.asmx";
rsExec.Url = "http://<SERVER>/reportserver/reportexecution2005.asmx";

string historyID = null;
string deviceInfo = null;
string format = "EXCEL";
Byte[] results;
string encoding = String.Empty;
string mimeType = String.Empty;
string extension = String.Empty;
RE2005.Warning[] warnings = null;
string[] streamIDs = null;

// Path of the Report - XLS, PDF etc.
string fileName = @"c:\samplereport.xls";
// Name of the report - Please note this is not the RDL file.
string _reportName = @"/Marketing_Report";
string _historyID = null;
bool _forRendering = false;
RS2005.ParameterValue[] _values = null;
RS2005.DataSourceCredentials[] _credentials = null;
RS2005.ReportParameter[] _parameters = null;

_parameters = rs.GetReportParameters(_reportName, _historyID, _forRendering, _values, _credentials);
RE2005.ExecutionInfo ei = rsExec.LoadReport(_reportName, historyID);
RE2005.ParameterValue[] parameters = new RE2005.ParameterValue[1];

if (_parameters.Length > 0)
//parameters[0] = new RE2005.ParameterValue();
//parameters[0].Label = "";
//parameters[0].Name = "";
//parameters[0].Value = "";
rsExec.SetExecutionParameters(parameters, "en-us");

results = rsExec.Render(format, deviceInfo,
out extension, out encoding,
out mimeType, out warnings, out streamIDs);

using (FileStream stream = File.OpenWrite(fileName))
stream.Write(results, 0, results.Length);
catch (Exception ex)
throw ex;


Following output file formats are available: XML, CSV, IMAGE, PDF, EXCEL, WORD, HTML 4.0 and MHTML

Hope this helps!