DATA MUNGING
DATA CLEANING PYTHON
MACHINE LEARNING RECIPES
PANDAS CHEATSHEET
ALL TAGS
# How to add and subtract between matrices?

# How to add and subtract between matrices?

This recipe helps you add and subtract between matrices

Have you tried to add or substract matrices in python?

So this is the recipe on how we can add and subtract between matrices.

```
import numpy as np
```

We have only imported numpy which is needed.

We have created two matrices on which we will perform operations.
```
matrixA = np.array([[2, 3, 23],
[5, 6, 25],
[8, 9, 28]])
matrixB = np.array([[1, 2, 3],
[4, 5, 6],
[7, 8, 9]])
```

First we are adding the two matrices using the numpy function np.add. After that we are performing substraction by using the numpy function np.subtract, in both the function we have passed the matrices.
```
print(np.add(matrixA, matrixB))
print(np.subtract(matrixA, matrixB))
```

So the output comes as

[[ 3 5 26] [ 9 11 31] [15 17 37]] [[ 1 1 20] [ 1 1 19] [ 1 1 19]]

**
Download Materials
**

Use the Zillow dataset to follow a test-driven approach and build a regression machine learning model to predict the price of the house based on other variables.

Text data requires special preparation before you can start using it for any machine learning project.In this ML project, you will learn about applying Machine Learning models to create classifiers and learn how to make sense of textual data.

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

In this NLP AI application, we build the core conversational engine for a chatbot. We use the popular NLTK text classification library to achieve this.

This project analyzes a dataset containing ecommerce product reviews. The goal is to use machine learning models to perform sentiment analysis on product reviews and rank them based on relevance. Reviews play a key role in product recommendation systems.

In this data science project, you will predict borrowers chance of defaulting on credit loans by building a credit score prediction model.

In this machine learning project, we will use binary leaf images and extracted features, including shape, margin, and texture to accurately identify plant species using different benchmark classification techniques.

In this supervised learning machine learning project, you will predict the availability of a driver in a specific area by using multi step time series analysis.

In this machine learning pricing project, we implement a retail price optimization algorithm using regression trees. This is one of the first steps to building a dynamic pricing model.

PySpark Project-Get a handle on using Python with Spark through this hands-on data processing spark python tutorial.