Handbook
Glossary
linear-regression ( X y lr n-iters -- )
Vocabulary
tensors
.
demos
Inputs
X
an
object
y
an
object
lr
an
object
n-iters
an
object
Outputs
None
Definition
USING:
accessors
arrays
io
kernel
math.parser
prettyprint
sequences
tensors
tensors.demos.private
;
IN:
tensors.demos
::
linear-regression
( X y lr n-iters -- )
X
normalize
y
shape>>
first
1
2array
ones
swap
2array
hstack
:>
X-norm X-norm
shape>>
second
1
2array
zeros
:>
params X-norm y params
compute-cost
number>string
"The initial cost is "
swap
append
print
X-norm y params lr n-iters
gradient-descent
"The optimal parameters are "
print
.
last
number>string
"The final cost was "
swap
append
print
;