Handbook
Glossary
gradient-descent ( X y params lr n-iters -- history params )
Vocabulary
tensors
.
demos
.
private
Inputs
X
an
object
y
an
object
params
an
object
lr
an
object
n-iters
an
object
Outputs
history
an
object
params
an
object
Definition
USING:
accessors
kernel
math
sequences
tensors
;
IN:
tensors.demos.private
::
gradient-descent
( X y params lr n-iters -- history params )
lr y
shape>>
first
/
:>
batch-lr
{
n-iters
}
zeros
:>
history X
transpose
:>
X-T params
n-iters
[
swap
dup
:>
old-params batch-lr X-T X old-params
matmul
y
t-
matmul
t*
t-
:>
new-params X y new-params
compute-cost
swap
history
set-nth
new-params
]
each-integer
history
swap
;