How to Flatten a Matrix?

How to Flatten a Matrix?

How to Flatten a Matrix?

This recipe helps you Flatten a Matrix

This python source code does the following: 1. Creates your own numpy array 2. Uses "flatten" function to flatten a matrix
In [1]:
## How to Flatten a Matrix
def Kickstarter_Example_10():
    print(format('How to Flatten a Matrix', '*^72'))

    #load library
    import numpy as np

    # Create matrix
    matrixA = np.array([[1, 2, 3, 23],
                       [4, 5, 6, 25],
                       [7, 8, 9, 28],
                       [10, 11, 12, 41]])

    matrixB = np.array([[2, 3, 4],
                       [5, 6, 9],
                       [7, 8, 1]])

    # Return a flatten matrix
    print(); print(matrixA.flatten())
    print(); print(matrixB.flatten())
************************How to Flatten a Matrix*************************

[ 1  2  3 23  4  5  6 25  7  8  9 28 10 11 12 41]

[2 3 4 5 6 9 7 8 1]

Relevant Projects

Deep Learning with Keras in R to Predict Customer Churn
In this deep learning project, we will predict customer churn using Artificial Neural Networks and learn how to model an ANN in R with the keras deep learning package.

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.

Human Activity Recognition Using Smartphones Data Set
In this deep learning project, you will build a classification system where to precisely identify human fitness activities.

Data Science Project in Python on BigMart Sales Prediction
The goal of this data science project is to build a predictive model and find out the sales of each product at a given Big Mart store.

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.

Sequence Classification with LSTM RNN in Python with Keras
In this project, we are going to work on Sequence to Sequence Prediction using IMDB Movie Review Dataset​ using Keras in Python.

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.

Zillow’s Home Value Prediction (Zestimate)
Data Science Project in R -Build a machine learning algorithm to predict the future sale prices of homes.

Anomaly Detection Using Deep Learning and Autoencoders
Deep Learning Project- Learn about implementation of a machine learning algorithm using autoencoders for anomaly detection.

Loan Eligibility Prediction using Gradient Boosting Classifier
This data science in python project predicts if a loan should be given to an applicant or not. We predict if the customer is eligible for loan based on several factors like credit score and past history.