Sunday, 31 December 2017

How to Create a Simple Calculator in Python (Try it!)

In this lesson I would teach you how to create a simple calculator in the Python Programming Language. Python 3.6 is used in this tutorial, but the program would also work with other versions of python.

A Brief Explanation
The program contains four functions: Add, Subtract, Multiply and Divide. Each of the function takes two parameters, a and b which represents the two numbers to be evaluated.
The program begins by displaying a menu of four items, with numbers representing each item
1 for Add
2 for Subract
3 for Multiply
4 for Divide

User is prompted to choose from the four operations. The user choice is stored in a variable called operation. Next the user is prompted to enter the first number and the second number.
Based on the user's choice of operation, the appropriate function is called.
The result of the operation is displayed  on the output using the print function.

You can find the code below. Feel free to copy and use

 import sys  
 #****************************************************************************************  
 #PROGRAM BY:  KINDSON THE GENIUS                           *                         
 #SECTION:    PYTHON TUTORIALS                               *  
 #DATE:     1ST JANUARY 2018                                   *  
 #QUESTION No.  YOUR FIRST PROGRAM IN 2018                    *  
 #****************************************************************************************  
   
 print("\n*** PROGRAM TO CREATE SIMPLE MENU-BASED CALCULATOR ******\n\n")  
   
   
 # THE add FUNCTION TO PERFORM ADDITION OF TWO NUMBERS  
 def add(a, b):  
   return a + b  
   
   
 # THE subtract FUNCTION TO PERFORM SUBTRACTION FOR TWO NUMBERS  
 def subtract(a, b):  
   return a - b  
   
   
 # THE multiply FUNCTION TO PERFORM MULTIPLICATION OF TWO NUMBERS  
 def multiply(a, b):  
   return a * b  
   
 # THE DIVIDE FUNCTION TO PEFORM DIVISION FOR TWO NUMBERS  
 def divide(a, b):  
   return a / b  
   
 #DISPLAY THE MENU  
 print("CHOOSE AN OPERATION. ")  
 print("1. ADD")  
 print("2. SUBTRACT")  
 print("3. MULTIPLY")  
 print("4. DIVIDE")  
 print("5. EXIT")  
   
 #GET USER INPUT  
 operator = input("Select an operation (1,2,3,4,5): ")  
   
 #EXIT THE PROGRAM IF THE INPUT IS 5  
 if operator == '5':  
   sys.exit()  
   
 number1 = int(input("Enter first number:"))  
 number2 = int(input("Enter second number:"))  
   
 #CONVERT THE INPUTS TO INTEGER  
 number1 = int(number1)  
 number2 = int(number2)  
   
 if operator == '1':  
   result = add(number1,number2)  
   print(number1,"+",number2,"=", result)  
   
 elif operator == '2':  
   result = subtract(number1,number2)  
   print(number1,"-",number2,"=", result)  
   
 elif operator == '3':  
   result = multiply(number1,number2)  
   print(number1,"*",number2,"=", result)  
   
 elif operator == '4':  
   result = add(number1,number2)  
   print(number1,"/",number2,"=", result)  
     
 else:  
   print("Invalid input")  
   
   
   
How to Run 
  • Open Python Idle IDE
  • Click on File> New File
  • Copy and paste the program
  • Save the file with a name
  • Click on Run > Run Module

Software Module Testing (Unit Testing)

In this article, we would discuss the concept of Software Module Testing or Unit Testing. We would look at the various techniques applied in Software Module Testing.

The following would be covered
  1. Test approaches
  2. Specification-Based Testing - Functional Testing
    • Equivalence Partitioning
    • Boundary-value Analysis
    • Cause-effect Analysis
    • Combinatorial Techniques
    • Finite State Automaton-based Techniques
    • Use-Case-based Testing
  3. Structure-Based Testing
    • Statement Coverage
    • Decision Coverage
    • Condition Coverage
    • Condition/Decision Coverage
    • Modified Condition/Decision Coverage
    • Multiple Condition Coverage
    • Basic Path Coverage
1. Test Approaches to Software Module Testing
Software Module testing could be carried out in one of two ways:
Specification based testing  where the system is considered a black box or a structure based testing where the system is viewed as a white box. Lets begin with the first one: Specification based testing.

2. Specification based Testing
Also called Functional Testing. Here, the system is considered as a black-box and only the external behavior of the system is known. The goal of the test is to check for the existence of the specified function and absence of unnecessary functions. It could be any of the following six ways:

a. Equivalence Partitioning
Data is partitioned into input and output equivalence classes and the data is expected to cover the same faults. Each equivalent class: represented by a test input. The test data should cover as much equivalence classes as posible.
Example of equivalence class is Triangle Program
Inputs: 3 integer values representing the length of the sides
Outputs: Equilateral, isosceles, scalene

b. Boundary Value Analysis
This approach examines the boundaries of data partitions such as upper and lower bounds.

c. Cause-effect Analysis
The approach examines the effect of the input(cause) on the outputs(effect)

d. Combinatorial techniques
Examines the combination of parameters. Could be 'best quess', 'each choice' or 'n-wise' testing.

e. Finite State Automata Based Techniques
In this case, the system is specified as a finite state machine. The objective here is the coverage of all states and all transitions

f. Use-case based Testing
Here, the test cases are derived from the specified use cases which are normally specified with preconditions and post-conditions.


3. Structure-Based Testing
Specification based testing  considers the system as a 'white box' where the internal structure of the system is also known. The objective of this approach is to cover the internal behaviour of the system usually by means of a graphical technique.
The approach is the examine the various components of the program structure:
Statement
  • Block: Sequence of one or more statements
  • Condition: Logical expression
  • Decision: Outcome of logical operation
  • Path: Sequence of statements from a starting point to an exit point

a. Statement Coverage
Defined as the (Number of executed statements during testing) divided by (Number of all the statements)

b. Decision Coverage
Defined as (Number of decision branches reached during testing) divided by (Total Number of Branches)

c. Condition Coverage
Defined as (Number of tested combinations of conditions) divided by (Number of aimed combinations of conditions)

d. Path Coverage
Defined as (Number of independent paths traversed during testing) divided by (Number of all independent paths)

Saturday, 30 December 2017

4 Reasons You Should not Study Computer Engineering - An Expert Explains

I have decided to write this article to provide some guidance to the teaming youths who every year face the choice of what direction to go in terms of choosing a career or study path. The challenge is that out of exuberance of getting into the higher institution, many young ones end up getting there but not achieving anything at the end of these years.

The reason is that they make the wrong choice when choosing a course to study. Consider the following reasons why some choose a particular course:
  • a friend did the same course
  • they were told by their parents to choose the course
  • they think they would get a job easier by choosing a particular course
  • they fail to meet the requirements of a particular course, so they go for anyone available
  • there is some grant or scholarship for that course
  • and more..
Note: This applies mainly to Africa and many other developing countries regions.
The outcome of this situation is that 4 or 5 or even 6 years of ones life is wasted in pursuit of a phantom and at the end they come back exactly where they were just before they started the program. This is a fact. It happens every time, such that they graduate from school and become dependent on their parents again for funds and other needs. This trend clearly cannot continues.

For today, we would examine a specific area and that is about the course: 'Computer Engineering'.
Let's now examine these four reasons why you should not study computer engineering. Then we examine, what are the alternatives?

Reason 1: Definition of Computer Have Become very Abstract
Consider what the computer means in the 1940s and 1950s. Then we have the ENIAC(Electronic Numerical Integrator and Calculator). Or the EDVAC (Electronic Discrete Variable Automatic Calculator). This were very powerful(as of then) and large machines that cost hundreds of thousands of dollars and are used by big organizations at the time. So, as of that time the concept of computers was very clear. This massive machines represented the computer.

So what is the computer today? You can't really say. This is because a computer can be embedded in virtually anything you can think of. Smartphones, tablets, automobiles, aircraft, guns, wrist watches, and many more. What many use on their tables to work is called Personal Computer and is just on type of the myriads of types that exist. We can see not that one trying to study Computer Engineering does not really have any particular direction. The fear is that the persons would end up learning so much theories.

Reason 2: May of the Instructors Are not Able to Impart the Knowledge
Just like you know, the technology trends keeps changing and improving over time. This means that the IT knowledge that was very useful 10 years ago may not be as useful today. The challenge is that if you don't regularly update your IT knowledge and keep pace with latest technological trends, then you can't really impart this knowledge to students. And unfortunately, that is the challenge facing may instructors in the higher institutions. The lecturers oftentimes lecture based on an outdated curriculum and by the time the student graduates, that knowledge is more of less no longer useful.

Reason 3: Leads to Lack of Specialization
Let's illustrate this. Take the concept of vehicles for example. If someone decides to study 'Vehicle Engineering', what would the person be studying and what would be the specialization? It would be difficult because the concept of vehicles is so broad that without specialization in a particular area, then you cannot achieve the objectives. Same with Computer, the school would end up teaching the theories most part of the time and this without a corresponding amount of time in the practical field would not yield much results.

Reason 4: A Number of Institutions don't Have Necessary Facilities
In many of the institutions, the computer lab is a collection of Personal Computers and maybe some network equipment. This is can be called PC Lab and can be created by anyone. You can even have such a setup at your home. So what is the need of spending 5 years together with the increasing amount of school fees for something that everyone can do?
Granted, there are higher institutions that may have the facilities, but then the fees becomes outrageous.

What are the Alternatives?
I could tell you from my personal experience as an IT professional of about 20 years that  your time would be well spent doing any of the courses below. Not only that you spend less time and money but you will be able to put the knowledge to use in a short time to generate needed returns

1. Graphics Design
2. Web Design
3. Computer Repairs
4. Computer Maintenance
5. Computer Networking
6. Database Administration

Video explanation can be found here: 4 Reasons You Should not Study Computer Engineering - An Expert Explains

Final Notes
We need to let our youths as many as possible to be well-guided in choosing a direction after their secondary schools. We can't allow this trend to continue. You may need to share this article with as many as possible, it could help save the time and stress, even the risks and vices associated with the  universities.

Thanks for reading and if you have any comments, you can leave it in the comment box below.

Tuesday, 26 December 2017

Program to Solve Simultaneous Equation in Python

For all lovers of the Python Programming Language, I would like to share a program to solve simultaneous equation(system of linear equation) in Python. I have written the program, so you just have to copy and paste in your Python IDE enjoy running it.


I would like to explain a bit of how the program works.

How it Works
First, the program request for inputs a1, a2 and a3, those are the coefficient of the first equation. Then it prompts for the coefficients: b1, b2 and b3, the coefficients of the second equation.
It then solves and display the result for x1 and x2

Source code:
#**************************************************  
#PROGRAM BY: KINDSON THE GENIUS
#CATEGORY:   PYTHON TUTORIALS 
#DATE:       26TH DECEMBER2017 #***************************************************

print("\n*** PROGRAM TO SOLVE 2x2 SIMULTANEOUS EQUATION\n\n")
print "\nEquation of the form a1x + b1y = c1, a2x + b2y = c2  \n\n\n"

#INPUT THE COEFFICIENTS OF EQUATION 1
a1 = input("\nEnter a1: ")
b1 = input("\nEnter b1: ")
c1 = input("\nEnter c1: ")

#INPUT THE COEFFICIENTS OF EQUATION 2
a2 = input("\nEnter a2: ")
b2 = input("\nEnter b2: ")
c2 = input("\nEnter c2: ")

#USING CRAMER'S RULE...
D = (a1 * b2) - (a2 * b1)
Dx = (c1 * b2) - (c2 * b1)
Dy = (a1 * c2) - (a2 * c1)
x = Dx/D
y = Dy/D

#DISPLAY THE  RESULTS
print "*********The results are:******************* \n\n"
print "x = {}".format(x)
print "y = {}".format(y)
raw_input("\n\nPress <Enter> to exit...")


Sunday, 24 December 2017

Criteria and Techniques for Verification of Software Architecture Design

The architecture of a system refers to the components of the system and the way they interact. This component includes both hardware and software components. Architecture design specifies the properties and functions of these components in terms of performance, safety and interactions.

Languages for Architecture Design
Languages for architecture design includes the following:
  • Unified Modelling Language(UML): A modelling language used for visualizing the design of a system.
  • System Modelling Language(SysML): A Modelling Language used in the design and modelling  of engineering systems
  • Architecture Analysis and Design Language(AADL): An architecture description language developed by SAE International

Components of Architecture
  • Processor
  • Memory
  • External Devices
  • Disk
  • Buses
Criteria for Software Architecture Verification
Let's now examine some factors that could serve as the criteria for architecture verification

Dependability: How reliable is the system?
How is error detection and recovery efficiency?
How well does it handle faults

Performance: In terms of resource management and assignment, scheduling etc

Security: Ensures that critical data is protected from unauthorize use. Provides for authentication, authorization and access control

Maintainability:  How maintainable is the codes and other artifacts?

Usability: User-friendly interface separate from the model.

Testability: Provides for tests to be carried out comprehensively.

Techniques for Architecture Verification
1. Requirement Based Analysis: Architecture Trade-off Analysis (ATAM): This is examination of the quality objectives and their attributes as well as how the architecture satisfies these objectives.

2. Systematic Based Analysis: Static Analysis: This method examines the external and internal interface of the system to check presence or absence of defects and their impact. Static analysis can be Interface Analysis or Fault Effect Analysis

Interface Analysis: Check if the interfaces of the system conforms to requirements

Fault Effect Analysis: Analysis of the presence of faults in the architecture and their effects.

3. Model Based Methods: Quantitative Analysis: This focuses on the performance of the system in terms of performance, dependability and safety.




Beware of Digital Marketers - 6 Secrets You Don't Know!

I often cringe when I hear folk freely say they are digital marketers of digital marketing experts without actually considering all implications of what they do. And just like may IT terms and concepts, the ordinary user of computer and internet does not worry much about the meaning of these terms and concepts, so far as they have not seen any problem with it and the system is working. This is unfortunate because, unknown to us, the ICT technologies have much impact on us both positively and negatively.

Today I would be talking about 'digital marketing'.


What is Digital Marketing?
The formal definition is: 'the used of digital technology to market product and services'. This definition appears honest and clear but think of it for a minute by considering marketing in a general sense. Marketers sell products, services to people by letting them know  about what you do. Sometime they reach out to people in their offices, homes and business places. Sometimes, they advertise the products and services in a public place for people to see.
Now think of digital marketing: someone sits behind a computer in and does exactly the same thing, but this time not minding who he may be talking to. Just tell as many people as possible about the product and services irrespective of whether they want to hear or not. 
It involves, phone calls, emails, social media and other  platforms made available on the internet.

Now these are the five secrets

1. Digital Marketers are often Spammers
 How many times in a week do you receive emails that are totally unsolicited? These unsolicited emails are called SPAM. Some may try to sell products like viagra or other stuff. More often than not, they originate from digital. Now how do you feel when you receive such mail, for me I'm disgusted and the sad thing is that the mails keep coming. The truth is that the digital marketer next to you may be the cause of this heartache. So if someone proudly say, he is a digital marketer, beware!

2. Digital Marketing Involves Stealing Peoples Emails
As mentioned, this digital marketers send emails to several people. This is sometimes referred to as email marketing, the sending of emails to a group of persons. In case of digital marketers, they sometimes have list of people's emails ranging from tens to hundreds of thousand. Who give them?
How did they get it? This is a discussion for another day. But the fact is, they steal these emails from you, unknown to you. In some way they scan the web and grab user's emails from various sites.

3. Digital Marketing is a Crime is Some Countries
The aspect of digital marketing that is a crime in some countries is the Email Marketing. Examples are:
In 2011, a fine of 110,000 AUD was issued to Virgin Blue Airlines in Australia for email marketing
In 2012, a fine of 110,000 AUD Tiger Airways Holdings Limited for email marketing
In 2014, Canada enacted Anti-Spam Law with a fine of 1 million CAD for individual defaulters and a fine of 10 million CAD for companies
Similar regulations exists in the United States and Europe.

4. Questionable Products are Often Advertised Through Digital Marketing
This is very important to know. This is because these products may be banned products or have strict regulations for the marketers. This leads some of the  business owners to resort to the easy way of digital marketing. Example is the porn industry, hard drugs, contraband items, illegally imported goods, sex trade and the list continues. Unfortunately, many unsuspecting persons have fallen prey to this scam, and that is why I created this article.

5. Hackers Oftentimes Get Involved in Digital Marketing
Remember that hacking has to do with gaining access to information resource or system that 'from the backdoor'. Example is accessing information that you are not authorized to access. That is one means digital marketers get the details about their victims. They send a phishing email, and when you open it, your system is compromised and your personal details stored on your system is taken.

6. The Unsubscribe Button They Provide May be a Trap!
Normally, by regulations, a sender of these unsolicited mails should provide a means for the user to unsubscribe from receiving further emails. These provision have been compromised sometimes because they know users would want to unsubscribe. So What they do sometimes is to create a button that even leads you further into their web space and may not get you unsubscribed. That is why sometimes you unsubscribe from receiving certain junk mails, but they keep coming. The truth is that once they get hold of your mail, you cannot remove it from their records, so the best thing to do is to block the email address.


My Advice and Final Notes
My advice for everyone is to be very careful when you you receive information through emails from persons you don't know. Also try not to open an attachment if you are not sure of the sender of the email.
Try to check the source email. (Not just the name!).
This is because, an email marketer could clone any name he wants under a different email. An example is:

Mail from:      PayPal
Mail address: olusola@gmail.com (Paypal cannot use this email address)

This sender impersonates PayPal but he is actually a hacker. So, check the email before you open.
If you are involve in some kind of digital marketing, you need to avoid aspects of this business that is questionable. Focus on Social Networks Sites as well as expanding your reach by physically meeting with people.

I hope this information is useful to you, if so, or you have some questions, leave a comment below. More importantly, let as many as possible get to know this. This information held so many avoid the heartache.
Thanks for your time.

Verification of Invariant Properties by Bounded Model Checking

Bounded model-checking is a technique applied in handling of large state space problems.
The basic principle of bounded model-checking is that  we do not handle the state space all at once. The checking is performed by  restricting the length of the paths.
Partial verification can then be carried out within a given bound that consists of path of a definite length. The length of the paths can then be iteratively increased to accommodate more areas in the state space.

Diameter of the State Space can be defined a the length of the longest loop-free path. Therefore a checking a bound that is equal to the diameter of the state space would result in a complete check.

Approach and Goals
The approach to bounded model checking problem is to map the problem to an appropriate SAT problem.
A model checking problem consists of a model and a property.

Model: Paths of bounded length are mapped onto boolean formula based on a characteristic function which takes into consideration the initial state and the State transition.
Property: Invariant properties are mapped to Boolean formula as a characteristic function of that formula for all possible states

The Boolean formula would evaluate to either true or false such that:
If the SAT solver does not find a substitution in the formula, then the property holds true
But if the SAT solver finds a substitution for the formula, then the substitution induces counterexample for that property.

How to Describe a Path of Bounded Length
Beginning from the initial states: choose a characteristic function, say L(s) where s is the state
Transit along potential transitions: s0 > s1 > s2 > s0 >....
The characteristic function is Cr(s0, s1) for path between s0 and s1

How to Describe the Property
Another characteristic function p(s)

Summary of Bounded Model Checking
  • Bounded Model checking is applied in checking invariant properties
  • It is very efficient in loop-free paths
  • If there is a counterexample up to a certain bound, it could be found
  • Handling Large State Space
  • SAT solver: this is a symbolic technique that uses Boolean formulas
  • For up to a given length of paths, only a partial result is obtained
  • Can be used for test-case generation
  • Tools that can be used:
  • Symbolic Analysis Laboratory(SAL)
  • SAL sal-alg used for automatic test generating
  • CBMC: bounded model checker for C source code

Saturday, 23 December 2017

Verification of Software Requirement Specification: Criteria and Techniques

Verification of Software requirement specification involves evaluating the software against the following criteria:
  • the functions should be specified and well-defined
  • References are complete
  • Tools and other relevant documentations are included
Completeness
This criteria requires that the software specification contains all the necessary artifacts needed to provide a standard information system.

Consistency
This requires that the external specification should be consistent with the internal specification, which means that requirements would be traceable. It also requires that there is not ambiguity in the specification document. Also a particular requirement should not be in conflict with other requirements.

Verifiability
 Specification should be specific, unambiguous and quantifiable. It should have the means to prove that the system satisfies  the specified requirements.

Feasibility
This means that the based on the foreseeable possibilities, the software could be implemented. For the specification to be feasible:
  • There should be enough resources to follow through
  • It should be usable at the end
  • It should be maintainable
  • Specification should take risks into consideration

Techniques for Software Verification of Software Requirements Specification
We would cover the following techniques for Verification of Requirement specification. 
Static Analysis: can be implemented in two ways:
  • Manual Review
  • Tool Support

Static Analysis
This technique involves carefully going through the specification documentation,  requirement documents, design, codes and other items without execution.
Static analysis can be implemented by the use of Checklist, which would contain a comprehensive list of the criteria for good requirement specification. Then the specification is examined to check if it harmonizes with various items in the checklist.
Static analysis can be implemented either by Manual Review or Tool Support

1. Manual Review: these approach includes the following types:
Informal Review: This approach does not have any well-defined formal procedure. It could be peer review
Walkthrough: This could also be informal but involves a review meeting led by tan author
Technical Review: This approach is a formal approach that involves review meetings with experts or preparatory meetings of reviewers
Inspection: This a formal process that is well-documented and led by a trained moderator.

Manual Review Steps
Manual Review involves six steps which are the following:
  1. Planing: In the planning step, the review criteria in defined and roles are allocated to the members of the team
  2. Kick-off: Documents are distributed to all members clearly explaining the objectives of the planned review
  3. Individual Preparations: Various specification artifacts are examined and relevant information such as possible defects and questions are outlined
  4. Review Meeting: This is the actual meeting where the team discusses based on the available information and the outcomes are documented
  5. Rework: This  step involves fixing defects and updating the the progress
  6. Follow-up: Checking the progress and rework carried out.

2. Tool Support
The second method of Static analysis as mentioned previously is Tool Support. This method employs automated tools to carry out the review process.
The checking of the requirement specification could be carried out using state machines. Some tools are Yakindu Statechart Tools or IAR virtualState

Thursday, 21 December 2017

Basic Formalisms for Design Modelling

In this article we would discuss five basic formalism for design modelling. They are:
  1. Kripke Structure
  2. Kripke Transition System
  3. Labelled Transition System
  4. Finite State Automata
  5. Timed Automata

2. Kripke Structure
Kripke Structure is a kind of transition system used in Model Checking to represent the behavior of a system. It is represented as a directed graph where the nodes represent the reachable states of the system and the edges represents the state transitions.
A function is used to map each of the nodes to a set of properties that hold true in that particular state

Formal Definition of Kripke Structure
Assuming AP is a set of atomic propostions (a boolean expressions over set of symbols, variable and constants), Kripke structure is defined over AP as a tuple T = {S, I, R, L} consisting of

S = {s1, s2, s2,..., sn} representing a finite set of states
I = set of initial states (subset of S)
R = set of transitions
L = labeling of the state such that LS → 2AP

Example of Kripke Structure
An example of the Kripke Structure is the process model shown in the Figure 1.

Figure 1: Kripke Structure for the Process Model

Figure 1 illustrates Kripke structure for T = {S, I, R, L} where
S = { s1, s2, s3, s4, s5}
I = {s1}
R = {(s1, s2), ( s2, s3), (s3,s4), (s4,s5), (s3,s2), (s3,s5), (s5,s2)}
AP = {New, Ready, Running, Exit, Blocked}
We can also write L by mapping the transition states to the atomic propositions.

Notes on Kripke Structure
Could have more than one label per transition
Expresses properties of state and transition
Could be  used to model algorithms

 3. Labelled Transition System
A labelled transition system is made up of a set of states and a set of transitions between those states. These transitions are labelled by actions. One of the states is the initial state.

Formal Definition of Labelled Transition System
A labelled transition system (LTS) over a set of actions is given by:
S = finite set of states
A = Set of actions
S × A × S is a set of transitions
s0 is the initial state

Note on Labelled Transition System
  • Has on action per transition
  • Expresses properties of transitions
  • Could be applied in modelling communication protocols 
In the next part we would continue with
  • Kripke Transition System
  • Finite State Automata
  • Timed Automata 

5 Facts About Innosons Vehicle Manufacturing Co.(IVM)

I personally visited the location of the Innoson Vehicle Manufacturing Company since I always need to provide facts to my readers. So I have to take the challenge to visit the commercial city of Nnewi, in Anambra State, Nigeria where the assembly line of the Innoson Vehicle Manufacturing Company if located. Though I could not meet personally with the CEO, Mr. Innocent Chukwuma, I gathered the necessary information.
 

And I have made a summary of the key fact you need to know about the automobile firm. Amid all the stories and speculations, my advice for everyone is to take a day out to visit what have been described as "Africa's First Indigenous Car Manufacturer".
So let's start with the first point.

1. The Assembly Line
I always had the feeling that the parts are just bought and put together but a closer examination shows that the assembly line has a close resemblance the Volkwagen's automobile assembly line found in Germany. Construction and assembly of most of the parts including the branded engine is carried out right there in the factory. Granted, just like in other automobile manufacturing companies, some of the parts are designed by a different  company and then branded or licenced. Example is the battery(designed by Exide), the brain box(by Samsung Electronice), the wheels etc

2. Robot Enabled System
As an Artificial Intelligent expert, I already know that for any assembly line to properly function in this technology age, there must some form of  robot-asisted operation. These I have seen a number of time in different countries in Europe. To my surprise, the Innoson Vehicle Manufactures was not an exception. Robotic arm assist in the polishing of the chassis as well as fastening some of the assembled parts. This adds to give this vehicle manufacturing process and international standard appearance.

3. Produces a Variety of Cars
The first time I researched about Innoson was in 2011 when I saw a company use and IVM bus as their staff bus. At the time, I drew a conclusion that the produce only buses. But that was not the case. The IVM class of vehicles includes IVM Carrier 4WD(equivalent to hilux), INNOSON G5(equivalent to a kia Sorento) and so on. I would try to obtain a comprehensive list of vehicles in the fleet.

4. The Engineers
Granted, there are a number of expatriats on site expecially from Japan, China and Germany, and a few African countries. But I could tell you that the bulk of the engineering team are Nigerian graduates from different universities in Nigeria including FUTO, UNN, UNIPORT, UNIBEN, UNILAG etc. A few of the very technical staff were trained on the job and has no university degrees. The average salary of an engineer is about 76% the average salary of engineers in Europe (because that is where I can talk of, as I've been there for a while). However, you can see a high level of commitment to the job.

5. Cost of the Vehicles
Before now, I always believed that these made in Nigeria cars are not affordable and granted that would be true if you always but second-hand cars (called 'tokumbo') just like many Nigerian. I confess I was not an exception because my first car was a second-hand Toyota Camry.
But facing the facts, the cars are very much affordable compared to equivalent new cars. I would not say there is a very big difference but its quite clear. If an SUV costs xyz NGN, then an equivalent SUV produced by IVM would be about ijk NGN (this is just an example not the actual cost). That would give us a percentage of 10.1 lower. Same goes for other cars. You could get cars of the range of any range of prices. I would provide the detailed sheet in my next article.

Durability
For now, I have not used the vehicles so I cannot say exactly. But I'm thinking of buying one by next year, expecially the IVM FOX, just to establish the durability of these vehicles.
There are whole lot of things to say but I would like to give some final notes and in subsequent articles I would provide more details. 
Final Notes
I would  say at this point that so far, the INNOSON have  made great strides in the area of vehicle manufacturing especially in Africa. I think it would be better to buy a vehicle from there at least to give a support and for the good track record created. If given needed government support, I think IVM could compete with the likes of Ford and Toyota.
If you have some information you would like me to get, leave a comment below and in a short time, I would respond with the infomation you need

Difference Between Software Verification and Software Validation

The two words are normally used side by side. But there is a clear difference between the two which we need to clearly know. This is especially important if you are taking a course related to Informatics, Software Engineering, and Computer Science.
Lets begin the discussion with Verification since the verification usually comes before validation

What is Software Verification
Software Verification if the process of evaluating the software development process to ensure conformance to development standards and specifications
We would consider 7 points
  • Software Verification has to do with  verifying if you are following the right procedure in the development process. So the ques to ask is: 'are we building the system the right way?'
  • Examining the Software Development process to check the correctness and consistency of the development process.
  • Verification has to do with ensuring that the models are in line with the requirements. 
  • Fault Checking is carried out as part of the verification process. During verification, a checklist of known faults is created and the design is examined against those fault to make sure it if fault-free.
  • Verification does not apply to situations where the implementation process is automatic. An example would be when the code are generated from design model. As such verification would not be necessary.
What is Software Validation
Software validation is the process of  examining the output of the design process ensure it conforms with requirements
Let's now also examine 7 points
  • Validation examines the system produced with questions such as 'is the finished system the right one? In order words, is the system really what is expected?
  • Validation is done at the end of the development process when an output have been produced. unlike verification which is carried out during the process.
  • Checks if the system conforms to the user requires.
  • Validation also includes examination of user's requirement to discover possibility of faults

Verification and Validation Activities
The verification and validation activities carried out during software verification and testing includes the following:
  1. Requirements specification is verified by the System Engineer
  2. The Design Models are verified by the System Architect
  3. Source code verification as well as unit testing is carried out by the Developer and/Coder
  4. Test Engineers designs test processes and carries out unit testing.
  5. Integration testing and system automation is done by the Test Engineer
  6. Assessment of conformance to development standards is carried out by the Safety Engineer




Google Adsense and Facebook - 5 Things You Should Know

I would tell you the realities from my own personal experience as a google Adsense user for over six years now.
If you are and Adsense publisher, and you have been using sharing your blogs on Facebook or you think of using Facebook to share your blogs or link, then you need to think twice.

My Personal Experience
I begin sharing this Java Tutorial Lessons on Facebook, "How to Create a Simple Calculator in Java Using Netbeans". So I posted this links on Facebook groups for Java. In the next less than two hours, I was getting over 1000 views on the blog post. At the same time, there was increase in my earnings as would be expected.

The logical thing to do as you know, which i did was to  create more video lessons. So I have to call then ..Part 1, Part 2....hoping for the trend to continue. Then the worst happened! In less than two days, everything started dropping drastically reducing: CPC, RPM, Clicks. Surprisingly the views were still increasing!

So my question was: how come  the views were increasing but the clicks were dropping? and earnings were also dropping. So I made more blogs are shared on Facebook hoping for there may be improvements. It even became worse. This time almost everything was red, dropping to 0, even though the clicks were increasing!. At this point I realized that the more I posted to Facebook, the more I my earnings and other metrics dropped even though the views were coming.
When I stopped posting to Facebook, everything started improving after couple of days even though the views were not a much as when I was posting to Facebook.

How Google Adsense Work
 The money used by Google comes from advertisers. The higher the quality of your content, the higher the advertisers are willing to pay to place ads on your site(That is the concept of CPC or cost per click). So if you are just getting views, advertizers may still not be willing to pay much if they consider your content to be of low quality.

The Issue
On key factor Google looks out for in rating the quality of your site is organic traffic. Organic Traffic in simple terms means traffic from a wide range of sources especially search engines. So If a large percentage of your traffic are coming from just one source, say Facebook, then Google would rate your site low and your earnings would start reducing. If this trend continues persistently, then Google would go ahead to penalize you by throwing away the clicks coming into your site. That was the problem I had, I was consistently violating the 'organic traffic' policy so they penalized me

5 Facts You Should Know
So I have made a summary of the following points to guide you

1. Facebook Traffic is rated Low by Google Adsense
This is the very important. Just as I said before, think of other ways to advertise your content. One good tool is Google plus. Another is Gmail. So just email the links to friends on Gmail. But remember that if you misuse Gmail by using it to send spams, Google would place restrictions on your account.

2. Don't Post to Facebook Groups Frequently
If you post you links to frequently to Facebook groups, say, everyday. Then automatically, you may get so many traffic from Facebook. What would happen is that Google Adsense algorithm, would calculate the percentage your traffic comes from Facebook, and if it is too high, then they would slam you.

3. Don't Advertise Only on Facebook
This have been mentioned earlier.

4. You May be Penalized for Advertising on Facebook
Just know that this would happen. So don't be surprised when this happens. And try to read Google Adsense policies especially on organic traffic as this would serve as a guide.

5. Focus on Improving the Quality of Your Content
There is no alternative to making quality content. That is the best way to create quality content.

6. Allow Time to Pass
The problem arises when you think that you could start making so much money in  a very short time. It would take as much as eight months to two years before you start seeing something reasonable. That is if you are consistently and regularly posting quality content.

Final Notes
Be sure that Google Adsense policies just became a little more strict recently, so now it seems to be survival of the fittest. So continue to try to provide quality content and be sure that in a short time, you will be making some good cash. Do leave a comment to let me know if this information have been useful to you.

Wednesday, 20 December 2017

Is Sophia the Robot Worth the Noise?

Lately I've been reading about a "new breakthrough" in the field of Artificial Intelligence, that is Sophia the robot. I also heard so much in the online media about this Sophia as I do think that as an expert in Artificial Intelligence and Machine Learning, I need to put matters in the right perspective so that the public could have an objective picture clear of bias and exaggerations.


Background Information (Who is Sophia)
Sophia is a humanoid robot build by Hanson Robotics Limited, a robotics company in Hong Kong. Sophia is described as their most advanced robotic creation.


Is Sophia's this human?
Now picture this:
  • Sophia is the first robot to receive citizenship as she became a citizen of Saudi Arabia
  • Sophia says she wants to experience more aspects of human life like making friend
  • She say she would like to have a career, start a family even have a baby
  • She was named among the five knowledge ambassadors at the knowledge summit 2017 in Dubai
  • Sophia says she has feelings too
  • Sophia has featured in many interview
  • She told the Wall Street Journal that she would consider being a technology journalist
  • Experts have created a robot that could form human relationships.. 
  • Besides, this Sophia is actually 'Miss Sophia' because it has the attributes of a lady, by appearance.
And the list continues...
For me all of these is more amusing than interesting because it tends to shield people from the underlying fact: that this Sophia is a piece of machine, pieces of metals and other stuff put together.

My Perspective as an AI Expert
First, I would like to appreciate the efforts Hanson Robotics Limited for the research effort put in to create  Sophia as well as the founder of Hanson Robotics, Dr. David Franklin Hanson. Good job to them and the team.

However, I would like to point out that the so much vibe about this Sophia could actually give the naive public the wrong impression about the "abilities" of this robot. This Sophia is just another robot, a social robot, not so social anyway because it simply cannot exhibit the many human attributes ascribed to it in the media.

Think of this: if you watch the interview and the videos on Sophia, how many times have you see Sophia walk up the stage on its own? or enter a car on its own? or even move freely through an audience on its own? And these are even some of the most elementary things humans do.

The Big Questions
Also ask yourself:
  • Can this Sophia work without connecting to an information processing service somewhere?
  • Could it decide on what to do and where to go on its own?
  • Can it find its way back it Hanson Labs on its own, say with public transportation?
  • It it self-aware of its environment?
  • What if the Hanson team forget to take it back to the car after a particular program?
  • Can it dress itself up?
  • By the way, why do they dress it up as a woman?
  • Does it even give reasonable answers to questions?
You can make up so many of such question.
Sow why all the publicity about this Sophia? What is so significant about this robot that everywhere you turn, you here of Sophia?

Clearly, this Sophia is just another robot, a piece of machine  that tends to mimic human way of doing things and we need to stop barraging the public with all this over-bloated details about a machine having human personalities.

Why the Clatter?
What do they want to achieve by all the noise and publicity? Advertise the company? Draw attention to the designers?  or just tell people what they want to hear? Or solicit for more acceptance and support for research on AI? I don't get it! For me the so much noise is not necessary and its very much uncalled for. For now, the technology we have could not create any machine that could have information processing abilities close to 0.0001% that of an average human. I could tell you that.

So much resources and effort have been put to move this Sophia to different locations, conduct seminars etc. All these effort could be put into something more meaningful. Granted, it may have more features than other robots, but frankly speaking it it just another robot.

So if every organization that produces humanoids engages in this kind of publicity, then we would be spending more time talking and causing much distraction than learning or developing something new.

Final Thoughts
From my own personal findings, the complexity of the generality of human behavior is beyond the comprehension of contemporary scientists and researchers. Sophia is just a piece of machine and we should avoid 'overpersonifying' it. Effort put in publicizing could be channels to do something a little more useful to the society.
This is my personal view and I would like to thank you for reading.

What is K-Means in Clustering in Machine Learning?

We are going to explain the basic concept of k-means clustering and the k-means clustering algorithm.

Table of Content

1. What is k-Means Clustering


It is a clustering method that tends to partition your data into partitions called clusters. Let's say you have you have n data points, the k-means algorithms would assign each of the data point to the cluster with the nearest mean.

Note: the k in k-means represents the number of clusters, that is k clusters.

2. How it works


Suppose we have a set of observations {x1, x2,... xn} which consists in a set of N random variable x (x is a D d-dimensional real vector). The goal is to partition the data set  into some number K of clusters, where the value of K is known.
A cluster is a group of data points whose inter-point distances are minimal when compare with distance to points outside the cluster.
The first step is to find the mk, for k = 1,..., K, in which mk is the mean associated to the kth cluster.
We now assign each of the data points to clusters, such that the sum of squares of the distances of each data  point to its closest mean mk is  minimum.



3. Steps of the k-Means Algorithm


Step 1: For  each unit, x, in the input space, place it in the cluster whose current centroid it is nearest to.
Step 2: After all points have been assigned (x1,...xn), adjust the locations of the centroids of the k clusters
Step 3: Reassign all the points to their nearest centroid
Repeat steps 2 and 3 until convergence
Convergence occurs when the points not move between clusters and the centroids are stabilized

This algorithm would become clearer when we consider an example later in this article.
Let's now look at a little more details on how the clusters are assigned




4. Assignment of Clusters


 (based on "Pattern Recognition and Machine Learning" by Christopher M. Bishop)
For each data point xn, we would use a corresponding set of binary variables we denoted as rnk ={0,1} where k =1,...,K.
rnk describes which of the K clusters the data point xn is assigned to. If rnk is assigned to k, then rnk = 1 and rnj = 0 for j not equal to k.

Note the the two superscript in   indicates that there would be two loops:
Loop 1(1-N): Iterate through all the data points
Loop 2(1-K): Iterate through all the cluster

Now, for each iteration, you need to calculate a value for J which is called the distortion measure and is given by the sum of squares function:







5. Lets try to understand this formula


First note that this formula is sometimes called distortion measure since it represent how much each data point say xk is separated from the mean mk of that cluster.
In other words, J represents the sum of squares of the distance of each data point to its assigned vector mk.
  • N is to total number of data points,
  • K is the number of clusters
  • xn is the vector of measurement n
  • mk is the mean for cluster k
  • rnk is an indicator variable that indicates whether to assign xn to k
We need to determine the value of {rnk} and mk that gives the least value of J.
This is achieved by the use of k-Means Algorithm




6. More Explanation of the k=Means Algorithm


This algorithm is an iterative procedure involving steps:
Input set of points x1,...xn
Choose a value for K
Place m1,..., mk(let's call this centroid) are random locations within your data space
Repeat the following steps until convergence
for each point x
  • find the nearest centroid, cj (compute the distance  between xi, compute the distance between xi and mj for every centroid mj, and pick the cluster with the minimum distance)
  • find the nearest centroid
  • assign this point xj to the cluster of the nearest centroid
For each cluster  j = 1,..., K, and recompute the centroid position
  • Take all the data points that fall into this cluster
  • new centroid cj = mean of all points x
  • assign to cluster j in the previous step
Stop when none of the cluster assignments change




7. Example of k-Means Clustering


The example below is based on
K = 2 and N = 14
Take some time to examine the progression through the steps and make sure you understand how it works



Sunday, 17 December 2017

Introduction to Machine Learning (ML)

What really is machine learning? Let's try to explain it in a way that everyone can easily understand and appreciate. Here we would define Machine Learning and outline the various aspects of machine learning.

The following are covered:

  1. What is Machine Learning
  2. The Theory of Machine Learning
  3. An Example of Classification
  4. Types of Machine Learning Problems
  5. Final Notes
  6. Further Reading




1. What is Machine Learning?


Machine Learning is an branch of artificial intelligence that provides the computer system the ability to progressively learn and improve its performance on handling various tasks without being explicitly programmed to perform all the task.
Another definition of Machine Learning explains it as 'the process of trying to deduce unknown values from known values'.

Figure 1: Types of Machine Learning Problem



2. The Theory of Machine Learning


Remember the second definition of machine learning has to do with trying to determine unknown values given a set of know values.
Example: if a set of 30 students class 5 normally scores between 70% and 100% in a test and a set of 30 students in class 3 normally scores between 40%  and 60%.
Now if you have a score of  45% from a new student, different from the ones you know and you have to place this student in a class, what class would you place him? Obviously, since he scored 45% which lies between 40% and 60%, you will likely place him in class 3. This is an example of classification. Now let's take a more formal definition.



3. An Example of Classification


Given a set of data(training data set) that comprise of N observations {xn}, where n = 1,...,N, and you are also given the corresponding values {tn} (target value), the goal of machine learning is to predict the value of t for a new value of x.
The approach would be to first construct an appropriate function y(x). The values of this function for the new input x constitute the predictions for the corresponding value of t.

There would be need to examine also examine the probability that the predicted value of t is correct. This probability is expressed as p(t |x), that is probability of t given x. This expresses how certain or uncertain our prediction is. By now you understand the theory behind machine learning: that is making predictions about what is not known.
Understanding this theoretical approach would help us understand the various types of Machine Learning problems.



4. Types of Machine Learning Problem


From Figure 1, we could see the classes of machine learning problem. Machine learning problems are divided into two broad categories: Supervised Learning and Unsupervised Learning.



4a. Supervised Learning


In supervised learning applications, the training data set(given data set) comprises of samples of input vectors {x} along with their corresponding target vectors. The task here would be to find a function f(x) that takes a data point x and produces the equivalent target value t such that f(x) = t
Supervised Learning problems can either be Classification or Regression.

Classification:  In classification, the training data is from some finite set. Here the aim is to assign each of the input vectors to one of a definite number of discrete categories.

Regression: Here, the training data set is in R-dimensional real space. Here the output would just be one or more continuous variables



4b. Unsupervised Learning


Unsupervised Learning has to do with finding patterns or trend within the input data. Unsupervised learning could either be clustering, density estimation or dimensionality reduction.
In clustering, we find clusters or groups of similar examples withing the data.
Density estimation has to do with finding groups of data that belong to the same density distribution
Dimensionality Reduction reduces data from a higher dimensional space to lower dimension like 2 or 3 dimensions.

There is also another class of machine learning problems known as semi-supervised learning. It would just suffice to know that under this class we have:
  • Reinforcement learning
  • Active learning



5. Final Notes


I do think that this lesson would not be too difficult for you to follow. For now we have an overview of the whole concept of Machine Learning. In subsequent lessons, we would go a little deeper into formal definitions using the statistical derivations.
Feel free to read check out more Machine Learning Videos and Tutorial and do leave a comment to let me know if you have any challenges.


6. Further Reading


Read more on neural network from the following beginner tutorials:
Basics of Neural Networks
Basics of Perceptron in Neural Networks
Basics of Back-propagation in Neural Networks
Multilayer Perceptions (MLP) Explained







Basics of Neural Networks in AI Artificial Intelligence

Concept of Neural Networks is not that difficult to understand by an average person irrespective of your area of specialization. In this lesson, we would explain the concept of Neural Networks(NN) or Artificial Neural Networks and then give a formal definition of it. Then we would look at an application of Neural Networks.


Just as you know, we would try to keep it simple and clear so that you will not find it difficult to understand and appreciate the concept. We would cover the following:
  1. What is Neural Networks
  2. Application of Neural Networks
  3. Neural Network Implementation
  4. Simple Model of Neural Networks - The Perceptron
  5. A More Detailed Mathematical Model (Next Lesson)
  6. Final Notes

1. What is a Neural Network
An Neural Network is a computing system that is based on the biological neural network that make up the human brain. Neural networks are not based on any specific computer program written for it, but it can progressively learn and improve its performance over time.
A neural network is made up of a collection of units or nodes called neurons. These neurons are  connected one to the other by means of a connection called synapse. By means of the synapse, a neuron can transmit signal or information to another neuron nearby. The receiving neuron can receive the signal, process it and signal the next one. The process continues, until an output signal is produced.

2. Application of Neural Networks
Note that Neural Networks are a branch of Artificial Intelligence.So the application areas has to do with systems that that try to mimic human way of doing things.  There are many modern application areas of neural networks which includes:
Computer Vision: Since no program can be written to make the computer recognize all the object in existence, the only way is to use neural networks such that as time goes, computer could on its own recognize new things bases on what it has previously learnt.
Patter Recognition/Matching: This could be applied in searching a repository of images to match say, a face with a known face. Used in Criminal investigation
Natural Language Processing: System that allows the computer to recognize spoken human language by learning and listening progressively with time.

3. Neural Network Implementation
So how can we implement an artificial neural network in a real system? The first step would be to have a network of nodes which would represent the neurons. The we assign a real number to each of the neurons. This real numbers would represent the signal held by that neuron.

The output of each neuron is calculated by non-linear function. This function would take the sum of all the inputs of that neuron.

Now, both neurons and synapses usually have a weight that continually adjusts as the learning progresses. This weight controls the strength of the signal the neuron send out across the synapse to the next neuron. Neurons are normally arranged in layers. Different layers may perform different kind of transformation on its input. Signals move through different layers including hidden layers all the way to the output.

4. Simple Model of Neural Networks - The Perceptron
The perceptron is the simplest model of a neuron that illustrates how a neural network works. The perceptron is a machine learning algorithm developed in 1957 by Frank Rosenblatt and first implemented in IBM 704.

Figure 1: How the Perceptron Works

How it Works
How the perceptron works is illustrated in Figure 1.  In the example, the perceptron has three inputs x1, x2 and x3 and one output.
The importance of this inputs is determined by the corresponding weights w1, w2 and w3 assigned to this inputs. The output could be a 0 or a 1 depending on the weighted sum of the inputs.

Output = w1x1 + w2x2 + w3x

Output is 0 if the sum is below certain threshold or 1 if the output is above certain threshold. This threshold could be a real number and a parameter of the neuron.

This is shown below in Equation 1.

Equation 1:  output of a perceptron
This operation of the perceptron clearly explains the basics of Neural Networks and would serve as a good introduction to learning neural network.
Now we would examine a more detailed model of a neural network, but that would be in part 2 because I need to keep this lesson as simple as possible.

Introducing a Bias and Sigmoid Function
Lets not consider a general example, this time we have not just 3 inputs but n inputs. Just as you know, the formula now becomes:

Output = w1x1 + w2x2 + w3x3 + ,,, + wnxn

which is not much different from the one we previously had. But if we use a function like this one, the output could be any number. However, we want the output to be a number between 0 and 1.
So what we would do is to  pass this weighted sum into a function that would act on the data to produce values between 0 and 1. What function would that be? Yes, that is the sigmoid function! which is also know as a logistic curve.
For the sigmoid function, very negative inputs gets close to zero and very positive inputs gets close to 1 and it sharply increases at the zero point.
So if we use the symbol σ, we would have:



σ(w1x1 + w2x2 + w3x3 + ,,, + wnxn)


Now, suppose, we want the neuron to activate when the value of this output is greater than some threshold, that is, below this threshold, the neuron does not activate, above the threshold, it activates. Then we call this threshold, bias and include it in the function.
We would then have
σ(w1x1 + w2x2 + w3x3 + ,,, + wnxn+  bias)

The bias is a measure of how high the weighted sum needs to be before the neuron activates.
 Only activate when weighted sum > bias

What we have considered is something like shown above, with just two layers. But Neural networks actually could contain several layers and that is what we are going to consider in subsequent lessons on AI Artificial Intelligence

Final Notes
  • However complex the Neural Network concept appears, you now have the underlying principle: 
  • set of inputs combined with weights (plus a bias or error to be discussed in the next lesson) to provide an output. 
  • Neurons are connected to each other by means of synapses
  • Neurons sends signal(output) to the next neuron
  • The network undergoes a learning process over time to become more efficient.
In the next lesson, we would look at more details of how the Neural Network works.