1
$\begingroup$

So I'm having a tough time trying to understand Vectors coming from a CS background, I am reading some books and reading through websites but it still a bit to a low level for me, I need a bit more high-level abstraction to understand it a bit more especially in the sense of machine learning.

I understand that they are kinda like a 1D array (Matrix = 2Dim && Tensor = 3+Dims???) that holds scalars instead of variables and have a direction and magnitude but that about it. So in an attempt to try and understand it better I opened up Python and converted the following dataset into vectors and the did an L2 Norm on each vector:


Boston housing price regression dataset
https://keras.io/datasets/

I wrote this code to convert the data into L2 Norms and also sorted them so similar L2 norms will be together in the 'x' array in the format [L2Value, ElementIndex] This is so when it can sort all the norms in an order I can see which indexes have the closes L2 number.

import numpy as np
from keras.datasets import boston_housing

(x_train, y_train), (x_test, y_test) = boston_housing.load_data()
x = np.array([1,1,3,2,444,9])
print(np.linalg.norm(x, ord=np.inf))
x = np.array([[np.linalg.norm(y), x] for x, y in enumerate(x_train)])
x = x[x[:, 0].argsort()]
print(x)

Now The reason for sorting the L2 numbers is I believed that each data vector/point or record could be placed on a point of similarity. So the numbers which have a smaller distance between each other have more similarity?

So, the dataset has 13 columns/attributes/scalars the L2 Norm takes all of them 13 scalars and makes a number that states how far away it is from 0,0 on a coordinate system, which the only vector that could have the coord 0,0 is one in which all 13 scalars are 0, is this true?

I'm aware I could be very wrong at this but I'm confused for its practical applications on a high level. I tried L^inf But that just seems like a cardinality/length/size function. Where have I gone wrong?

Thanks

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.