Platform
Resources
Pricing
Sign in
Get started
Jarod
I'm a French computer science student at Avignon University
Workspace
Fork
Published
TensorFlow.js
By
Jarod
Edited
1 star
TensorFlow.js
Regression Lineaire
Introduction
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
show
(
tf
.
scalar
(
1
)
)
;
Insert cell
show
(
tf
.
tensor1d
(
[
0
,
1
,
2
,
3
]
)
)
;
Insert cell
show
(
tf
.
tensor2d
(
[
[
0
,
0
]
,
[
1
,
1
]
]
)
)
;
Insert cell
show
(
tf
.
tensor
(
[
[
0
]
,
[
1
]
,
[
2
]
]
,
shape
)
)
;
Insert cell
shape
=
[
3
,
1
]
;
Insert cell
Insert cell
show
(
tf
.
tensor
(
[
[
0
]
,
[
1
]
,
[
2
]
]
)
)
;
Insert cell
Type JavaScript, then Shift-Enter. Ctrl-space for more options. Arrow ↑/↓ to switch modes.
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
const
initial
=
tf
.
zeros
(
[
3
]
)
;
let
variable
=
tf
.
variable
(
initial
)
;
variable
.
print
(
)
;
// affiche [0, 0, 0]
const
updated
=
tf
.
tensor1d
(
[
1
,
1
,
1
]
)
;
variable
.
assign
(
updated
)
;
return
show
(
variable
)
;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
const
a
=
tf
.
tensor2d
(
[
[
10
,
20
]
,
[
30
,
40
]
]
)
;
const
b
=
tf
.
tensor2d
(
[
[
50
,
60
]
,
[
70
,
80
]
]
)
;
const
c
=
a
.
add
(
b
)
;
return
show
(
c
)
;
}
Insert cell
show
(
tf
.
tensor1d
(
[
11
,
22
,
33
,
44
]
)
.
square
(
)
)
;
Insert cell
Insert cell
{
const
a
=
tf
.
tensor3d
(
[
[
[
5
,
20
]
,
[
10
,
40
]
,
[
30
,
75
]
]
]
)
;
const
b
=
tf
.
tensor3d
(
[
[
[
50
,
60
]
,
[
70
,
80
]
,
[
115
,
160
]
]
]
)
;
const
c
=
a
.
mul
(
b
)
.
square
(
)
.
sub
(
tf
.
scalar
(
1000
)
)
;
return
show
(
c
)
;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
const
x
=
tf
.
tensor2d
(
[
[
0.0
,
2.0
]
,
[
4.0
,
6.0
]
]
)
;
x
.
dispose
(
)
;
return
show
(
x
)
;
}
Insert cell
Insert cell
Insert cell
Insert cell
{
const
average
=
tf
.
tidy
(
(
)
=>
{
const
y
=
tf
.
tensor1d
(
[
1.0
,
2.0
,
3.0
,
4.0
]
)
;
const
z
=
tf
.
ones
(
[
4
]
)
;
return
y
.
sub
(
z
)
.
square
(
)
.
mean
(
)
;
}
)
;
return
show
(
average
)
;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
tf
=
require
(
'@tensorflow/tfjs'
)
;
Insert cell
Insert cell
import
{
show
}
from
'@zaidalyafeai/show-tensor'
Insert cell
Purpose-built for displays of data
Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Try it for free
Learn more