An array is an indexed collection of values arranged for efficient numerical work. In Python machine learning, NumPy arrays hold datasets and support mathematical operations. section 3.16
Arrays can represent data in several useful shapes:
- A one-dimensional array can hold feature values and matching labels, such as measurements paired with outcomes. section 3.16
- A two-dimensional array can store several features for each data point, such as counts of two words in sentences. section 5.18
- A matrix can store an image as rows and columns of pixel intensities, then be reshaped into a vector for a neural network. section 10.19
A small feature-and-label array
features = np.array([1, 2, 3, 5, 6, 7]) and labels = np.array([155, 197, 244, 356, 407, 448]) keep the inputs and their corresponding outputs in separate, aligned arrays. section 3.16
import numpy as np features = np.array([1,2,3,5,6,7]) labels = np.array([155, 197, 244, 356, 407, 448])
Inspect a short NumPy example that creates aligned feature and label arrays. section 3.16















































