Simple Forecasting

Timeseries financial forecasting

Recently , I have been looking into various ways to forecast a time series dataset. This is an old pursuit in the field of statistics and there are many well known ways to achieve this.

In this post I will demonstrate a very basic (Naive) approach of forecasting a quarterly dataset of sales figure, by using previous 4 years (16 quarters) and forecasting/predicting the next 1 year of sales aggregate.

Read more →

how to play apple music on alexa in uk

You can now use Alexa to play Apple Music on Amazon Echo speakers.

It’s just available for Echo devices and now customers in UK can also connect their apple music account with Alexa.

  1. Open the Alexa app then sign into your Amazon account and make sure that your Echo device is connected.

  2. Open Menu (top left icon), then select settings.

  3. Select Music.

  4. Select “Link New Service”

  5. Tap, Apple music Icon

Read more →

Normalizing Ranges of Numbers

Range Normalization is a normalization technique that allows you to map a number to a specific range.

Lets say that we have a data set where the values are in a range of 1 to 10, however we wish to normalise it to a range between 0 and 5

Mathematically speaking the equation comes down to

eq1

eq2

translated to Python

class Normaliser:

   def \_\_init\_\_(self,dH,dL,nH,nL):
       self.dH = dH
       self.dL = dL
       self.nH = nH
       self.nL = nL

   def normalize(self,x):
       return ((x - self.dL) / (self.dH - self.dL))  * (self.nH - self.nL) + self.nL

   def denormalize(self,x):
       return ((self.dL - self.dH) * x - self.nH * self.dL + self.dH * self.nL) / (self.nL - self.nH)

if \_\_name\_\_ == "\_\_main\_\_":
   norm = Normaliser(10,1,5,0);

   for a in range(1,11):
       x = norm.normalize(a);
       y = norm.denormalize(x);
       print str(a) + " : " + str(x) + " : " + str(y)

The results

Read more →

Gheat Java – Heat maps

heat_map

A heat map is a graphical representation of data where the individual values contained in a matrix are represented as colors.

This article will attempt to explain the process or creating and using GHEAT-JAVA, which is a port of famous aspen based gheat and took great inspiration from Gheat.net

Writing a service which would serve heat map tiles is a bit tricky,there are three major components involved

  1. The client part i.e. some kind of mapping library which has a concept of layer, I chose Google maps.
  2. The data source part, i.e. a spatially aware database or an in memory data structure, I have used postgres ,an in memory quad tree and a flat file as data sources.
  3. The renderer part or basically the code which excepts requests , parses tile bounds, fetches data and then renders gradients on the tile and later colorizes them.

The Tiling layer (Client part)

Google maps allows developers to add a custom layer , the code looks like this

Read more →

Importing CSV File Into SQL SERVER Database using BULK INSERT

Importing data into a database from a delimited file is perhaps one of the most common tasks that one might have to perform. SQL server gives us an import utility which supports various data sources and has an intutive interface as well,however there is another way which can be utilized to quickly get the job done, its called BULK INSERT

BULK INSERT is a SQL command which can be typed in management console,takes various parameters to control the import and is very simple to use.

Read more →

How to configure Apache mod_wsgi

I am a big fan and user of python. one of the most popular ways to create quick web app in python is via using mod wsgi.

The aim of mod_wsgi is to implement a simple to use Apache module which can host any Python application which supports the Python WSGI interface.

The module would be suitable for use in hosting high performance production web sites, as well as your average self managed personal sites running on web hosting services.

Read more →

sqlite3 Bulk Import CSV from command line

I absolutely love SQLite, be it windows, linux or mac, this light weight database never stops to amaze me.

Few days ago I wanted to import a chunk of CSV data, which was 4 GB in size into a table in SQLite.

I generally use Firefox ’s sqlite-manager plug-in for usual tasks with SQLite database ,hence decided to use the import interface .

I have had a very good experience with this GUI tool and it has rarely failed me, but this time I was disappointed.

Read more →

A guide to hosting in Red Hats OpenShift PaaS

In this post,I am going to write about OpenShift, which is Red hat’s free, auto-scaling Platform as a Service (PaaS) for applications.

OpenShift to me is very similar to Google’s app engine in some ways,but openshift’s offerings are quite diverse, for instance support for ruby, php, Perl, node.js, etc..

Openshift is not like a traditional VPS hosting , although once registered with them, user does get a shell access,but its quite limited , instead OpenShift has a concept of gears and cartridges.

Read more →

How to setup easy_install on Windows

If one has been using python, then installing various libraries and modules is basically a breeze using easy_install utility, however for folks using windows, easy_install utility has to be setup properly before using it.

First lets make sure that python is properly installed and PYTHON_HOME environment variable is configured:

Install Python on Windows

If not already installed download python installer from here.

After it’s done downloading, double click to run the installer, and select default options (unless you have other custom needs of course ).

Read more →

Find Longitude and Latitude in Google Maps

This post is basically a way of quick appreciation to the Google maps Team, they are obviously a bunch of caring, loving people ,who make useful (although surreptitious) tools for the betterment of Geek Kind.

So as most of you may have accidently clicked a mysterious looking link at the bottom of your Google maps page ( on the left hand panel)google_latlon_tool1

This awesome looking link opens up a popup which lets you choose wonderful goodies which makes your Google maps page more useful than it already is:

Read more →

Installing Ubuntu Linux in VMware and VMwareTools

I have been using Ubuntu for last two years as a deployment environment for my pet projects, however recently, after having installed “Natty Narwhal” on one of my old ‘HP’ laptop I moved into using Ubuntu as a full time development environment.

There are times when I need more than one deployment units and since I use Linodeas my primary deployment VPS host, I sometime need to test the perf of my software locally thus there came a need of replicating an exact or close to exact “Deployment Environment”

Read more →

VPS Hosting Past and Present

I had been hosting this blog in the past for an extremely competitive (read cheap) price here at Arvixe . I was using ASP.net based blogging software called BlogEngine. over and all I will describe my experience as pleasant. Arvixe is a great Hosting Provider, has good up time and has plans which are easy on the pocket, and does almost all the common stuff like emails and cpanel ,blah blah that other hosting provider do, but kinda does it on a low price. I was a happy blogger for an year although I could only manage close to 8 post and and few demos in that time.

Read more →

Notepad++ with Python

After reading an excellent article by Kazi Manzur Rashidon setting up a development environment for Iron Ruby using Notepad++, I was immediately struck with an idea of using the same excellent tool with Python 2.6.

Now don’t get me wrong here, theoretically there is nothing wrong with IDLE, but having a light weight IDE for those who don’t want to use Pydevplugin for Aptanaor Eclipse, I think Notepad++ is indeed a nice little dev tool.

Read more →