import
tensorflow as tf
import
numpy as np
from
tensorflow
import
keras
model
=
keras.Sequential([keras.layers.Dense(units
=
1
,
input_shape
=
[
1
])])
model.
compile
(optimizer
=
'sgd'
, loss
=
'mean_squared_error'
)
xs
=
np.array([
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
], dtype
=
float
)
ys
=
np.array([
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
,
11
], dtype
=
float
)
model.fit(xs, ys, epochs
=
1000
)
code
=
"Vaibhav Mehra writing for GeeksforGeeks"
n
=
len
(code)
c
=
tuple
(code)
d
=
list
(c)
for
i
in
range
(
0
, n):
s
=
ord
(d[i])
x
=
model.predict([s])
print
(
chr
(x), end
=
"")