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 1,332 Jan-06-2022, 11:38 PM
Last Post: lucasbazan
  How to find vector of a 3D plot mason321 0 1,018 Nov-13-2021, 05:05 PM
Last Post: mason321
  3D vector class with inheritance from 2D vector class buss0140 4 3,153 Dec-20-2020, 08:44 PM
Last Post: deanhystad
  Pointer in the right direction? Viking 5 2,736 Apr-22-2020, 06:14 PM
Last Post: Viking
  Issue with def norm in class Vector DimosG 4 2,492 Mar-26-2020, 05:03 PM
Last Post: DimosG
  Length and direction cosines of lines tarikrr 1 1,771 Nov-15-2019, 04:16 AM
Last Post: SheeppOSU
  Problem in creating a vector termo 11 3,917 Oct-10-2019, 03:09 PM
Last Post: stullis
  Creating Vector from a Program ericvrocha 3 1,897 Oct-08-2019, 07:43 AM
Last Post: newbieAuggie2019
  Some direction needed Patriot1017 3 2,498 Sep-03-2019, 05:44 PM
Last Post: jefsummers
  Practicing using a "flag": please point in right direction magsloo 5 3,105 May-10-2019, 04:58 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

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