0% found this document useful (0 votes)
19 views31 pages

Summer Training in Data Science with Python

The document outlines a summer training seminar completed by V. Sai Prasanth at Analytics Vidhya, focusing on an Introduction to Data Science course using Python from May 4 to June 14, 2020. It includes details about the course structure, modules covered, and learning outcomes, emphasizing the importance of data science in decision-making. The training involved practical assignments and projects, culminating in a declaration of completion and a certificate.

Uploaded by

sai prasanth
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views31 pages

Summer Training in Data Science with Python

The document outlines a summer training seminar completed by V. Sai Prasanth at Analytics Vidhya, focusing on an Introduction to Data Science course using Python from May 4 to June 14, 2020. It includes details about the course structure, modules covered, and learning outcomes, emphasizing the importance of data science in decision-making. The training involved practical assignments and projects, culminating in a declaration of completion and a certificate.

Uploaded by

sai prasanth
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1

Name: V. Sai Prasanth


Section: K18CJ
Roll. No: A129
Course Code: CSE443
Course Name: Seminar on Summer Training
2

Summer
Course
Platform: Analytics Vidhya
Course Name: Introduction to Data Science.
Language Used: Python
Started on: 04-05-2020
End Date: 14-06-2020
Duration: 50 Days
Assignments Done: 8
3

Declaration
I hereby declare that I have completed my 6 weeks
summer training at Analytics Vidhya platform from May 4,2020
to June 14,2020 under the guidance of MR. Lakshay Arora. I
have declare that I have worked full dedication during the 6
weeks of training and my learning outcomes fulfill the
requirements of training for the award of degree of [Link].
CSE , Lovely Professional University, Phagwara.
4

Index
1. Introduction 5
2. Modules 6
3. Description of Each Module 7
4. Learning Outcomes 27
5. Conclusion 28
6. Certificate 30
5

Introduction:
 Analytics Vidhya:
 Analytics Vidhya Was Established in the Year of 2003.
 Kunal Jain, Founder and CEO of Analytics Vidhya.
 Analytics Vidhya provides a community based knowledge
portal for Analytics and Data Science professionals.

 Python:
 Python is an interpreted, object-oriented, high level
programming language with dynamic semantics.
 Python’s simple, easy to learn syntax emphasizes readability
and therefore reduces the cost of program maintenance.
 Python supports modules and packages, which encourages
program modularity and code reuse.

 Course:
 The Course that I have chosen is Introduction to Data
Science.
 Data is one of the important features of every organization
because it helps business leaders to make decisions based
on facts, statistical numbers and trends.
6

 Due to this growing scope of data, data science came into


picture which is a multidisciplinary field.
 It uses scientific approaches, procedure, algorithms, and
framework to extract the knowledge and insight from a huge
amount of data.

Modules:
We have 6 Major modules:
 Introduction to Python Modules
 Visualizing Data
 Types of Variables
 Dealing with Outliers
 Introduction to Machine Learning
 Assignments and Projects
7

Description of Each Module:


Introduction to Python Modules:
 First, in this module, let’s discuss about,
 Variables and Data types
 Operators
 Conditional Statements
 Looping constructs.
 Data Structures
 String Manipulations
 Functions
 Modules, Packages and Standard Libraries
 Handling text files in Python
 Introduction to Python libraries for Data Science
 Reading data files in python
Variables and Data Types:
• For example, if we take a=5,
Here a is variable and 5 is a constant.
• Basically, the value which can change is called a “Variable”. And
the value which will not change is called a “Constant”.
Data Types:
• Let’s suppose, If we take 5, it is an integer (which does not contain
decimal places).
• 5.1 is a float value (which contain decimal places).
• “Python” is a String (each letter in the string is a character).
Always string data type is in between apostrophe (“…..”).
Operators:
8

• Operators are something which manipulate the given values like


addition(+), subtraction(-), multiplication(*), division(/),
square(**), etc.,
• For example,
>>>4+5=9,
>>>4-5=-1,
>>>4*5=20,
>>>2**4=16.
Conditional Statements:
• If-elif-else
>>>if(condition is true):
#code
>>>elif(condition true): #when the above one is false.
#code
>>>else: #when the both are false.
#code
Looping:
>>>While(condition is true):
#code
>>>for i in range(constant):
#code

Data Structures:
9

• String (which are enclosed in “…..”)


 a=“power point presentation-cse443”
• List (which are enclosed in [])
 a1=[“power”, ”point”, “presentation”, “cse”, 443]
• Tuple (which are enclosed in ())
 a2=(“ppt”, ”cse”, 443)
• Set (enclosed in {}),(it does not allow any duplicate value inside it)
 a3={1,2,3,4,5}
• Dictionary (enclosed in {}), (it has key-value pairs in it)
 a4={“power”:5, “point": "presentation”, “cse”:443}

String Manipulations:
>a=“power”
>b=[Link](“p”, ”c”) #Element replacement
>b1=a[2:5] #String slicing from index 2 to 4 (5 is excluded)
>len(a) #len() is used to calculate the length of the string
>[Link](“p”) #count() is used to calculate number of occurrences in
the string
>b2=a[::-1] #prints the string in reverse order
>[Link](“w”) #tells the index where the “w” is present in a. If not
returns -1.
>[Link](“w”)#tells the index where the “w” is present in a. If not
shows error.
10

Still, There are so many manipulations like startswith(),


endswith(), upper(), lower(), isdigit(), isalpha(), capitalize(), title()., etc,.

Functions:
>def A(a,b):
if(a>b):
return a+b
else():
return a-b
>A(5,6)

Standard libraries:
1. math
import math
[Link](2.26) #3
[Link](2.26) #2
[Link](5) #120
[Link](3,6) #3

[Link]
[Link](1,2,3) #random selection
11

[Link]() #random value between 0 to 1


[Link](1,10) #random value between 1 to 10

Handling text files:


>a=open(“[Link]”, ”w”) #creates the file when we are running it.
>[Link](“on 27th-oct-2020”) #writes the content into the file.
>[Link]() #closes the file
>[Link](“error”) #this throws an error, bcz the file is closed.
Now let’s look on some function for handling text files.
>[Link]() #a list, in which the elements each lines of file.
>[Link]() #reads all the data in file
>[Link](n) #reads first n characters of the file.
>[Link](n) #reads nth line.

Python libraries for Data Science:


1. Numpy #numerical Python
2. Pandas # Series and DataFrames
3. Matplotlib # Graphs
4. Seaborn #Advanced Graphs
5. Scipy #Scientific Python
Handling Data files:
import pandas
12

 Reading csv files:


 A=pandas.read_csv(“[Link]”) # reads the existing csv
file
 pandas.to_csv(“[Link]”) # creates the csv file
 Reading excel/spreadsheets files:
 A1=pandas.read_excel(“[Link]”) # reads the excel file
 pandas.to_excel(“[Link]”) # creates an excel file
 Reading json files:
 A2=pandas.read_json(“[Link]”) # reads the json file
 pandas.to_json(“[Link]”) # creates the json file

2. Visualizing Data:
Here we are going to discuss:
• Subsetting and Modifying Pandas DataFrames
• Sorting and Aggregating Data in Pandas
• Visualizing Patterns and Trends in Data
Subsetting and Modifying Pandas DataFrames:
Subsetting based on position:
• A=pandas.read_csv(“[Link]”)
• A[1:6] #shows 1 to 5 rows in the dataset.
• [Link][[1,3,5]] # shows 1,3 and 5 rows.
• [Link][[1,3,5],[3,4,5]] #shows 1,3,5 rows and 3,4, and 5 columns
for all rows
13

Subsetting based on label:


• [Link][“classon27”] #shows all the rows having row label as
“classon27”.
• [Link][[“classon27”],[“oct”,”sep”]] #shows all the rows and
columns having row label as “classon27” and
column names as “oct” and “sep”.
Subsetting based on value:
• A[A.classon27==“true”] #shows all the rows having “true” in
“classon27” column.
• A[A.classon27==“true”][“oct”,”sep”] #shows all the rows and
columns having “true” in “classon27”
and column names as “oct” and “sep”.
Sorting a DataFrame:
• Sorting a dataframe in python is done by the inbuilt function ie.,
sort_values()
• Syntax is :
1. dataframe.sort_values(by=[parameter])
2. dataframe.sort_values(by=[parameter],ascending=boolean value)
• For example, ‘d’ is our dataframe and we want to sort in by age in
ascending order and strength in descending order.
• d.sort_values(by=[‘age’, ’strength’],ascending=[True, False])

Aggregating DataFrame:
14

• We use some functions like min(), max(), sum(), Count(), etc., to


aggregate dataframes.
• And at last we use groupby() function
• groupby() by default sorts the data in ascending order.
• For example, we can aggregate like:
[Link](‘age’).sum()
Visualizing Patterns and Trends in Data:
• For visualizing data we use two libraries in python namely,
matplotlib and seaborn.
• Matplotlib:
 In matplotlib, we have charts like line chart, bar chart, pie
chart, scatter chart, histogram, etc.,
 Line graph
from matplotlib import pyplot as plt
x=[1,2,3,4,5]
y=[9,52,26,84,98]
[Link](x,y)
[Link]()
15

 Bar graph:
from matplotlib import pyplot as plt
x=[1,2,3,4,5]
y=[9,52,26,84,98]
[Link](x,y)
[Link]()
16

Histogram:
from matplotlib import pyplot as plt
y=[1, 1, 2, 2, 2, 2, 5, 6, 7, 9, 15, 15, 25, 26, 46, 52, 53,59,84, 9
8, 98, 215]
[Link](y)
[Link]()

 Scatter Plot: (works fine with large amount of data)


import random
from matplotlib import pyplot as plt
x=[]
y=[]
for i in range(100):
17

[Link]([Link](1,100))
[Link]([Link](1,100))
[Link](x,y)
[Link]()

Seaborn:
 With seaborn, we have some advanced charts or graphs like
catplot, box plot, pie chart, scatter chart, histogram, etc.,
 Catplot:
import pandas as pd
import numpy as np
import [Link] as plt
import seaborn as sns
data_url = '[Link]
gapminder = pd.read_csv(data_url)
18

[Link](n=3)
[Link](x='continent',y='lifeExp',data=gapminder)

 Box plot: (by adding kind=‘box’)


import pandas as pd
import numpy as np
import [Link] as plt
import seaborn as sns
data_url = '[Link]
gapminder = pd.read_csv(data_url)
[Link](n=3)
[Link](x='continent',y='lifeExp',data=gapminder,kind=‘box’)
19

 Violin plot: (by adding kind=‘violin’)


import pandas as pd
import numpy as np
import [Link] as plt
import seaborn as sns
data_url = '[Link]
gapminder = pd.read_csv(data_url)
[Link](n=3)
[Link](x='continent', y='lifeExp',data=gapminder,height
=4,aspect=1.5,kind='violin')
20

And Many More…

3. Types of Variables:
There are two types of Variables:
• Continues Variables
• Categorical Variables
Continues Variables:
• which are having numbers in their places (in columns)
• These are having min() value, max() value and range().
• d[d[‘age’]==d.[‘age’].min()] # returns the row at which at the
value of age column is minimum.
• d[d[‘age’]==d.[‘age’].max()] # returns the row at which at the
value of age column is maximum.
 Mean:
• d[‘age’].mean() #returns the mean of age column.
21

 Median:
• d[‘age’].median() #returns the median of age column.
 Mode:
• d[‘age’].mode() #returns the mode of age column.
Categorical Variables:
• which are having strings in their places (in columns)
• These are having value_counts(), nunique(), mode().
 Value_counts():
• d[‘gender’].value_counts() # tells how many different values
are present in that column and their count in that column.
 nunique():
• d[‘gender’].nunique() # tells how many unique values are
present in that column.
 Mode():
• d[‘gender’].mode() # tells us the most repeated string.
4. Dealing with the Outliers:
In this module we are discussing about:
• Dealing with Missing values
• Dealing with outliers

Reasons for missing values:


• Formulae errors:
 Something wrong with the Formulae.
22

• Human errors:
 Mistakes done by humans
• Many other factors…
To check missing values:
 [Link]().sum()

Dealing with the Outliers:


• Identifying Outliers:
 We call outliers for values which are not in between Q1-
1.5*IQR and Q3+1.5*IQR.
23

• We can remove this outliers by removing those columns or rows


but preference is given to replacing with mean of all the
remaining data of that column if it is a numerical otherwise for
categorical columns replacing with mode is preferred.
• Thus removing the outliers of the given data.
5. Introduction to Machine Learning:
• Regression
• Classification
• Overfitting
• Underfitting
• Linear Regression
• Logistic regression
• Clustering
Regression:
• Regression analysis is a statistical method to model the
relationship between a dependent (target) and independent
(predictor) variables with one or more independent variables.
• More specifically, Regression analysis helps us to understand how
the value of the dependent variable is changing corresponding to
an independent variable when other independent variables are
held fixed.
• It predicts continuous/real values such as temperature, age,
salary, price, etc.
24

Some examples of regression can be as:


• Prediction of rain using temperature and other factors
• Determining Market trends
• Prediction of road accidents due to rash driving.
Classification:
• A classification problem is when the output variable is a category,
such as “red” or “blue” or “disease” and “no disease”.
• A classification model attempts to draw some conclusion from
observed values.
• Given one or more inputs, a classification model will try to predict
the value of one or more outcomes.
• Sentiment analysis can said to be an example of classification.
Overfitting :
• Overfitting happens when a model learns the detail and noise in
the training data to the extent that it negatively impacts the
performance of the model on new data.
• This means that the noise or random fluctuations in the training
data is picked up and learned as concepts by the model.
• The problem is that these concepts do not apply to new data and
negatively impact the models ability to generalize
Underfitting:
• Underfitting refers to a model that can neither model the training
data nor generalize to new data.
• An underfitting ML model is not a suitable model and will be
obvious as it will have poor performance on the training data.
25

• Underfitting is often not discussed as it is easy to detect given a


good performance metric.
• The remedy is to move on and try alternate machine learning
algorithms.
• Nevertheless, it does provide a good contrast to the problem
of overfitting.
Linear Regression:
• Linear Regression is a supervised machine learning algorithm
where the predicted output is continuous and has a constant
slope. It is used to predict values within a continuous range, (e.g.
sales, price) rather than trying to classify them into categories
(e.g. cat, dog).
• There are two main types:
Simple regression:
• Simple linear regression uses traditional slope-intercept form,
where m and b are the variables.
y=mx+by=mx+b
Multivariable regression:
A more complex, multi-variable linear equation might look like this,
where w represents the coefficients, or weights, our model will try to
learn.
f(x,y,z)=w1x+w2y+w3z
The variables x,y,z represent the attributes, or distinct pieces of
information, we have about each observation.
26

Logistic Regression:
• Logistic regression is a supervised learning classification algorithm
used to predict the probability of a target variable.
• The nature of target or dependent variable is dichotomous, which
means there would be only two possible classes.
• In simple words, the dependent variable is binary in nature having
data coded as either 1 (stands for success/yes) or 0 (stands for
failure/no).
• Mathematically, a logistic regression model predicts P(Y=1) as a
function of X.
• It is one of the simplest ML algorithms that can be used for
various classification problems such as spam detection, Diabetes
prediction, cancer detection etc.
Clustering:
• Clustering is the task of dividing the population or data points into
a number of groups such that data points in the same groups are
more similar to other data points in the same group and dissimilar
to the data points in other groups.
• It is basically a collection of objects on the basis of similarity and
dissimilarity between them.
• For ex– The data points in the graph below clustered together can
be classified into one single group. We can distinguish the
clusters, and we can identify that there are 3 clusters in the below
picture.
27

Assignments and projects:


• I have done 6 assignments and 2 projects:
 Data Structures
 Handling Text Files in Python
 Reading data files in Python
 Subsetting and Modifying Pandas Dataframes
 Sorting and aggregating data in pandas
 Visualizing patterns and trends in Data
 NYC Taxi trip duration
 NYC Taxi trip duration using decision trees
What I have learnt :
Introduction to Python:
In this module I have learned the importance of python
modules in solving data science problems.
28

Visualizing Data:
In this module, I have learned that, there are some graphs
from which we can analyze the things more clearly.
Types of Variables:
In this module, I have learned that, there are some types of
variables that will classify the columns into some distinct group of
columns.
Dealing with Outliers:
Almost every data set contains some outliers, I have learnt a
lot from this module that how to deal with this outliers.
Introduction to ML:
In this module, I have learned that, there is some topics where
machine learning involves in data science such as clustering concept.
Assignments and projects:
In this module, we have discussed some assignments and
projects that I have done in the course.

Conclusion:
• I came to know about some new concepts from this course
namely, clustering regression, etc., and some new python libraries
such as SciPy, scikit learn, etc.,
• Data scientists often come from many different educational and
work experience backgrounds, most should be strong in, or in an
ideal case be experts in four fundamental areas.
29

• In no particular order of priority or importance, these are:


 Business/Domain
 Mathematics (includes statistics and probability)
 Computer science (e.g., software/data architecture and
engineering)
 Communication (both written and verbal)
• Data science is such a domain which includes all the other
domains like mathematics, machine learning, computing, etc.,
30

Certificate:
• Certificate is issued on 14-06-2020, on successfully completing the
course in Analytics Vidhya.
31

You might also like