Wednesday, 21 October 2020

Matplotlib library in Python

Matplotlib is a plotting library for the Python programming language and its numerical mathematics extension NumPy. It provides an object-oriented API for embedding plots into applications using general-purpose GUI toolkits like Tkinter, wxPython, Qt, or GTK+. There is also a procedural "pylab" interface based on a state machine (like OpenGL), designed to closely resemble that of MATLAB, though its use is discouraged.[3] SciPy makes use of Matplotlib.

Matplotlib was originally written by John D. Hunter, since then it has an active development community,[4] and is distributed under a BSD-style license. Michael Droettboom was nominated as matplotlib's lead developer shortly before John Hunter's death in August 2012,[5] and further joined by Thomas Caswell.[6][7]

Matplotlib 2.0.x supports Python versions 2.7 through 3.6. Python 3 support started with Matplotlib 1.2. Matplotlib 1.4 is the last version to support Python 2.6.[8] Matplotlib has pledged to not support Python 2 past 2020 by signing the Python 3 Statement.















Sunday, 31 May 2020

User defined function | Python | part 2

Saturday, 30 May 2020

User defined function | Python | part 1



Friday, 29 May 2020

Logistic Regression in python (part02) | python crash course08

Logistic Regression in python (part02) :

Hello friends, in the previous post we see input data processing methods. In this post we are going to see How create an Array and How to split data into train,test model. Let's start:
We have about forty-Two thousand and odd record. If we use this entire data for model building, we will not left with any data for testings. So generally, we split the entire data set into two part, say 60/40 percentage. We use 60% of the data for model building and the rest for testing the accuracy in prediction of our created model. You may use a different splitting ratios as per your requirements.

Creating Feature Array:

Before we spliting the data, we separate out the data into two array X and Y. The X arrays contain all the feature that we want to analyzed and Y arrays is a single dimensional arrays of boolean value that is the outputs of the prediction. To understand this, let us run some codes.
 Execute the following Python statements to create the X array −
In [06]: X = data.iloc[:,1:]
To examine the content of X use head to print a few initial record. The following screen show the contents of the X arrays.
In [07]: X.head ()
Initial Records
The arrays has several row and column.
Next, we will be create output array containing “y” value.

Creating Outputs Array:

To create an array for the predicted values columns, use the following Python statements−
In [08]: Y = data.iloc[:,0]
Examine its content by calling head. The screen outputs below show the results −
In [09]: Y.head()
Out[09]: 0   0
1    0
2    1
3    0
4    1
Name: y, dtype: int64
Now, splits the data using the following commands −
In [10]: X_train, X_test, Y_train, Y_test = train_test_split(X, Y)
This will be create the four array called X_train, Y_train, X_test, and Y_test. As before, you may examine the content of these array by using the head commands. We will use X_train and Y_train array for training our models and X_test and Y_test array for testing and validating.
Next Step to built Classifier We will see this into it in the next chapter.
                                                        BEST OF LUCK!!!!

Introduction to Microprocessor

Before you learn any programming language, it is important for one to understand some of the basics about computers and what are the languages that a  computer can understand. Let’s have a view on it. A computer is a collection of hardware components. Let us consider here a few hardware components such as  Microprocessor, RAM, Hard disk,  Motherboard                                                                                      
Out of these and many other hardware components,  the most important or the heart of the computer is the Microprocessoror CPU.

Microprocessor or  CPU:

A microprocessor is an electronic component that is used by a   computer to do its work. It is a   central processing unit on a single integrated circuit chip containing millions of very small components including transistors,  resistors,  and diodes that work together. They are created using a technology called Semiconductor technology.

Semiconductor Technology??

Any device which is made up of transistors is referred to as working in Semiconductor Technology. A transistor is a device that regulates current or voltage flow and acts as a switch or gate for electronic signals. The transistors have three terminals emitter,  base, and collector. There are two types of transistors:
1)NPN transistor.
2)PNP transistor.
TransistorNPN PNP Transistors can only store voltages. There are two levels of voltages: 
Low Voltage referred to as →0V
High Voltage referred to as→5V
If we see the same in Software engineer’s view, he/she looks at the two levels as 
Low level referred to as→0
High level referred to as→1
Therefore, from the perspective of a software engineer, a Microprocessor or CPU can understand combinations of 0 and 1.

Programming Languages

Language is the main medium for communicating between computer systems. A program is a collection of instructions that can be executed by a computer to perform a specific task. There were several programming languages used to communicate with the Computer.
Case-1:
The world’s the first computer was invented in the year 1940’s. During that time the task of a programmer was not simple. For example,    if they wanted the microprocessor to perform any operation then they had to use combinations of 0’s and 1’s. During this time all the programs were written in the language called Machine  Level Language. It is one of the low-level programming languages. The language which machines understand is what called as Machine Level Language.
 Codes written in1940’s so performed
 Addition of two numbers:                              0110110
To perform subtraction of two numbers:        1110111
To perform multiplication of two numbers:    1010101
To perform a division of two numbers:             0100100

The machine-level code was taken as input and given to the microprocessor as the machine understands the binary value code and it gives the output. 
The main advantage of using  Machine language is that there is no need of a translator to translate the code, as the Computer directly can understand. The disadvantage was,  it was difficult for a  programmer to write the code or remember the code in this type of language.

Case-2:
The problem with Machine level code approach was decided to be changed in the year 1950’s. They thought that instead of writing a long sequence of 0’s and 1’s a single instruction can be given. For example, we use, Codes in1950’swritten as 
To perform addition of two numbers: ADD
To perform subtraction of two numbers: SUB
To perform multiplication of two numbers: MUL
To perform division of two numbers: DIV
This approach of writing code is called Assembly  Level  Language. Instead of using numbers like in Machine languages here, we use words or names in English forms.ALLMicroprocessorADDSUBMULDIVOutputAssemblerAn  Assembler is software that takes  Assembly  Level  Language  (ALL)  programs as input and converts it into Machine Level Language (MLL) program.

Case-3:
People always want things to be simple and easier so, in the 1960’s they came up with the next type of language called High-Level Programming Language. High-Level Languages are written in a  form that is close to our human language,  enabling the programmer to just focus on the problem being solved. For example, we use, Codes in1960’swritten as
 To perform addition of two numbers: +
To perform subtraction of two numbers: -
To perform multiplication of two numbers: *
 To perform division of two numbers: / 

A compiler is a software that takes high-level Language (HLL) programs as input and converts it into Machine Level Language (MLL) program.


Wednesday, 27 May 2020

Wondering how a Java Program Executes???

We’ll see how it executes but first let’s get to know how a C program executes. And then we'll compare it with how java program executes. From the above diagram, we can see that C executes faster than Java as it has fewer steps to execute. In java, we have an extra step that is Compiler converts the source file to byte code (This is where platform independency is achieved). Then JVM converts byte code to machine language and is fed to the processor to get output.

Applications

Applications are of two types:
Embedded applications
Portable applications

Embedded applications:

An embedded application is software that is placed permanently inside some kind of device to perform a very specific set of functions. The program instructions for embedded systems are called firmware, or embedded software, and are stored in read-only memory, or flash memory chips. For embedded applications Speed is a very important factor.

Portable applications:

A portable application(portable app), sometimes also called standalone, is a program designed to read and write its configuration settings into an accessible folder in the computer, usually in the folder where the portable application can be found. This makes it easier to transfer the program with the user's preferences and data between different computers. A program that doesn't have any configuration options can also be a portable application. Portable applications can be stored on any data storage device, or in other words, these applications are platform-independent.

Object Orientation

Before going ahead with the object orientation. Let’s get to know what is orientation? Orientation ➤Perspective ➤Way of looking at something
 Let us take an example of a glass of water and try to understand in a better way: 
A chemist will see the glass of water as liquid + gas, an optimistic person will look at it as half-full glass, a pessimistic person will see it as a half-empty glass, a realist will see itas glass of water, a drunkard will see it as maybe..alcohol??? but a developer will view it as an object. 

Object Orientation is the way of looking at this world as a collection of objects. In this world, no object is completely useless. All objects are in constant interaction with each other. No object exists in isolation. Every object belongs to a type. Where type does not exist but the objects of the type exist in reality. Every object has two parts:
1.“has” part refers to the properties/state of an object. To take care of has a part in Java we make use of Datatypes.
2.“does” part refers to the behavior of an object. To take care of does part in java we use of methods or functions.



Professional Python® Frameworks: Web 2.0 Programming with Django® and TurbogearsTM (Programmer to Programmer) Paperback – 16 October 2007 by Dana Moore (Author), Raymond Budd (Author), William Wright (Author)

As two of the leading MVC web frameworks for Python, Django and TurboGears allow you to develop and launch sites in a fraction of the time compared to traditional techniques and they provide greater stability, scalability, and management than alternatives. Packed with examples, this book will help you discover a new methodology for designing, coding, testing, and deploying rich web applications.

A team of expert authors shows you the power of MVC frameworks and the capabilities of the TurboGears and Django packages. The Django chapters show you how to automate production of common web development tasks, portal creation, and content management, so you can focus on higher–level application issues and design. The TurboGears chapters illustrate how to rapidly create modern, highly interactive Web 2.0 applications. For both frameworks, you′ll create useful applications that exemplify common Web 2.0 design paradigms and their solutions. Ultimately, you′ll leverage your Python skills using Django and TurboGears and go from novice to RIA expert.

What you will learn from this book

∗ How you can use frameworks to save you time and frustration in the development cycle


The elements, differences, and similarities of the TurboGears and Django frameworks


Advanced capabilities of both frameworks and how they easily solve issues common to web applications


Approaches to simplifying your client side JavaScript(r) with MochiKit, a Pythonic JavaScript library


How to pair TurboGears with Flash for even more possibilities

Who this book is for

This book is for Python developers who want to learn rapid Web 2.0 development techniques using frameworks and incorporating a model–view–controller architecture.

Wrox Professional guides are planned and written by working programmers to meet the real–world needs of programmers, developers, and IT professionals. Focused and relevant, they address the issues technology professionals face every day. They provide examples, practical solutions, and expert education in new technologies, all designed to help programmers do a better job.

Buy: Professional Python® Frameworks: Web 2.0 Programming with Django® and TurbogearsTM (Programmer to Programmer) Paperback – 16 October 2007 by Dana Moore (Author), Raymond Budd (Author), William Wright (Author)

PDF Download:
 

Platform Dependency

One of the most important features of java is platform independency and to understand how java achieved platform indecency, one must learn what is platform dependency. Let us understand what is a platform to understand platform dependency. Platform is a combination of hardware and software. Hardware mainly refers to microprocessors and software refers to the Operating system. For example, the platform in your computer could be the combination of i5 processor and windowsOS or it could be i9 processor and mac OS as shown below. However, from the software engineers perspective, platform only refers to OS.
Platform=Hardware + Software.
After getting to know what is platform let us now understand platform dependency by considering different cases of C language which is very much platform-independent.

we considered a file of C  programming language as the extension is  exmp.c.  Since  C  programming language is platform dependent programming language,  its platform of execution and platform of compilation must be the same.  In the above case the platform of compilation and platform of execution is the same which is windows operating system and hence we got the output.


we again considered the file of C programming language as the extension is exmp.c. In this case, we considered two computers having the same operating system connected via LAN connection. If we now take a copy of MLL(Machine Level Language) file from first computer and try to execute it on the second computer, according to you will the file execute????

 Compilation Phase  Execution Phase
 Windows windows
If in case you are still confused, just check two phases. COMPILATION PHASE    EXECUTION PHASE Windows   Windows If you can refer the above table, compilation happened on windows and execution happened on windows. Since platform of compilation is the same as that of platform of execution,the file gets executed which simply means you will get the output.
This case is the same as that of case ii except the platform of the second computer that is C
 Compilation Phase  Execution Phase
 Windows UNIX
If you can refer the above table, compilation happened on windows and execution happened on UNIX. Since the platform of compilation is not same as that of platform of execution file will not get executed which simply means you will not get the output.

The  problem  faced  in  C  or  C++  programming language  is that their compiler directly converts High-level language code to machine level language codeand if this code is copied on other type of operating system and tried to execute, it doesn’t   work   because   the   code was   written   using   platform   dependent programming language.To reslove this issue, JAMES GOSLING, the inventor of java programming language which was platform-independent.

Let us now learn how java achieved platform independence

Let us assume you are writing code using java on your computer which has windows os. Since Machine understands machine-level code not your high-level code, the conversion must happens. Let us see how exactly conversion happens in java. Initially, your HLL code is given as input to the compiler but the java compiler will not give MLL code as output like c and c++ compiler rather it takes HLL as input and gives a special type of code as output called as byte code which is platform-independent. Byte code is neither HLL code nor MLL code, hence it is also referred to as intermediate code. If you can recollect machine understands only MLL code but java compiler gave you byte code. To resolve this,  James  Gosling provided software called JVM(Java virtual Machine)which was platform-dependent that is different OS have different JVM. Since you are writing code on windows OS, you will have to download windows compatible  JVM  .  JVM  will now convert  byte code to machine level code which machine can easily understand. In this way, java achieved platform independence using a special type  of code which is byte code.



Color Transforms | Image Handling | Python

Check this link to explore more: https://pillow.readthedocs.io/en/3.1.... Python for beginners: https://www.youtube.com/watch?v=egq7Z...




Telegram: https://t.me/clcoding_python https://www.facebook.com/pirawenpython/ https://www.facebook.com/groups/pirawenpython/

Crop Image | Python

Syntax: ImageVariableName.crop(box) Parameters: box – a 4-tuple defining the left, upper, right, and lower pixel coordinate. Return type: Image (Returns a rectangular region as (left, upper, right, lower) tuple). Note: The Python Imaging Library uses a Cartesian pixel coordinate system, with (0,0) in the upper left corner. Prerequisite: Working with Images in Python | Castor Classes https://www.youtube.com/watch?v=vOiL_... Python for beginners: https://www.youtube.com/watch?v=egq7Z...



Telegram: https://t.me/clcoding_python https://www.facebook.com/pirawenpython/ https://www.facebook.com/groups/pirawenpython/

Working with Images in Python

Python for beginners: https://www.youtube.com/watch?v=egq7Z...



Telegram: https://t.me/clcoding_python https://www.facebook.com/pirawenpython/ https://www.facebook.com/groups/pirawenpython/

Reading CSV files without using any library | Python

Code: (Note: It will work only if you open your file with variable e) li=[]; for i in e: i=i.replace("\n","").split(","); li.append(i); e.close() Note the values are float , but in above list li , those are stored as string , you can further type cast to float using this below code: (Be careful in converting string to float , the first row can not be converted into float as those are column names , for rest of the rows you can perform conversion) li=[]; temp=0; for i in e: if(temp!=0): i=i.replace("\n","").split(","); gi=[]; for j in i: gi.append(float(j)); li.append(gi); else: i=i.replace("\n","").split(","); li.append(i); temp+=1; e.close() Python for beginners: https://www.youtube.com/watch?v=egq7Z...



Telegram: https://t.me/clcoding_python https://www.facebook.com/pirawenpython/ https://www.facebook.com/groups/pirawenpython/

Read a file line by line in Python

Python for beginners: https://www.youtube.com/watch?v=egq7Z...



Telegram: https://t.me/clcoding_python https://www.facebook.com/pirawenpython/ https://www.facebook.com/groups/pirawenpython/

readline & readlines | Python

Prerequisite: File Handling | Python | Castor Classes https://www.youtube.com/watch?v=-ENVe... Writing to file in Python | Castor Classes https://www.youtube.com/watch?v=lYTx2... Append to a file | Python | Castor Classes https://www.youtube.com/watch?v=3SmQF... Python for beginners: https://www.youtube.com/watch?v=egq7Z...



Telegram: https://t.me/clcoding_python https://www.facebook.com/pirawenpython/ https://www.facebook.com/groups/pirawenpython/

Append to a file | Python

Prerequisite: File Handling | Python | Castor Classes https://www.youtube.com/watch?v=-ENVe... Writing to file in Python | Castor Classes https://www.youtube.com/watch?v=lYTx2... Python for beginners: https://www.youtube.com/watch?v=egq7Z...



Telegram: https://t.me/clcoding_python https://www.facebook.com/pirawenpython/ https://www.facebook.com/groups/pirawenpython/

Writing to file in Python

Prerequisite: File Handling | Python | Castor Classes https://www.youtube.com/watch?v=-ENVe... Python for beginners: https://www.youtube.com/watch?v=egq7Z...




Telegram: https://t.me/clcoding_python https://www.facebook.com/pirawenpython/ https://www.facebook.com/groups/pirawenpython/

Tuesday, 26 May 2020

Assembly Language

➤Each family of processes has its own set of instructions, the set of instructions are called machine instructions
 ➤A processor understands only machine level language instructions which are strings of ones and zeros however machine level level language is to obscure and complex for use in software development. So coma the low level assembly language is designed for a specific family of processes that represents various instructions and symbolic code and IMO understandable form.

Advantages of Using Assembly Language
 

  1. It allows complex jobs to run in a simpler way.
  2. It is memory efficient, as it requires less memory.
  3. It is faster in speed, as its execution time is less.
  4. It is mainly hardware-oriented.
  5. It requires less instruction to get the result.
  6. It is used for critical jobs.
  7. It is not required to keep track of memory locations.
  8. It is a low-level embedded system.

Disadvantages of Assembly Language

  1. It takes a lot of time and effort to write the code for the same.
  2. It is very complex and difficult to understand.
  3. The syntax is difficult to remember.
  4. It has a lack of portability of program between different computer architectures.
  5. It needs more size or memory of the computer to run the long programs written in Assembly Language.

Syntax of Assembly Language
 

An assembly program can be divided into three sections −
  • The data section,
  • The bss section, 
  • The text section.
The data Section The data section is used for declaring initialized data or constants. This data does not change at runtime. You can declare various constant values, file names, or buffer size, etc., in this section. The syntax for declaring data section is − section.data
The bss Section The bss section is used for declaring variables. The syntax for declaring bss section is − section.bss
The text section The text section is used for keeping the actual code. This section must begin with the declaration global _start, which tells the kernel where the program execution begins. The syntax for declaring text section is − section.text global _start _start:

Assembler

  • Assembler is a program that converts source code programs written in assembly language into object files in machine language. 
  • Popular assembler has emerged over the year for the Intel family of processor this includes-
➤ TASM (Turbo Assembler from Borland)
➤ NASM (Netwide Assembler for both Window and Linux)
➤ GNU assembler distributed by the free software foundation.
Who should know assembly language?
 There are two primary reasons to learn assembly language: because you want to use it directly, or because you want to understand computers at a fundamental level.
From a practical standpoint, only a relative handful of the world’s engineers and computer scientists actually use assembly language.
The overwhelming majority of software development, including virtually all applications development of any kind, uses high level programming languages, and not assembly code. Some specific areas where assembly language gets used are:
 
    • Firmware
    • Operating systems
    • Device drivers
    • Language design
    • Compiler design
    • Embedded systems
    • Hardware design
    • Advanced cryptography
    • Theoretical computer science
The other reason to learn assembly language is just to gain a better understanding of what is actually going on deep in the guts of a computer.


 Assembly Language is easy to Learn, but hard to master!"

ThE NeaR FuTuRe


Python is a high-level programming language that is widely used in various kinds of programming activities. Python is known for its object-oriented and interpreted features which make it dynamic. Python enables distinct programming on both smaller and large scale as it has a user-friendly and compact module, which increases the efficiency of applications. Python is mainly used for web-building applications and carrying out many automation activities of cloud and system. It has found its latest application in designing Artificial Intelligence.

Future Scope Of Python in India

Python is standout amongst the most common coding dialects of 2015. Close by the being an abnormal state and universally useful programming dialect, Python is likewise a protest arranged and open source. At the comparable time, a commendable number of engineers across the world have been making utilization of Python to make GUI applications and versatile applications.
It is one of the quickest developing dialects and has experienced an effective range of over 25 years to the extent its selection is concerned.

The programming dialect is by and by being utilized by various high-movement sites including GoogleYahoo GroupsYahoo Maps, Shopzilla, and Web Therapy. Essentially, Python additionally finds endless use for making gamingbudgetary, logical, and informative applications.
This accomplishment also reveals a promising future degree of python programming lingo.

Why Python is so Popular?

The main reason behind the immense popularity of python programming language across the globe is the features it provides which can be followed as:-

  1. Python supports multiple programming paradigm - Python is multi-paradigm programming language which has features like object-oriented, imerative, procedural, functional, reflective, etc.
  2. Easy to code and write - Python has a simple, easy and readable code as compared to other programming languages like C, C++, JAVA .
  3. Python has a rich and supportive community - The greatest part of other programming dialects have unpins issues. Also, some of them lack in the documentation which makes it difficult for a programmer to build his project. Python doesn't have these issues. It has been work for a long time, so there are plenty of documentation, tutorials, guides and so much more to help a programmer. Also, it has a rich and active community who ensures to provide help and supports to the developers. So, the community consist of many experienced developers and programmer who provides support at any time.
  4. Python contains fewer lines of code - In python programming language codes are written complete in fewer lines thus reducing the efforts of programmers.
  5. Standard Library - Python comes with a huge standard library through which eliminate the efforts to write a function or code. The library consists of many inbuilt functions and pre-written codes, so it is not necessary to have to write a code for every single thing.
  6. Python is accessible  -For newcomers and beginners, Python is incredibly easy to learn and use. In fact, it’s one of the most accessible programming languages available. Part of the reason is the simplified syntax with an emphasis on natural language. But it’s also because you can write Python code and execute it much faster. Whatever the case, it’s a great language for beginners, so it’s where a lot of young developers are getting their start. More importantly, experienced developers aren’t left by the wayside, as there’s plenty to do.

The sudden upturn in Python Language

                       
Be that as it may, python has executed in the year 1980 it isn't well known among designer. In the 21st century, Google made a few deviation in python basic rationale which enhanced its execution and power.
The primary explanation behind python acknowledgement is DATA SCIENCE. Information science and machine learning are may be viewed as the principle driver of its quick advancement.
These reasons have given a sudden boost to the scope of python programming language and it is good for you if you are getting trained in it.

Use of Python in:

Python is an open source and object-oriented programming language which is used for many several purposes:
➤Website programming development
➤Desktop application development
➤GUI application development
➤Writing system administration software
➤Used as the scripting language for SIMP, blender, open office etc
➤Use of python in software testing

Integrating Python with Other Languages:


Python can also be integrating with other languages. There are some mechanisms used to integrate python with another language such as

Iron Python – Implementation of Python running on the CLR.
Jython – Provides an implementation of the JVM

Improved Wrapper and Interface Generator – permits you to interop between C based languages and others, including.Net and Java.

Future Technologies Counting On python

For the most part we have seen that python programming dialects is probably utilized for wave improvement applications advancement Framework organisation creating recreations and so on.

Artificial intelligence python programming dialect is without a doubt rulling alternative dialects when future advances like Artificial Intelligence(AI) comes into the play.There is a long list of Python frameworks, libraries, and tools that are created to direct Artificial Intelligence to reduce human efforts with enhanced accuracy and efficiency for development.

With the help of AI, speech recognition, autonomous cars and data interpretation have become possible. 

Big Data The future extent of Python is clearly evident as it has helped big data technology to grow.

Python is successfully contributing to analyzing the number of data sets across computer clusters with the high-performance toolkit and libraries.

Python libraries and toolkits, Pandas, Scikit-Learn, NumPy, Bokeh, Agate, Dask.

 Networking - Networking is where Python has a future scope as the language is used to read, write and configure routers while performing other networking functions cost-effectively.
Systems administration is another feild in which python has a more briliant extension later on.
Undoubtedly, the awesome benefits and performance of python and its libraries are working as the root of its constant growth.

This foundation is so strong, that almost all top-notch companies are using this language in their codebase.

Moreover, future technologies like AI and its subsets, big data and networking ensure a bright future for this programming tool.  It’s quite a secure and cost-effective programming language.

By seeing such large scale demand skilled professionals, it is rightly said that Python is actually the language of the FUTURE



Monday, 25 May 2020

Learning Python: Powerful Object-Oriented Programming Kindle Edition by Mark Lutz (Author) pdf

Get a comprehensive, in-depth introduction to the core Python language with this hands-on book. Based on author Mark Lutz’s popular training course, this updated fifth edition will help you quickly write efficient, high-quality code with Python. It’s an ideal way to begin, whether you’re new to programming or a professional developer versed in other languages.

Complete with quizzes, exercises, and helpful illustrations, this easy-to-follow, self-paced tutorial gets you started with both Python 2.7 and 3.3— the latest releases in the 3.X and 2.X lines—plus all other releases in common use today. You’ll also learn some advanced language features that recently have become more common in Python code.

Explore Python’s major built-in object types such as numbers, lists, and dictionaries
Create and process objects with Python statements, and learn Python’s general syntax model
Use functions to avoid code redundancy and package code for reuse
Organize statements, functions, and other tools into larger components with modules
Dive into classes: Python’s object-oriented programming tool for structuring code
Write large programs with Python’s exception-handling model and development tools
Learn advanced Python tools, including decorators, descriptors, metaclasses, and Unicode processing
Buy: Learning Python: Powerful Object-Oriented Programming Kindle Edition by Mark Lutz (Author)


Telegram: https://t.me/clcoding_python https://www.facebook.com/pirawenpython/ https://www.facebook.com/groups/pirawenpython/

Sunday, 24 May 2020

Logistic Regression in Python(part01) | python crash course_07

Logistic Regression in Python: part-01

Welcome to python crash course, Today we are going to start Logistic Regression. basically, in this post you will learn How to encoding data so let's start:
As the amount of available data, the strength of computing power, and the number of algorithmic improvements continue to rise, so does the importance of data science and machine learningClassification is among the most important area of machine learning, and logistic regression is one of its basic methods. By the end of this tutorial, you will have learned about classification in general and the fundamentals of logistic regression in particular, as well as how to implement logistic regressions in Python.
Supervised machine learning algorithms define models that capture relationships among data. Classification is an area of supervised machine learning that tries to predict which class or category some entity belongs to, based on its features.
For example, you might analyze the employees of some company and try to establish a dependence on the features or variables, such as the level of education, number of years in a current position, age, salary, odds for being promoted. The features or variable can take one of two forms:
  1. Independent variable, also called input or predictor, doesn’t depend on other features of interest (or at least you assume so for the purpose of the analysis).
  2. The dependent variable, also called output or responses, depending on the independent variables.
Encoding Data

In [01]: # creating one hot encoding of categorical column.
data = pd.get_dummies(df, columns =['job', 'marital', 'default', 'housing', 'loan', 'poutcome'])

In [02]: data.head()

You will see the following outputs −
Created Data

Dropping the “unknown”

In [03]: data.columns[12]
Out[03]: 'job_unknown'
In [04]: data.drop(data.columns[[12, 16, 18, 22, 24]], axis=1, inplace=True)
After dropping the undesired columns, you can see the final list of columns as shown in the output below −
In [05]: data.columns
Out[16]: Index(['y', 'job_admin.', 'job_bluecollar', 'jobentrepreneur',
'jobhousemaid', 'job_management', 'job_retired', 'job_self-employed',
'jobservices', 'job_student', 'job_technician', 'job_unemployed',
'marital_divorced', 'marital_married', 'marital_single', 'default_no',
'default_yes', 'housingno', 'housing_yes', 'loan_no', 'loan_yes',
'poutcome_failure', 'poutcome_nonexistent', 'poutcomesuccess'],
dtype='object')
our data is ready for model buildings.
In the next post, we will see how to split the data.
If you want to learn more about python then click here.
                                              Best of Luck!!!!!!
Telegram: https://t.me/clcoding_python https://www.facebook.com/pirawenpython/ https://www.facebook.com/groups/pirawenpython/


Popular Posts

Categories

100 Python Programs for Beginner (49) AI (34) Android (24) AngularJS (1) Assembly Language (2) aws (17) Azure (7) BI (10) book (4) Books (173) C (77) C# (12) C++ (82) Course (67) Coursera (226) Cybersecurity (24) data management (11) Data Science (128) Data Strucures (8) Deep Learning (20) Django (14) Downloads (3) edx (2) Engineering (14) Excel (13) Factorial (1) Finance (6) flask (3) flutter (1) FPL (17) Google (34) Hadoop (3) HTML&CSS (47) IBM (25) IoT (1) IS (25) Java (93) Leet Code (4) Machine Learning (59) Meta (22) MICHIGAN (5) microsoft (4) Nvidia (3) Pandas (4) PHP (20) Projects (29) Python (929) Python Coding Challenge (351) Python Quiz (21) Python Tips (2) Questions (2) R (70) React (6) Scripting (1) security (3) Selenium Webdriver (3) Software (17) SQL (42) UX Research (1) web application (8) Web development (2) web scraping (2)

Followers

Person climbing a staircase. Learn Data Science from Scratch: online program with 21 courses