Thursday, 24 November 2016

Easy Steps to become proficient in Machine Learning:

Easy Steps to become proficient in Machine Learning:

In this post I would like to know you about an easy way of few steps to mastering into machine learning. Before that every one has few basic questions in their mind. Where to start? How to proceed?

Where to start learn ML? 

To understand this post, that is enough to have minimum knowledge on machine learning in Python.The main aim of this post is to know you about the freely available tools to in the market.

I am writing this post by assuming you are not an expert in

1. Machine learning
2. Python
3. Any of Python related machine learning like scientific computing(SCIKIT), or data analysis libraries

Tuesday, 22 November 2016

What machine learning algorithms can be suitable for data and images?

What machine learning algorithms can be suitable for data and images?

In this post I would like to give brief idea about when to use which algorithms on what data.

We have gone through the previous post, Introduction to machine learning.

Machine learning is used to filter spam data, recognizing the face, recommendation engines.When you have a large data set on which you’d like to perform analytical analysis or for example to recognize the patterns.

To avoid explicit programming, we can use machine learning, to train computers which can learn, analyse and act on the data as we specified.These qualities make machine learning more powerful on these days and also all the machine learning softwares are free.We can also implement our application on single machine or massive scale.

We can use machine learning libraries in all languages, environment you prefer (java, c++, python...etc languages, windows, linux...Etc OSs)

Here I am giving brief introduction of 11 machine learning tools, provides functionality for individual apps.

Tuesday, 8 November 2016

Difference between supervised, unsupervised Machine learning

Difference between supervised, unsupervised Machine learning:

As we studied about the introduction of Machine learning in the previous post, I am just refreshing again in two lines below.

Machine learning is a field of computer science, probability theory, and optimization theory; this allows the people complex tasks to be solved for which a logical/procedural approach would not be possible or feasible.

The different categories of machine learning are shown below
  • Supervised learning
  • Unsupervised learning

Supervised learning:

In supervised learning, we have some really complex function from inputs to outputs. we have lots of examples of input/output pairs, but we don't know what that complicated function is. Using supervised learning algorithm we can make it possible.

Monday, 7 November 2016

Introduction to machine learning

Introduction to machine learning:

What is Machine Learning?

Now a days Machine learning is the more weighted and costly topic to learn. In this post I would like to share my knowledge on machine learning. Machine learning is a type of artificial intelligence that provides computers with the ability to learn without being explicitly programmed.

The main target of Machine learning is the development of computer programs that can teach themselves to grow and change when exposed to new data.

The machine learning process is very similar to data mining.The data mining process is also searches through the data which looks for the patterns. Similarly machine learning uses the data to detect the patterns and adjust the programs accordingly.

Tuesday, 2 August 2016

Exceptions handling in python with Examples

What is an exception?
In this post I am trying to explain how the exceptions got
Here I am giving definition to the exception. An event which is got occurred during the execution of a program which disturbs the normal flow of our application is known as exception. When an exception occurs, it causes the current process to stop and passes it to the calling process until it is handled. If we cannot handled it properly, our application will crash. To avoid these types of problems we need to catch them and handle them properly, then our application will not crash and cannot got interrupted in middle.

Tuesday, 26 July 2016

Bit flags, Bit masks and why they are useful?

Bit flags, Bit masks and why they are useful? Explanation with examples.

First of all we want to know what bit flag is and what is bit mask, in this post I would like to give brief knowledge on bit flags and bit masks

Bit Flags: As of we know that we cannot access bits directly, So we have to use the bit-wise operators to set, unset, or query them.

Bit flags are the individual bits that are used to improve the efficiency of the storage.

In storage-intensive cases where we have lots of related Boolean options, it can be useful to “pack” 8 individual Boolean's into a single byte for storage efficiency purposes.

Why are bit flags useful?

Bit flags are used in two cases:

1) It is very much useful when you have many sets of identical bit flags.

Sunday, 24 July 2016

Diff in Conversion ctr and explicit ctr

Diff in Conversion ctr and explicit ctr, explain with examples:

Before going to know about the difference between the implicit and explicit convertions we need to have a little bit knowledge on casting


Casting means converting form one data type to another. We have two types of castings
·        Implicit casting
·        Explicit casting

Implicit casting

The Implicit casting doesn't require any casting operator. This casting is normally used when converting data from smaller integral types to larger or derived types to the base type.

Thursday, 21 July 2016

Explain hash_map and bucketing with examples

A small introduction to the hash map:

The template class describes an object that controls a varying-length sequence of elements that has bidirectional access. You use the container hash_map to manage a sequence of elements as a hash table, each table entry storing a bidirectional linked list of nodes, and each node storing one element.

Syntax of the hash map is:

Here the parameters are explained as shown below. Key - The type of the key component of an element in the controlled sequence.Mapped- The type of the additional component of an element in the controlled sequence.

In the above syntax an element consists of a key, for ordering the sequence, and a mapped value, which goes along for the ride.

Tuesday, 19 July 2016

Bit Count In Product

Bit Count In Product. Explain with examples:

Write a function:
int solution(int A, int B);
that, given two non-negative integers A and B, returns the number of bits set to 1 in the binary representation of the number A * B.
For example, given A = 3 and B = 7 the function should return 3, because the binary representation of A * B = 3 * 7 = 21 is 10101 and it contains three bits set to 1.
Assume that:
·   A and B are integers within the range [0..100,000,000].
In your solution, focus on correctness. The performance of your solution will not be the focus of the assessment.

Finding the length of the Arrays

How to find the length of the Array, explain with examples:

A non-empty zero-indexed array A consisting of N integers is given.
Array A represents a linked list. A list is constructed from this array as follows:

• the first node (the head) is located at index 0;
• the value of a node located at index K is A[K];
• the successor of a node located at index K is located at index A[K];
• if the value of a node is −1 then it is the last node of the list. For example, for array A such that: A[0] = 1
A[1] = 4
A[2] = -1
A[3] = 3
A[4] = 2
the following list is constructed:
• the first node (the head) is located at index 0 and has a value of 1;
• the second node is located at index 1 and has a value of 4;
• the third node is located at index 4 and has a value of 2;
• the fourth node is located at index 2 and has a value of −1.

Monday, 25 April 2016

Difference between the Composition, aggregation, association Relationships.

Difference between the Composition, aggregation, association Relationships.

Now first look into the composition:

To understand the design first of all we must know the relationships. The most important relationships are

 Association
 Aggregation
 Composition

Now see the below about each one elaborately.


Association is a relationship where all objects have their own life cycle and there is no owner.
Let’s take an example of Teacher and Student. Multiple students can associate with single teacher and single student can associate with multiple teachers, but there is no ownership between the objects and both have their own life cycle. Both can create and delete independently. This represents the ability of one instance to send a message to another instance. This is typically implemented with a pointer or reference instance variable, although it might also be implemented as a method argument, or the creation of a local variable.

Tuesday, 5 April 2016

Functions in Python with code examples

Functions in Python:

Function is a block of code that is used to perform single action. Functions are reusable. Python has many built-in functions, in additional to that it allows the user to define their own functions which are called as user defined functions.

Defining a function in python:

Python have simple rules to define a function.
Function blocks begin with the keyword def followed by the function name and parentheses ( ( ) ).
The arguments should be placed within these parentheses. we can also define parameters inside these parentheses.
The first statement of a function can be an optional statement - the documentation string of the function or docstring.
The code block within every function starts with a colon (:) and is indented.
The statement return exits a function, optionally passing back an expression to the caller. A return statement with no arguments is the same as return none.

Sunday, 27 March 2016

List in Python with code samples

List in Python:
The list is one of the data type available in Python. The items in the list are separated by comma values and which are placed between square brackets.
NOTE: The items in a list need not be of the same type.
Creating a list is as simple as putting different comma-separated values between square brackets. For example −
My_list1 = ['String', 'String2', 12, 232]
My_list2 = [1, 2, 3, 4, 5, 6, 7, 8, 9];
My_list3 = ["a", "b", "c", "d", "e", "f", "g"];

Accessing Values in Lists

By using the square brackets for slicing along with the index we can access the values in the list or we can use indices to obtain value available at that index.

Friday, 25 March 2016

Dictionary in Python with code examples

Introduction to dictionary:
In the Dictionary each key is separated from its value by a colon (:), and the  items are separated by commas, the dictionary is enclosed in curly braces.
The dictionary is empty when there are no items in it. It is represented with just two curly braces {}.
The keys are unique within a dictionary and values may not be unique. The values of a dictionary can be of any type, but the keys must be of an immutable data type such as strings, numbers, or tuples.
Accessing Values in Dictionary:
To access dictionary elements, you can use the familiar square brackets along with the key to obtain its value. Following is a simple example −
if __name__ == '__main__':
    Ex_Dictionary = {'Name': 'Sandy', 'Age': 15, 'Class': 'tenth'};

    print "Ex_Dictionary['Name']: ", Ex_Dictionary['Name']
    print "Ex_Dictionary['Age']: ", Ex_Dictionary['Age']
    print "Ex_Dictionary['Class']: ", Ex_Dictionary['Class']

The output of the above code is
Ex_Dictionary['Name']:  Sandy
Ex_Dictionary['Age']:  15
Ex_Dictionary['Class']:  tenth

When we try to access the val;ues with the key that is not availabele in the above diracoty the below error may get appeared

Wednesday, 23 March 2016

Tuple in python with code examples

Tuple in python with code examples:

Tuples are sequences, just like lists in python. A tuple is a sequence of immutable objects.

Differences between the touple and list:

  • ·       The tuples cannot be changed unlike list.
  • ·        Tuples use parentheses, and lists use square brackets.

The below are the examples of the tuples:

EX_tup1 = ('String1', 'String2', 1919, 2100);

EX_tup2 = (1, 2, 3, 4, 5, 6, 7 );

EX_tup3 = "a", "b", "c", "d", "e", "f";

A tuple creating is as simple as putting different comma-separated values. Optionally you can put these comma-separated values between parentheses also.
Like string indices, tuple indices start at 0, and they can be sliced, concatenated, and so on.
The empty tuple is written as two parentheses containing nothing
EX_tup1 = ()
To write a tuple containing a single value you have to include a comma, even though there is only one value

= (50,);

Accessing Values in Tuples:

Tuesday, 22 March 2016

Packages in Python with example

Packages in Python with example:

A package is a hierarchical file directory structure that defines a single Python application environment that consists of modules and sub packages and sub-sub packages, and so on.

Consider a file available in TestVal directory.

I am writing the below code in that file
def Test():
   print "I'm Test TestVal"
Similar way, we have another two files having different functions with the same name as above
·        TestVal/ file having function Isdn()
·        TestVal/ file having function FUN()

The in python:

Now, create one more file in TestVal directory
To make all of your functions available when you've imported TestVal, you need to put explicit import statements in as follows −

Monday, 21 March 2016

Locating Modules in Python with code examples

Locating Modules in Python with code examples:

When you import a module, the Python interpreter searches for the module in the following sequences −
·        The current directory.
·        If the module isn't found, Python then searches each directory in the shell variable PYTHONPATH.
·        If all else fails, Python checks the default path. On UNIX, this default path is normally /usr/local/lib/python/.
The module search path is stored in the system module sys as the sys.path variable. The sys.path variable contains the current directory, PYTHONPATH, and the installation-dependent default.


The PYTHONPATH is an environment variable, consisting of a list of directories. The syntax of PYTHONPATH is the same as that of the shell variable PATH.
Here is a typical PYTHONPATH from a Windows system:
set PYTHONPATH=c:\python27\lib;
And here is a typical PYTHONPATH from a UNIX system:
set PYTHONPATH=/usr/local/lib/python

Namespaces and Scoping:

Sunday, 20 March 2016

Modules in python

Modules in python with examples:

In python, modules play a vital role.

A module is a Python object with arbitrarily named attributes that you can bind and reference. A module can define functions, classes and variables. A module can also include runnable code.Python module allows us to logically organize our Python code. Grouping related code into a module makes the code easier to understand and use. In other words, a module is a file consisting of Python code.

Example for the module in python:

The Python code for a module named aname normally resides in a file named
Let us see the below module named as

def DUMP_func( Var ):

   print "Hello : ", Var

The import Statement in python:

Friday, 18 March 2016

Built-in Object types in Python with examples

Built-in Object types in Python with examples

Python also has built-in object types that are closely related to the data types mentioned above. Once you are familiar with these two sets of tables, you will know how to code almost anything!

Mutable sequence, always in square brackets: [1, 2, 3]
Immutable sequence, always in parentheses: (a, b, c)
Dictionary - key, value storage. Uses curly braces: {key:value}
Collection of unique elements – unordered, no duplicates
String - sequence of characters, immutable
Sequence of Unicode encoded characters

Python Operators:

Thursday, 17 March 2016

Branching, Looping, and Exceptions in Python with code examples

Branching, Looping, and Exceptions in Python with code examples


Python has a very straightforward set of if/else statements:

if ("4.0" in GC_Ver_1):               
                Finalsessionanme = os.path.dirname(SQLiteName) + "\\" + SQLite_Prefix +"_"+ sessiondate
            elif ("4.5" in GC_Ver_1):
        Finalsessionanme = os.path.dirname(SQLiteName) + "\\" + sessionanme

The expressions that are part of if and elif statements can be comparisons (==, <, >, <=, >=, etc) or they can be any python object. In general, zero and empty sequences are False, and everything else is True. Python does not have a switch statement.


Python has two loops. The for loop iterates over a sequence, such as a list, a file, or some other series:

Major differences between Python 2.x and Python 3.x

Major differences between Python 2.x and Python 3.x

In this post I am just defining the python versions and their differences
Python is available in two versions– Python 2.7 and Python 3.x, the current version of the python is 3.3.

The code that is implemented in one version will not work on another version. This is the major difference between the two versions. But most of the code is interchangeable

 The below are some of the key differences:
Python 2.x
Python 3.x
print “hello” (print is a keyword)
print(“hello”) (print is a MyFun)
except Exception, e: # OR
except Exception as e
except Exception as e:  # ONLY
Naming of Libraries and APIs are frequently inconsistent with PEP 8
Improved (but still imperfect) consistency with PEP 8 guidelines
Strings and unicode
Strings are all unicode and bytes type is for unencoded 8 bit values
In market there are some utilities are available to convert code form one version to another version. while the '-3' command line switch in 2.x enables additional deprecation warnings for cases the automated converter cannot handle.

Wednesday, 16 March 2016

Python overview and Python Features

Overview Of the Python:

Python is a high-level, interpreted, interactive and object-oriented scripting language. Python is designed to be highly readable. It uses English keywords frequently where as other languages use punctuation, and it has fewer syntactical constructions than other languages.

·        Python is Interpreted: Python is processed at runtime by the interpreter. You do not need to compile your program before executing it. This is similar to PERL and PHP.
·        Python is Interactive: You can actually sit at a Python prompt and interact with the interpreter directly to write your programs.
·        Python is Object-Oriented: Python supports Object-Oriented style or technique of programming that encapsulates code within objects.
·        Python is a Beginner's Language: Python is a great language for the beginner-level programmers and supports the development of a wide range of applications from simple text processing to WWW browsers to games.

Wednesday, 6 January 2016

Python Development Process

Python Development Process:

There is no distinction between the development and execution environments. In other words, the compiler is always right there at runtime and is part of the system that runs the program. All we have in Python is runtime. There is no initial compile-time phase at all and everything happens as the program is running.

This even includes operation such as the creation of functions and classes and the linking of modules. Such events occur before execution in more static languages, but in Python, they happen as programs execute.

This adds a more dynamic flavor to the Python - it is often very convenient for Python programs to construct and execute other Python programs at runtime. The eval and exec built-ins, for example, accept and run strings containing Python program code.

This structure is why Python lends itself to customization. Because Python code can be changed on the fly, users can modify the Python parts of a system onsite without needing to compile the entire system's code.

Running Python Programs

Running Python Programs:

Python Interpreter

The Python code we write must always be run by the Interpreter.
To enable it, we must install a Python interpreter on our machine.
When the Python package is installed on our machine, it generates number of components:


Python Execution

Make a file with the following line.

print("Hello world!")

The extension py is not required but for consistency, Python file usually has that extension.

If we run the file on a command prompt window:

C:\temp > python 

Hello World

We typed the code into text file, and we run the file through the interpreter. Simple!
But let's think about the runtime structure of Python.

Python introduction and need for it as C++ developer.

Introduction to Python:

As a C++ developer why we need Python?

For example we have developed an application to create some data in the farm of files. We have used our application and generated so many number of files after that we found that there is some replacement or some modification is required in those files. At that time we have only one option that we need to modify our application and need to generate new build and finally we have to run the application. Again need to generate all the files. Such a time taking process.

To overcome these type of problems and to automate some small tasks in the system, we prefer python.

Basically, when I need to code something and the language doesn’t matter, I use Python.

What is Python?

Python is a general purpose programming language created in the late 1980s, and named after Monty Python, that’s used by thousands of people to do things from testing microchips at Intel, to powering Instagram, to building video games with the “PyGame” library. It’s small, very closely resembles the English language, and has hundreds of existing third-party libraries.