def remove_projection_from_vector(v: Vector, w: Vector) -> Vector: """projects v onto w and subtracts the result from v""" return subtract(v, project(v, w))
def de_mean(data: List[Vector]) -> List[Vector]: """Recenters the data to have mean 0 in every dimension""" mean = vector_mean(data) return [subtract(vector, mean) for vector in data]