Why Uppercase for X and Lowercase for y is Used in Python Model

In terms of Linear Algebra, it is extremely common to use capital Latin letters for matrices (e.g. design matrix XX) and lowercase Latin letters for vectors (response vector yy). Usually X is a matrix of data values with multiple feature variables, having one column per feature variable. On the other hand, y is a vector of data values. so it has become a standard way to denote uppercase for X and lowercase for y in Python Model.

Let’s see an example:

df = pd.read_csv(‘D:\Datasets\haberman.csv’)
X = df.drop(‘status’,axis=’columns’)
df[‘status’]=df[‘status’].map({1:0,2:1})
y = df[‘status’]

from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.30, random_state=1234)

 

 

Add a Comment