What is covariance and how to find covariance in python?
MACHINE LEARNING RECIPES DATA CLEANING PYTHON DATA MUNGING PANDAS CHEATSHEET     ALL TAGS

# What is covariance and how to find covariance in python?

This recipe explains what is covariance and how to find covariance in python

0

## Recipe Objective

What is covariance? How to find covariance in python? Covariance It is the measure of the strength of correlation between two variables or set of variables. There are certain possibilities which are:

Cov(xi, xj) = 0 then the variabels are not correlated

Cov(xi, xj) > 0 then the variabels are possitively correlated

Cov(xi, xj) >< 0 then the variabels are negatively correlated.

## Step 1 - Import library

``` import numpy as np ```

## Step 2 - Take Sample data

``` Sample_data = np.array([[11,20,35],[40,58,64],[71,87,96]]) print("This is Sample array:","\n",Sample_data) ```
```This is Sample array:
[[11 20 35]
[40 58 64]
[71 87 96]]```

## Step 3 - Print Results

``` print("The Covariance of Sample data:","\n",np.cov(Sample_data)) ```
```The Covariance of Sample data:
[[147.         138.         146.5       ]
[138.         156.         157.        ]
[146.5        157.         160.33333333]]```

#### Relevant Projects

##### Data Science Project on Wine Quality Prediction in R
In this R data science project, we will explore wine dataset to assess red wine quality. The objective of this data science project is to explore which chemical properties will influence the quality of red wines.

##### PySpark Tutorial - Learn to use Apache Spark with Python
PySpark Project-Get a handle on using Python with Spark through this hands-on data processing spark python tutorial.

##### Data Science Project-TalkingData AdTracking Fraud Detection
Machine Learning Project in R-Detect fraudulent click traffic for mobile app ads using R data science programming language.

##### NLP and Deep Learning For Fake News Classification in Python
In this project you will use Python to implement various machine learning methods( RNN, LSTM, GRU) for fake news classification.

##### Customer Churn Prediction Analysis using Ensemble Techniques
In this machine learning churn project, we implement a churn prediction model in python using ensemble techniques.

##### Walmart Sales Forecasting Data Science Project
Data Science Project in R-Predict the sales for each department using historical markdown data from the Walmart dataset containing data of 45 Walmart stores.

##### Predict Employee Computer Access Needs in Python
Data Science Project in Python- Given his or her job role, predict employee access needs using amazon employee database.

##### Machine Learning Project to Forecast Rossmann Store Sales
In this machine learning project you will work on creating a robust prediction model of Rossmann's daily sales using store, promotion, and competitor data.

##### Build a Collaborative Filtering Recommender System in Python
Use the Amazon Reviews/Ratings dataset of 2 Million records to build a recommender system using memory-based collaborative filtering in Python.

##### Machine Learning or Predictive Models in IoT - Energy Prediction Use Case
In this machine learning and IoT project, we are going to test out the experimental data using various predictive models and train the models and break the energy usage.