示例#1
0
def project(v: Vector, w: Vector) -> Vector:
    """return the projection of v onto the direction w"""
    projection_length = dot(v, w)
    return scalar_multiply(projection_length, w)
def gradient_step(v: Vector, gradient: Vector, step_size: float) -> Vector:
    """Moves `step_size` in the `gradient` direction from `v`"""
    assert len(v) == len(gradient)
    step = scalar_multiply(step_size, gradient)
    return add(v, step)
示例#3
0
def gradient_step(v: Vector, gradient: Vector, step_size: float) -> Vector:
    """v에서 step_size만큼 이동하기"""
    assert len(v) == len(gradient)
    step = scalar_multiply(step_size, gradient)
    retrun add(v, step)
示例#4
0
def gradient_step(v: Vector, gradient: Vector, step_size: float) -> Vector:
    step = scalar_multiply(step_size, gradient)
    return add(v, step)
def gradient_step(v: Vector, gradient: Vector, step_size: float) -> Vector:
    """Moves `step_size` in the `gradient` direction from `v`"""
    assert len(v) == len(gradient)
    step = scalar_multiply(step_size, gradient)
    return add(v, step)
示例#6
0
def gradient_step(v: Vector, gradient: Vector, step_size: float) -> Vector:
    """Przejdź o step_size w kierunku gradient od punktu v."""
    assert len(v) == len(gradient)
    step = scalar_multiply(step_size, gradient)
    return add(v, step)
def project(v: Vector, w: Vector) -> Vector:
    """return the projection of v onto the direction w"""
    projection_length = dot(v, w)
    return scalar_multiply(projection_length, w)
示例#8
0
def gradient_step(v:np.array,gradient:np.array,step_size:float)->np.array:
    step = scalar_multiply(step_size,gradient)
    return add(v,step)