Monday, August 3, 2020

what is pandas, numpy and matplotlib

PANDAS:

Is an open source, BSD-licensed library providing high-performance, and easy-to-use data structures and data analysis tools for the PYTHON programming language. The Pandas module is used for working with tabular data. Pandas provide us with some powerful objects like Data Frames and Series which are very useful for working with and analyzing data.

NUMPY:

The Numpy module is mainly used for working with numerical data. The data manipulation capabilities of pandas are built on top of the numpy library. In a way, numpy is a dependency of the pandas library. ... Numpy is most suitable for performing basic numerical computations such as mean, median, range

MATPLOTLIB:

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.


K-Nearest Neighbor (KNN)

K- Nearest Neighbor (KNN)

K-nearest neighbor is measured with respect to value of k, that define how many nearest neighbors need to be examine to describe class of a sample data point . Nearest neighbor technique is divided into two categories i.e., structure based KNN and structure less KNN.

The structure based technique deals with the basic structure of the data where the structure has less mechanism which associated with training data samples.

In structure less technique entire data is categorized into sample data point and training data, distance is calculated between sample points and all training points and the point with smallest distance is known as nearest neighbor.

One of the main advantages of KNN technique is that it is effective for large training data and robust to noisy training data.

 Scaling KNN queries over enormous high dimensional multimedia datasets is a stimulating issue for KNN classifiers.



support vector machine SVM

Support Vector Machines (SVMs):

 

 These are the most recent supervised machine learning technique.

 Support Vector Machine (SVM) models are closely related to classical multi layer perceptron neural networks.

SVMs revolve around the notion of a margin either side of a hyperplane that separates two data classes.

 Maximizing the margin and thereby creating the largest possible distance between the separating hyperplane and the instances on either side of it has been proven to reduce an upper bound on the expected generalization error.




Decision Tree algorithm in python

Decision Trees:
 

Decision Trees (DT) are trees that classify instances by sorting them based on feature values.

Each node in a decision tree represents a feature in an instance to be classified, and each branch represents a value that the node can assume.

 Instances are classified starting at the root node and sorted based on their feature values.

Decision tree learning, used in data mining and machine learning, uses a decision tree as a predictive model which maps observations about an item to conclusions about the item's target value.

 More descriptive names for such tree models are classification trees or regression trees.

Decision tree classifiers usually employ post-pruning techniques that evaluate the performance of decision trees, as they are pruned by using a validation set.

Any node can be removed and assigned the most common class of the training instances that are sorted to it.


Sunday, August 2, 2020

what is python operator

Python Operators

Operators are used to perform operations on variables and values.

Python divides the operators in the following groups:

  • Arithmetic operators
  • Assignment operators
  • Comparison operators
  • Logical operators
  • Identity operators
  • Membership operators
  • Bitwise operators



string in python

String Literals

String literals in python are surrounded by either single quotation marks, or double quotation marks.

'hello' is the same as "hello".

You can display a string literal with the print() function

#You can use double or single quotes:

 

print("Hello youtube")

print('Hello youtube')

Slicing

You can return a range of characters by using the slice syntax.

Specify the start index and the end index, separated by a colon, to return a part of the string.

Example

Get the characters from position 2 to position 5 (not included):

b = "Hello, World!"
print(b[2:5])

Negative Indexing

Use negative indexes to start the slice from the end of the string:

Example

Get the characters from position 5 to position 1, starting the count from the end of the string:

b = "Hello, World!"
print(b[-5:-2])

String Length

To get the length of a string, use the len() function.

Example

The len() function returns the length of a string:

a = "Hello, World!"
print(len(a))



what is data type in python

Python Numbers

There are three numeric types in Python:

  • int
  • float
  • complex
x = 1    # int
y = 2.8  # float
z = 1j   # complex

Int

Int, or integer, is a whole number, positive or negative, without decimals, of unlimited length.

x = 1
y = 
35656222554887711
z = -
3255522

print(type(x))
print(type(y))
print(type(z))

 

Float

Float, or "floating point number" is a number, positive or negative, containing one or more decimals.

x = 1.10
y = 
1.0
z = -
35.59

print(type(x))
print(type(y))
print(type(z))

Random Number

Python does not have a random() function to make a random number, but Python has a built-in module called random that can be used to make random numbers:

import random

print(random.randrange(110))


what is comment in python

what is comment?

Comments can be used to explain Python code.

Comments can be used to make the code more readable.

Comments can be used to prevent execution when testing code.

#This is a comment
print("Hello, World!")

 

print("Hello, World!"#This is a comment

 

Multi Line Comments

Python does not really have a syntax for multi line comments.

To add a multiline comment you could insert a # for each line:

#This is a comment
#written in
#more than just one line
print("Hello, World!")





how to create variable in python

Creating Variables

Variables are containers for storing data values.

Unlike other programming languages, Python has no command for declaring a variable.

A variable is created the moment you first assign a value to it.

 x = 15

y = "smith"

print(x)

print(y)

Variables do not need to be declared with any particular type and can even change type after they have been set.

x = 14

x = "baker"

print(x)

String variables can be declared either by using single or double quotes:

x = "John"

print(x)

#double quotes are the same as single quotes:

x = 'John'

print(x)




introduction to python programming language

What is Python?

Python is a popular programming language. It was created by Guido van Rossum, and released in 1991.

It is used for:

  • web development (server-side),
  • software development,
  • mathematics,
  • system scripting.

What can Python do?

  • Python can be used on a server to create web applications.
  • Python can be used alongside software to create workflows.
  • Python can connect to database systems. It can also read and modify files.
  • Python can be used to handle big data and perform complex mathematics.
  • Python can be used for rapid prototyping, or for production-ready software development.

Why Python?

  • Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
  • Python has a simple syntax similar to the English language.
  • Python has syntax that allows developers to write programs with fewer lines than some other programming languages.
  • Python runs on an interpreter system, meaning that code can be executed as soon as it is written. This means that prototyping can be very quick.
Python can be treated in a procedural way, an object-orientated way or a functional way