Python Forum
How to understand the vector/direction
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to understand the vector/direction
#1
Question 
In the following piece of code below, I need help understanding the vector and direction. Is the vector vv[0] = to the direction when its zero?

# Perturb with some Gaussian noise
data += np.random.normal(size=data.shape) * 0.4

# Calculate the mean of the points, i.e. the 'center' of the cloud
datamean = data.mean(axis=0)

# Do an SVD on the mean-centered data.
uu, dd, vv = np.linalg.svd(data - datamean)

# Now vv[0] contains the first principal component, i.e. the direction
# vector of the 'best fit' line in the least squares sense.
Larz60+ write Dec-15-2021, 02:08 AM:
Please post all code, output and errors (it it's entirety) between their respective tags. Refer to BBCode help topic on how to post. Use the "Preview Post" button to make sure the code is presented as you expect before hitting the "Post Reply/Thread" button.
Fixed for you this time. Please use bbcode tags on future posts.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Project Direction bclanton50 1 2,243 Jan-06-2022, 11:38 PM
Last Post: lucasbazan
  How to find vector of a 3D plot mason321 0 1,770 Nov-13-2021, 05:05 PM
Last Post: mason321
  How do I make a symmetric matrix from a column vector? leocsmith 3 6,201 Mar-30-2021, 10:17 AM
Last Post: leocsmith
  3D vector class with inheritance from 2D vector class buss0140 4 5,255 Dec-20-2020, 08:44 PM
Last Post: deanhystad
  Pointer in the right direction? Viking 5 4,519 Apr-22-2020, 06:14 PM
Last Post: Viking
  Issue with def norm in class Vector DimosG 4 4,206 Mar-26-2020, 05:03 PM
Last Post: DimosG
  Make dual vector dot-product more efficient technossomy 3 4,151 Nov-28-2019, 09:27 PM
Last Post: Gribouillis
  Length and direction cosines of lines tarikrr 1 2,889 Nov-15-2019, 04:16 AM
Last Post: SheeppOSU
  Inaccurate result when a vector is divided by a matrix FromTheColdNorth 3 3,455 Oct-29-2019, 12:06 AM
Last Post: scidam
  Problem in creating a vector termo 11 7,102 Oct-10-2019, 03:09 PM
Last Post: stullis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020