Monday, 21 May 2018

Theory of Estimation: Unbiased Estimation

I was happy to see that Estimation was really an easy topic to understand, easier than I always thought.
In this  article, I would teach you in very simple way, the theory of estimation and you would understand it very clearly.

The challenge many have sometimes is caused by lecturers not explaining the concept clear enough, especially from the basics.


1. Basics: What is Estimation?

Estimation is the process involved in systematically inferring the hidden or unobserved variable from a given information set using a mathematical mapping between the unkowns and the knowns as well as a criterion for estimation.

To carry out estimation you need the following:
  • Data: Set of data
  • Estimator: The estimator takes in the data as well as two more items (Objective Function and Model) and then helps us make an estimate.
  • Model: This is a mapping between the knowns(your dataset) and the unknowns (the parameter)
  • Objective Function: This is a mathematical statement the can be mimimized or maximized to find best possible solutions among a set of solutions.

2. Basic Concepts of Estimation

Take note of these three basic concepts

The theory of estimation provides the following to help us in the task of making estimation:
  • Method for estimating the unknowns (eg. model parameters)
  • Means for accessing the 'goodness' of the resulting estimates
  • Making confident statements about the true values (how sure we are about the estimate)

3. Unbiased Estimator

A statistic could be defined as an unbiased estimate of a given parameter if the mean of hte sampling distribution of that statistic can be proved to be equal to the parameter being estimated.

Unbiasedness means, that for a large number of observations(samples), the average over all estimations lies close to the true parameter.

4. Sample Mean Example

Given an n-dimensional vector, X1, . . . ,Xn, prove that the extimator for the means μ is unbiased.

To estimate the mean, we use the sample mean as an estimator.

We now prove that the expected value of the estimator is equal to the true mean μ (condition for unbiasedness). This we would do using the linearity of the expected value
From the above, we can conclude that the estimator
is an unbiased estimator of the sample mean. Thank you for your effort in learning. You can reach me if you find anything difficult.

We consider more examples in the following parts.

Sunday, 20 May 2018

How to Display Logged In User Details Using AngularJS

Hey! Good to see you!

Let's keep it simple this time. I would just give you:
  • the HTML code
  • the AngularJS Script

We would like to display the users Firstname, Lastname, email and Department

Then I would tell you the files you need to  include in your header.

File to Include in your Header
You need to include Bootstrap, JQuery and AngularJS in the header section of your html page

<script type="application/javascript" src="jquery.min.js"></script>  
<script type="text/javascript" src="bootstrap.js"> </script> 
<script type="application/javascript" src="angular.js"></script>
Listing 1: Header Files

AngularJS Script
The AngularJS script is given below. You need to enclose it in a <script></script>

var ShowUser = function(){
  url: baseUrl + "api/user",  //The Base URL depends on your sharepoint server
  method: "GET",
  headers: { "Accept": "application/json; odata=verbose" }
  }).then(function mySucces(response) {
   $scope.DisplayName = + ', ' +;
   $scope.Location =;
   $scope.Department =;
   $scope.TotalPoints = 280;

 }, function error(response)  {
Listing 2: AngularJS Script

The script retrieves the user's details from a the Request URL. Then it places the retrieved data in the $Scope variable. Data placed in the $Scope is accessible from the html page by using the {{}}  to enclose the variable name. That's all you need

The HTML Code
The HTML section that displays the  user details is given below. You can modify it to fit your page design.
 <li>{{Department}} </li>
Listing 3: HTML Code

Make sure you try it and let me know if you have any challenges.
Thanks .

Wednesday, 16 May 2018

How to Post Data to a SharePoint List with AngularJS - Easy Steps

Hello, good to see you here.
Be sure that it really is not so difficult to post data from a form to a SharePoint List. I would show you the steps and also give you the codes.
Just 5 Steps. Lets go!


If you have any issue though, just let me know. Use the comment box below or the form to left of this page.

Step 1: Create a SharePoint List 

Create a list in SharePoint and called CustomerDetails.
This list should contain the following fields three fields.
  • Firstname
  • Lastname
  • Address
We are keeping it very simple so you will understand exactly how it works.

Step 2: Add Bootstrap, AngularJS and JQuery

Create a html page and add AngularJS and BootStrap to the header like shown below:


<title>AngularJS Tutorial</title>
<script type="text/javascript" src="bootstrap.js"> </script>
<script type="application/javascript" src="jquery.min.js"></script>
<script type="application/javascript" src="angular.js"></script>
<script type="application/javascript" src="index.js"></script>


//We would place the form here

Listing 1: Add files in header section

Step 3: Add the html Form

Add the following html to the body of your page, in between the <body> and </body> tags. This is the form that would be filled to be submitted to the SharePoint list

<form name="userForm" ng-app="myapp" ng-controller="myController" >
  <div class="form-group">
 <label for="firstname">Firstname </label> 
 <input type="text" ng-model="Firstname" class="form-control" id="firstname" />    
  <div class="form-group">
 <label for="lastname">Lastname:</label>
 <input type="text" ng-model="Lastname" class="form-control" id="lastname" />
  <div class="form-group">
 <label for="address">Address:</label>
 <input type="text" ng-model="Address" class="form-control" id="address" />
  <button type="submit" class="btn btn-primary"  ng-click="submitCustomer()" class="btn btn-default" data-dismiss="modal">Submit</button>
Listing 2: Code the HTML Form

Step 4: Add the Script

Add the following code to your AngularJS script. Name this script index.js. It's a bit complicated but I want you to first try it, then I would explain how it works to you or help you debug any error you may be getting. Remember to link this script to your html page and place the two in the same folder

var myapp = angular.module('myapp', []);

myapp.controller('myController', function($q, $scope, $http){

 //add nomination to start workflow                                                      
 function getRequestDigest(){
   var deferred = $q.defer();   
     $http ({
     url: "RequestDigest url ", //Get this url from your IT department
     method: "POST",
     headers: {
     "Content-Type": "application/json; odata=verbose",
     "Accept": "application/json; odata=verbose"
    }).success(function (response) {
     console.log('X-RequestDigest value:', response.d.GetContextWebInformation.FormDigestValue); 
     $scope.requestDigest = response.d.GetContextWebInformation.FormDigestValue;
    }).error(function (err) {
     console.log('Error in POST request digest', err);
    return deferred.promise;
 //digest end

 function AddCustomer(listName){
    $scope.submitError = false;
    var deferred = $q.defer();
    var requestData;
    var  GetItemTypeForListName = function (name) {
   return "SP.Data." + name.charAt(0).toUpperCase() + name.split(" ").join("").slice(1) + "ListItem";
     var itemType = GetItemTypeForListName(listName);

    requestData = {
    "Title": $scope.Firstname,
    "LastNamePhonetic": $scope.Lastname,
    "WorkAddress": $scope.Address,
  __metadata : { type: itemType }
    var postUrl = baseUrl + "_api/web/lists/getbytitle(listName)/items"; //Replace baseUrl
    var config = {
     headers: {
    "Content-Type": "application/json; odata=verbose",
    'Accept': 'application/json; odata=verbose',
    'X-RequestDigest': $scope.requestDigest
   console.log("requestDigest", $scope.requestDigest);
   $ (postUrl, JSON.stringify(requestData), config).then(function (data) {
      console.log("success", data);
      console.log("failed", error);

   return deferred.promise;


 //button- generate new item in the list and run wf
  $scope.submitCustomer = function (){
    var promise1 = getRequestDigest();
    promise1.then(function(){       //1st run the RequestDigest, then the AddCustomer
 //button end

Listing 3: Content of your index.js file

Step 5: Test your page!

Although it looks complicated, but it is really very simple. Trust me!

Go ahead to view the page.
Enter some items in the form and submit and check that the items gets inserted. Then go the list in SharePoint to make sure the item actually got inserted.

Let me know if you have challenges, I would be able to provide some guidance for you 

Wednesday, 9 May 2018

How to Succeed in Math (5 Secrets of Making Math Very Easy) - By a Genius

Good to see you again! Today's discussion would be Math and I would give you some secrets on how to succeed in Math.

You know, Math have always been and would always be my favorite subject. I learnt it, I practiced it, an I taught it as a teacher some time in the past in secondary school.  

So what I'm going to tell you are actually secrets, if you don't know these five points then you will always likely hate Math. An believe me, Math is actually the most interesting subject.

In this post, I would like to let you know how to succeed in study of Mathematics. I would be talking to you based on my own personal experience.

Point 1: Spend all the Time on it
Assuming that you have been having a particular course, every semester for three years
  • MTH 101 - Introduction to Elementary Math
If on the first semester of the fouth year, you have 6 courses with the same Math course included (that is the 7th time you are having this same course), that is Introduction to Mathmatics(MTH 101). 

The question now is: How easy would this course be at this time? 

You guess right?

I tell you, this MTH 101 would be the easiest course for that semester. The reason is that, you've spend so much time on a studying Math over the months, therefore it would be the easiest compared to other courses that are totally new. This is in the sense that it would be less difficult.
Whats the Point: The point is that the more the percentage of your time you spend in studying Math at the expense of time that would have been used for other causes, the easier Math becomes compared to  those other courses.
This nails the first point.

Spend plenty of time studying Math and you will find out that other courses becomes more difficult(meaning that Math becomes easier!). Even if it appears not interesting, just spend time on it.

I'm sure you get the point now. Let's move to the the second point.

Point 2: Get a Good(Possibly the Best Textbook)
No matter how anyone may choose to see it, a good textbook would always help you enjoy the study of Math. And the more you enjoy studying Math, the easier it becomes. So don't just settle with the recommend textbooks in school. Go out there to get the bookshops and get one. I found out from experience that textbooks written by Americans are always very good when it comes to study of Math. An example is K.A Stroud Engineering Mathematics. If you are in University, no matter the faculty or department, once there is Math in your curriculum, buy Engineering Mathematics.

Point 3: The Principle of First Principles
The principle of First Principles in Mathematics states that, "For you to understand a new topic in Mathematics, learn its first principles".

Lets take an example: what do you understand by dy/dx in Calculus?


This is the meaning of dy/dx from the first principle. The basics is that dy/dx is the slope of the graph. From here you can appreciate how the concept of differentiation and integration, that is the two basic topics in calculus. So what is the point. To learn a new topic in Math, go all the way to the first principle, and that you can do by finding the first part of the chapter that discusses the topic and the first principles would likely be explained there.

Point 4: Ask For Help From Math Pros (just like me!)
This is very important. As the saying goes that 'a day with a good teacher is better than a thousand days spend reading a book'. This is so true in the case of Mathematics. So if there is someone you know that is very good in Mathematics, pester on him to teach you, explain solutions to Math problems, explain the concepts to you an so on. Fortunately, Kindson the Math Pro is there for you. So just paste the Math exercises on the comment box below and I would get back to you.

Point 5: Solve and Solve and Solve!
Get as many examples and exercises as possible. Just keep solving. For textbooks that have solved examples, try to solve it yourself first and then compare your own solution with the example in the textbook. For the exercises, solve all if you can and then verify if your answer is correct.

I assure you that I you apply this five points, you will make so much improvement in Math and with time you will find Math very interesting. Trust me!

I will stop here for now, and I would like to thank you for reading. If this have been informative for your tell me how you feel in the comment box below and Follow me on Google+. 

You can as wells subscribe to my YouTube channel at Kindson The Math Pro on YouTube

Monday, 30 April 2018

How to Add a Progressbar Column to Table Using AngularJS and BootStrap UI

Hello, my friend. I'm Kindson, and good to see you here!

In this tutorial, we are going to learn how to add a progresss bar column to HTML table using AngularJS
  1. Introduction
  2. About AngularJS
  3. What you Need
  4. How it works
  5. How to Vary Color Based on Value
  6. Final Notes

1. Introduction

By now you should know how to display tabular data using AnuglarJS. If not you can look at this lesson: Display SharePoing Table Using AngularJS
Remember you can reach me if you have challenges.

Sometime you may need to display percentages in a progress bar in a table column. Or it may be number of points a user have accumulated in membership website. Using a progressbar would make it more interesting for your users.

2. About AngularJS

AngularJS is a very easy to use framework that helps you to create dynamic page that integrates data into your html page using AngularJS markup.
All you need to to is to add the link to the js file in the head tag of your page.

3. What You Need

  • BootStrap
  • JQuery
  • AngularJS

4. How it Works

It works in a very simple way.
The lenght of the progress bar is defined by the values in another column of the table. So basically, any table that have a column containing number can be used to display a progressbar.
The code is shown in Listing 1.0.

<table border="1" class="em-c-table">
    <thead class="em-c-table__header">
        <tr >
    <tbody class="em-c-table__body">
        <tr ng-repeat="row in data">
            <td><div class="progress progress-striped">
      <div class="progress progress-bar-warning" ng-style="{width: row.Percentage+'%'}"> {{row.Percentage}}</div>
Listing 1.0: HTML Table Structure

The progressbar is displayed in the third column of the table
 Note there are two div tags and one ng-style attribute
  • The first div tag sets the type of progressbar:  "progress progress-stripped
  • The second div tag sets the  color: "progress progress-bar-warning"
  • The ng-style is used to set the width of the bar to the value of the Percentage field in the table.
I hope this is clear. But if not, leave me a comment. I would explain more clearly to you.

5. How to Change Color Based on Value

You may want to vary the color of the bar depending on the value of the lenght. For example:
0 - 60: green
61 - 90: orange
91 - 99: red

To achieve this, you simply need to add a simple class to the <td> tag.

ng-class="{'progress-bar-danger': percent<33, 'progress-bar-info': percent>=33 && percent<66, 'progress-bar-success': percent>=66}"

6. Final Notes

Make sure you try it yourself. Just copy the code to your IDE and try to modify it to fit your data and then make sure it works.
If you completed this tutorial, thumbs up to you!. If you have any challenges, let me know in the comment box below or to the left of this page.

Tuesday, 24 April 2018

Add Pagination to a Page Using AngularJS and BootStrap

In this tutorial, I am going to teach you an easy way to add pagination to a html page using AngularJS and Bootstrap. Trust me, this would be very easy!

I would also share my code freely with you. So you can copy and use, though it took my some days to figure out and put it together.

  1. Background
  2. Scripts and CSS to Include
  3. Script that Handles Pagination
  4. The HTML Page
  5. Final Notes


We would use a dataset from SharePoint list retrieved using AngularJS.
The list is named users with two fields Name and Points

2. Scrips and CSS to Include

Place the following 4 scripts and on css file in the head tag of your html file. These are all the scripts you need for pagination.

  <script type="application/javascript" src="js/angular.1.6.2.js"></script>
  <script type="application/javascript" src="js/angular-route.1.6.2.js"></script>
  <script type="application/javascript" src="js/jquery-3.2.1.js"></script>
  <script src="//"></script>

  <link href="//" rel="stylesheet">
Listing 1.0: Scripts and Css for AngularJS and BootStrap

3. Script That Handles Pagination

You then need to write the script that handles the pagination.
In the script below, there is a function called GetListItems(). You need to write this script yourself as this is not the focus of this lesson. Just know that this script returns the data we would need to paginate.
(If you want the whole code, let me know in the comment box below or to the left of this page)

        var appVar = angular.module('plunker', ['ui.bootstrap']);

        appVar.controller("controller1", function($scope){    
            GetListItems($scope, "Users"); //Uses the $.ajax to retrieve data from sharepoint and place it in the scope
            $scope.viewby = 10;
            $scope.totalItems = $;
            $scope.currentPage = 4;
            $scope.itemsPerPage = $scope.viewby;
            $scope.maxSize = 5; //Number of pager buttons to show
            $scope.setPage = function (pageNo) {
            $scope.currentPage = pageNo;
            $scope.pageChanged = function() {
            console.log('Page changed to: ' + $scope.currentPage);
            $scope.setItemsPerPage = function(num) {
            $scope.itemsPerPage = num;
            $scope.currentPage = 1; //reset to first page
Listing 1.1: Script that Handles Pagination

4. The HTML Page

Now lets see how your table would look like in the html page.

<div ng-app="plunker">    
    <div id="App1" ng-controller="controller1">    
        <h1>List of Items Being Paginated Final</h1>    
        <table border="1">
            <tr >
        <tr ng-repeat="row in data.slice(((currentPage-1)*itemsPerPage), ((currentPage)*itemsPerPage)) | orderBy : '-Percentage'">
        <select ng-model="viewby" ng-change="setItemsPerPage(viewby)">
        </select> records at a time.
    <pagination total-items="totalItems" ng-model="currentPage" ng-change="pageChanged()" class="pagination-sm" items-per-page="itemsPerPage"></pagination>
    <pre>The selected page no: {{currentPage}}</pre>
Listing 1.2: HTML Page With Table Markup

The Table is quite simple, contains only two columns, Name and Points.
The code includes a dropdownlist (Select list) to display numbers that the user can select.. Selecting any of the numbers filters the list and displays that number of items in the table

5. Final Notes

I sincerely hope that these lesson helps you to achieve pagination in your page. I do thing it is quite simple provided you already have a knowlede of HTML, AngularJS and JavaScript.
However, if you have any difficulties, just let me know in the comment box below or to the left of this page, so I could speak with you over skype and guide you.

Welldone, my programmer!

Monday, 23 April 2018

How to Fetch SharePoint List using AngularJS and Display on html Page (Explaining the Codes)

Hello, good to see you again.
I am Kindson and today, I'm going to explain to you how to fetch Sharepoint using AngularJS list and display it in html page. I would try to be very clear and easy to follow in this lesson.
So Let's go!

  1. Introduction
  2. The Building Blocks You Need
  3. Understanding the Pieces of the Your Script
    • Initializing the AngularJS App and Controller
    • The GetList() Function
    • The $.ajax() Method
    • Success Function
    • Error Function
  4. Understanding the Pieces of the your html page
    1. The ng-app directive
    2. The ng-controller directive
    3. The ng-repeat directive
    4. Specifying Repeat Items
  5. Final Notes

1. Introduction

In this simple tutorial, you I explain very clearly and in a simple way the ingredients you need to query a SharePoint list and display the content on a html page.
Note that we can perform SELECT, INSERT, UPDATE and DELETE operations on a SharePoint list using AngularJS. In this lesson, we would examine the select operation and in the following lessons we would learn about the other CRUD operations.
How it works is that AngulaJS makes a REST GET request to the SharePoint list and gets a JSON response. It then parses this response and displays it on a page.
Easy? Right? Let's see! ☺

2. Building Block you Need

1. You Need two  AngularJS files: the angular.js file and the angular-route.js file
2. A html Page to display your results
3. The Script code we would write. In this case, we would include the script in the html file using the <script></script tag. But for very large scripts, a seperate file would be needed

3. Understanding the Pieces of the Your Script

Let's start writting the script and as we write, we would be explaining each piece of the script. So now, create a html file  with the basic content:

<script type="text/javascript" src="angular.1.6.2.js"></script>
<script type="text/javascript" src="angular-route.1.6.2.js"></script>
<title> Fetch HTML List Using AngularJS</title>


AngularJS Code goes here

AngularJS+HTML is used to diaplay list of items in tabular form
Listing 1.0: How AngularJS works in HTML page

From the html file, we would write our AngularJS codes inside the <script></script> part.
The we would  write the html codes inside the <table></table> tag to display the data.

Initializing the AngularJS App and Controller

Write this code inside the script block

        var appVar = angular.module('listApp', ['ngRoute']);
        appVar.controller("controller1", function($scope){    
        GetListItems($scope, "Users");            
Listing 1.1: Initializing AngularJS App and Controller

The first line initializes and AngularJS app called appVar. This is done using angular.module method. This method takes the name of the app (you can choose any name) and a second parameter ['ngRoute']

The second parameter ngRoute according to W3school 'allows you to navigate to different pages in your application, while the application remains a single page application(SPA) with no page reloading.

The GetList() Function
This function could have any name.
It is the function that contains the code that actually performs the query to fetch data from the SharePoint list.

I have added line numbers to the code below, for easy explanation

     function GetList($scope, listName){    
            var requestUrl = "sites/KindsonTheGenuis/Lessons/2018/_api/web/lists/getbytitle('" + listName + "')/items";           
            url: requestUrl,    
            method: "GET",    
            async: false,    
            headers: { "Accept": "application/json;odata=verbose" },    
            success: function(data){    
                $scope.items = data.d.results;    
            error: function(sender,args){    
Listing 1.2: AngularJS code to make GET Request to a URL

The function GetList in line 1 takes two parameters. The first parameter is $scope. This parameters makes is possible for  objects declared in the controller code to be available for use in the html page.
The second parameter listName is the name of the SharePoint list you want to access.

The $.ajax() Method
The $.ajax() method is used to  create ajax request.
It takes the following parameter:
url: a string value of the request url to send the request to
async: indicates if wether the request should be
method: specified the HTML method to use for the request. Here we use a GET methods since we are only retrieving data
headers: specifies the headers  such as contenttype

The next two parameters are functions discussed next

Success Function 
This is a function that is run if the request is successfully  executed. In this case, the fuction takes the results of the request and assigns it to the items collection of the $scope object. This makes is possible that the results are available in the view(html page)

Error Function
This is the fuction that is run if the request fails. In this case a message containing the error is written to the console.

4. Understanding the Pieces of the your html page

The page displays the data from the request. So how does this work?
Remember that the data from the request was put in $scope.items. This means that it  can be accessed from the html page.

<div ng-app="listApp">    
    <div id="App1" ng-controller="controller1">    
        <h1>First List Items</h1>    
        <table border="1">
        <tr ng-repeat="item in items">
Listing 1.3: HTML Page displaying AngularJS Content

The ng-app directive
This helps you to specify the root element of the AngularJs application. All AngularJS application must have a root element in the html page.
If this code is specified in a html element, then AngularJS code could be written inside this element. In our case we made the table element the root element. But you can also place this code in the body element of the html code.

<table ng-app='modulename'>
AngularJS code can go here...
modulename specifiess the name of the module to load with the application. Remember that the modulename is given as parameter to the angular.module() method.

Quiz: What is the modulename from our code? ☺

The ng-controller directive
The ng-controller directive attaches a controller to the view(html page).
This means that the functions and variables defined in the controller will be available in the veiw.(remember, our controller is Controller1)

The ngRepeat directive
The ngRepead directive is added to the html page to iterate through a collection of items. Look at the code fragment so you oculd understand how it works.

In our case we have

<tr ng-repeat="item in items">
<td>{{item.Firstname}} </td>
<td>{{item.Lastname}} </td>

Listing 1.4: Using ng-repeat to display a table

This code would create as many rows as there are items in the $scope

Specifying Repeat Items
Repeat items are specified one element below the element containing the ngRepeat directive. So in our case, the ngRepead directive is in <tr> element, therefore, the repeat elements would be in the <td> tag.
Also, the repeat variables are enclosed in double curly braces, like this {{}}

5. Final Notes

If you hav followed this tutorial up to the end, thumbs up to you. If you have any challenges or observation, you can let me know in the comment box below or in the form to the left of this page.

I would also like to let you know that the key to catching up on software tutorials is to practice them yourselft. Secondly, you can get assistance from experienced professionals like me!
Feel free to leave me a message or question

Thanks for your efforts!

Friday, 20 April 2018

5 New Secrets About Crytocurrency in 2018 Revealed (Watch Out!)

Hello, good to see you again!
I really appreciate seeing persons who try to get the real facts about what happens around them.

In this very important article, I would reveals 5 secrets about Cryptocurrency that you could not possibly get from any other source.

I know revealing them is a bit risky but, I would go ahead to reveal them since I have principle of enlightening people and sharing my knowledge. Besides, I would want everyone to benefit from my skills as a Cryptanalyst (Cryptocurrency Expert)

Secret 1: Why the Conspiracy?
Secret 2: Cryptocurrency is a Technology Being Tested
Secret 3: True Identity of Satoshi Nakamoto
Secret 4: Clues from 2017
Secret 5: Safe to Invest in Cryptocurrency
Final Notes

Secret 1: Why the Conspiracy?

When Edward Snowden revealed the mass surveillance programs carried out by the government, his actions were considered treasonable. The question is why? Why would the government blatantly break its own privacy laws? And so on and so forth.

The fact remains not that "You are being watched",  "you are also being controlled". Interestingly, the facts are all out there, just that, the public choose to ignore it, or are too busy to dig a little deep.
Recently, FaceBook was in the court to defend activities related to privacy policy violations. As usual, the naive public don't get much involved and ends up being the lab rats unfortunately.

The fact is this: you have a valuable asset: information which many are giving out without knowing the worth. At least, you need to know.

 I do think that this would come to an end one day, but first the public needs to be enlightened.

Secret 2: Cryptocurrency is a Technology Being Tested

Make no mistakes about it, the cryptocurrency technology in years to come would revolutionalize the way we handle funds. But there is a catch! This is a technology that would end up replacing the existing finantial institutions and digitize all transactions currently based on physical currency.

Now, such a technology cannot just be rolled out. Therefore, since early 1980s when an American cryptographer David Chaum wrote about the idea of electronic money, research has continually been carried out to evaluate the effect of such technology when applied on a global scale. Believe me the test duration would likely expire by the end of this year and we would wait to see the what next.

The question is: Who is behind all this? The answer to this would blow your mind!

Secret 3: True Identity of Satoshi Nakamoto

They told us that bitcoin was created in 2009 by Satoshi Nakamoto. We were also told that he is a Japanese. Then the person is unknown.Stop and think! Do you believe that the inventor of bitcoin would not be known? A technology that makes extensive use of the Internet and www and then the person is now known? This is very funny!

Now this is the fact:
Bitcoin is a colaboration between governments in America, Europe and Asia to control the finances of of the whole world masses in the future. Technology companies are used to achieve this especially - Telecoms firm. The key among them are:
  • Samsung
  • Toshiba
  • Nokia (Alcatel)
  • Motorola
  • and many others....
Read these names once again. So when they cooked up the pseudonym Satoshi Nakamoto, they think everyone would just accept this crap, not me!

Besides, research have been carried out to show that the "person behind the name" that posts information about bitcoin stays in the US. I rest my case!

Not just being watched!!!

Secret 4: Clues from 2017

Bitcoin have been growing steadily since 2009 and currently stands at about 8,810USD to one bitcoin.

But think of what happened in February this year. Bitcoin climbed to above 20,000USD to one bitcoin and then came back down to normal. Do you think this is normal especially knowing that bitcoin is not much affected by the changes in the capital market. This would help you to see that someone is pulling the strings.

What actually happened was part of the test process to see the effect of sharp changes in the currency when it finally goes into production.

Secret 5: Safe to Invest in Cryptocurrency

If you invest in cryptocurrency, not neccessarily bitcoin, be sure that your funds are very safe. The fact is that you may need to wait for a long time to get the benefits.
You may not become rich overnight, but be sure that your money remains.

This is because if the test process terminates by this year, we can be sure that the plans for the actuall production and use would be put in place. So feel free to invest a little on cryptocurrency.

Final Notes

I would advice you to continue taking some time to search for the real facts beyong the obvious. Be sure that I'm here to give response to your questions anytime anyday. What do you think?

Disclaimer: Information presented in this post are not verified and therefore, the  owner of this blog does not take any responsibility for the use of the content of this post.

What is a Linear Seperator? What is a Hyperplane? (Simple and Brief Explanation)

Good to see you again!

Today, I would give a very simple explanation of the concept of linear seperator and hyperplane.
This is would be a very basic and simple, easy to understand explanation, just to help you pass your exam or  a test.☺

  1. What is Linear Seperability?
  2. Formal Definition of Linear Separability
  3. What is a Linear Separator?
  4. What is a Hyperplane?
  5. That is it!

1. What is a Linear Separability?

To answer this quesion we need to first understand the concept of linear seperability.
First, the concept of linear seperation applies to a set of points.

The two sets of points are said to be linearly seperable if a line can be drawn that seperates the points such that a set points is on one side of the line and anothe set of points is on the other side of the line.

Figure 1: Can you figure it out?

Now take a look at Figure 1. Can figure out which set of points are linearly seperable?
For sure, we could see that the answer is Set 3.

2. Formal Definition of Linear Separation

Assuming that the blue data sets represents set of point X0
The red data sets represents set of point X1

Then the two sets X0 and X1 are linearly seperable if there exist n+1 real numbers:
w1, w2, ..., wn, k

such that every point in X0  satisfies the relation

and every point in X1 satisfies the relation

3. What is a Linear Seperator?

From what we've discussed so far, can you say what a Linear Seperator is? It is simply the plane/line that sepearates the two sets of data!
(I must say, that formal definitions make simple concepts appear difficult)

But let's take a formal definition
A linear seperator is a a vector-threshold pair, (w, k) that satisfies the two relations given above

4. What is a Hyperplane?

As I mentioned, sometimes the terms used makes the concept appear complicated. The concepts of hyperplane is very simple: A hyperplane is just a plane that is one dimension less than the current space being considered.

Quiz 1: If a space is a 3-dimensional space, what would be the hyperplanes?
Answers: 2-dimensional plane

Quiz 2: If a a plane is two-dimensional, what would be the hyperplanes?
Answer: 1-dimensional lines

5. Thats is it!

As I mentioned, this is a very basic and simple explanation to help you pass your test. But if you would like to have more detailed explanation, let me know in the comment box below or in the form to the left of this page.

Thursday, 19 April 2018

How to Build a Decision Tree for Classification - (Step by Step Procedure Using Entropy and Gain)

In this Lesson, I would teach you how to build a decision tree step by step in very easy way, with clear explanations and diagrams.

  1. What are Decision Trees
  2. Exercise for this Lesson
  3. The ID3 Algorithm for Building Decision Trees
  4. Step by Step Procedure
  5. Final Notes

1. What are Decision Trees

A decision tree is a tree-like strucure that is used as a model for classifying data. A decision tree decomposes the data into subtrees made of other sub-trees and/or leaf nodes.
A decision tree is made up of three types of nodes
Decision Nodes: These type of node have two or more branches
Leaf Nodes: The lowest nodes which represents decision
Root Node: This is also a decision node but at the topmost level

The question is : How to we build a decision tree? Let's see!

2. Exercise for this Lesson

Consider the table below. It represent factors that affect whether John would go out to play golf or not. Using the data in the table, build a a decision tree to model that can be used to predict if John would play golf or not.

Figure 1: Exercise on Decision Trees

3. Algorithm for Building Decision Trees - The ID3 Algorithm(you can skip this!)

This is the algorithm you need to learn, that is applied in creating a decision tree. Although you don't need to memorize it but just know it. It is called the ID3 algorithm by J. R. Quinlan. The algorithm uses Entropy and Informaiton Gain to build the tree.

S = Learning Set
A = Attibute Set
V = Attribute Values

Load learning sets  and create decision tree root node(rootNode), add learning set S into root not as its subset
For rootNode, compute Entropy(rootNode.subset) first
If Entropy(rootNode.subset) == 0 (subset is homogenious)
      return a leaf node

If Entropy(rootNode.subset)!= 0 (subset is not homogenious)
     compute Information Gain for each attribute left (not been used for spliting)
     Find attibute A with Maximum(Gain(S, A))
     Create child nodes for this root node and add to rootNode in the decision tree

For each child of the rootNode
   Apply ID3(S, A, V)
   Continue until a node with Entropy of 0 or a leaf node is reached

(You actually don't have to worry trying to understand every bit of this algorithm. The application would make is very clear)

4. Step by Step Procedure for Building a Decision Tree

Here I would give you a simple step by step procedure that is super-easy to follow in creating a decision tree no matter how complex it could be.
Start by determining the root of the tree and the class column

Step 1: Determine the Decision Column

Since decision trees are used for clasification, you need to determine the classes which are the basis for the decision.
In this case, it it the last column, that is Play Golf column with classes Yes and No.

To determine the rootNode we need to compute the entropy.
To do this, we create a frequency table for the classes (the Yes/No column).

Table 2: Frequency Table

Step 2: Calculating Entropy for the classes (Play Golf)

In this step, you need to calculate the entropy for the Play Golf column and the calculation step is given below.

Entropy(PlayGolf) = E(5,9)

Step 3: Calculate Entropy for Other Attributes After Split

For the other four attributes, we need to calculate the entropy after each of the split.
  • E(PlayGolf, Outloook)
  • E(PlayGolf, Temperature)
  • E(PlayGolf, Humidity)
  • E(PlayGolf,Windy)

The entropy for two variables  is calculated using the formula.
(don't worry if about this formula, its really easy doing the calculation ☺

There to calculate E(PlayGolf, Outlook), we would use the formula below:

Which is the same as:

E(PlayGolf, Outlook)  = P(Sunny) E(3,2) + P(Overcast) E(4,0) + P(rainy) E(2,30

This formula may look unfriendly, but it is quite clear. The easiest way to approach this calculation is to create a frequency table for the two variables, that is PlayGolf and Outlook.
This frequency table is given below:

Table 3: Frequency Table for Outlook

Using this table, we can then calculate E(PlayGolf, Outlook), which would then be given by the formula below

Let's go ahead to calculate E(3,2)
We would not need to calculate the second and the third terms! This is because

E(4, 0) = 0
E(2,3) = E(3,2)
Isn't this interesting!!!

Just for clarification, let's show the the calculation steps
The calculation steps for E(4,0):

The calculation step for E(2,3) is given below
Time to put it all together.

We go ahead to calculate the E(PlayGolf, Outlook) by substituting the values we calculated from E(Sunny), E(Overcast) and E(Rainy) in the equation:

E(PlayGolf, Outlook)  = P(Sunny) E(3,2) + P(Overcast) E(4,0) + P(rainy) E(2,3)

E(PlayGolf, Temperature) Calculation

Just like in the previous calculation, the calculation of E(PlayGolf, Temperature) is given below. It
It is easier to do if you form the frequency table for the split for Temperature as shown.
Table 4: Frequency Table for Temperature

E(PlayGolf, Temperature)  = P(Hot) E(2,2) + P(Cold) E(3,1) + P(Mild) E(4,2)

E(PlayGolf, Humidity) Calculation

Just like in the previous calculation, the calculation of E(PlayGolf, Humidity) is given below. It
It is easier to do if you form the frequency table for the split for Humidity as shown.

Table 5: Frequency Table for Humidity

E(PlayGolf, Windy) Calculation

Just like in the previous calculation, the calculation of E(PlayGolf, Windy) is given below. It
It is easier to do if you form the frequency table for the split for Windy as shown.

Table 6: Frequency Table for Windy

Wow! That is so much work! So take break, walk around a little and take a glass of cold water.
Then we continue.
So now that we have all the entropies for all the four attributes, let's go ahead to summarize them as shown in below:
  1. E(PlayGolf, Outloook) = 0.693
  2. E(PlayGolf, Temperature) = 0.911
  3. E(PlayGolf, Humidity) = 0.788
  4. E(PlayGolf,Windy) = 0.892

Step 4: Calculating Information Gain for Each Split

The next step is to calculate the information gain for each of the attributes. The information gain is calculated from the split using each of the attributes. Then the attribute with the largest information gain is used for the split.

The information gain is calculated using the formula:

Gain(S,T) = Entropy(S) - Entropy(S,T)

For example, the information gain after spliting using the Outlook attibute is given by:

Gain(PlayGolf, Outlook) = Entropy(PlayGolf) - Entropy(PlayGolf, Outlook)

So let's go ahead to do the calculation

Gain(PlayGolf, Outlook) = Entropy(PlayGolf) - Entropy(PlayGolf, Outlook)
= 0.94 - 0.693 = 0.247

Gain(PlayGolf, Temperature) = Entropy(PlayGolf) - Entropy(PlayGolf, Temparature)
= 0.94 - 0.911 = 0.029

Gain(PlayGolf, Humidity) = Entropy(PlayGolf) - Entropy(PlayGolf, Humidity)
= 0.94 - 0.788 = 0.152

Gain(PlayGolf, Windy) = Entropy(PlayGolf) - Entropy(PlayGolf, Windy)
= 0.94 - 0.892 = 0.048

Having calculated all the information gain, we now choose the attribute that gives the highest information gain after the split.

Step 5: Perform the First Split

Draw the First Split of the Decision Tree
Now that we have all the information gain, we then split the tree based on the attribute with the highest information gain.

From our calculation, the highest information gain comes from Outlook. Therefore the split will look like this:

Figure 2: Decision Tree after first split

Now that we have the first stage of the decison tree, we see that we have one leaf node. But we still need to split the tree further.

To do that, we need to also split the original table to create sub tables.
This sub tables are given in below.

Table 7: Initial Split using Outlook

From Table 3, we could see that the Overcast outlook requires no further split because it is just one homogenous group. So we have a leaf node.

Step 6: Perform Further Splits

The Sunny and the Rainy attributes needs to be split

The Rainy  outlook can be split using either Temperature, Humidity or Windy.

Quiz 1: What attribute would best be used for this split? Why?
AnswerHumidity. Because it produces homogenous  groups.

Table 8: Split using Humidity

The Rainy attribute could be split using  High and Normal attributes and that would give us the tree below.

Figure 3: Split using the Humidity Attribute

Let't now go ahead to do the same thing for the Sunny outlook
The Rainy  outlook can be split using either Temperature, Humidity or Windy.

Quiz 2: What attribute would best be used for this split? Why?
AnswerWindy . Because it produces homogenous  groups.

Table 9: Split using Windy Attribute

If we do the split using the Windy attribute, we would have the final tree that would require no further splitting! This is shown in Figure4

Step 7: Complete the Decision Tree

The complete table is shown in Figure 4
Note that the same calculation that was used initially could also be used for the further splits. But that would not be neccessary since you could just look at the sub table and be able to determine which attribute to use for the split.

Quiz: What does each of he color represent in the tree? 
Leave your answer in the comment box below

Figure 4: Final Decision Tree

5. Final Notes

Now we have successfully completed the decision tree.
I think we need to celebrate with a bottle of beer!
This is how easy it is to build a decision three. Remember, the initial steps of calculating the entropy and the gain is the most difficult part. But after that, everything falls into place.

Do let me know if you have any challenges. Write me in the comment box below or in the form at the left of this page.

Thanks for reading!!!