I have the following data which needs to be linearly classified using least squares. I wanted to visualise my data and then plot the features with colours but I got the following error when assigning the colour colour_cond.
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
Note that data_t is made of 1s and 0s.
import numpy as np
import matplotlib.pyplot as plt
import glob
from scipy.io import loadmat
%matplotlib inline
data = glob.glob('Mydata_A.mat')
data_c1 = np.array([loadmat(entry, variable_names= ("X"), squeeze_me=True)["X"][:,0] for entry in data])
data_c2 = np.array([loadmat(entry, variable_names= ("X"), squeeze_me=True)["X"][:,1] for entry in data])
data_t = np.array([loadmat(entry, variable_names= ("T"), squeeze_me=True)["T"][:] for entry in data])
colour_cond=['red' if t==1 else 'blue' for t in data_t]
plt.scatter(data_c1,data_c2,colour=colour_cond)
plt.xlabel('X1')
plt.ylabel('X2')
plt.title('Training Data (X1,X2)')
plt.show()
"r"and"b"instead of"red"and"blue".