►
Description
Using ML.NET within the Microsoft Bot Framework to make predictions on a machine learning model.
Code - https://github.com/jwood803/MLNetExamples/tree/master/MLNetExamples/PredictionBot
Bot Framework playlist - https://www.youtube.com/playlist?list=PLl_upHIj19Zy6hEcOa-uLC0Ged32or2XZ
ML.NET Playlist - https://www.youtube.com/watch?v=8gVhJKszzzI&list=PLl_upHIj19Zy3o09oICOutbNfXj332czx
Contact:
Twitter: https://twitter.com/JWood/
Blog: https://jonwood.co/
Gear used (affiliate links):
Mic - https://amzn.to/2YEXtxI
Mouse - https://amzn.to/2ZtASoQ
A
Hey
everyone,
so
did
you
know
that
you
can
use
ml
net
inside
the
bot
framework
to
make
predictions
well
in
this
video
I'm
gonna
show
how
you
can
do
exactly
that,
and
the
Storting
self
in
visual
studio
here
already
have
created
a
bot
framework
project
here,
and
it's
just
from
that.
Echo
bot
template
and
the
first
thing
I
want
to
do
is
I
want
to
create
a
couple
of
folders
here.
A
So
in
order
to
use
this
I
need
a
couple
of
model
files
for
it.
You
probably
seen
these
and
several
other
videos
put
them
in
a
folder
called
models
and
I'll
create
a
couple
classes
here.
The
first
one
is
going
to
be
the
housing
data
class
for
the
input
schema
here
we
go
and
he's
going
to
err
right
now,
because
we
haven't
done
any
NuGet
packages.
Yet
then
I'll
create
another
class
which
is
going
to
be
the
housing
prediction
class,
and
this
is
going
to
hold
the
output
schema
from
our
model.
A
This
is
going
to
have
the
predicted
house
value
that
I'll
use
for
the
prediction,
and
the
last
I'll
create
another
folder.
This
is
gonna.
Have
my
dialogues
in
here
and
dialogues
in
the
bot
framework
are
essentially
just
a
way
to
manage
conversation
from
the
user,
and
so,
in
our
case,
I
want
to
ask
the
user
a
series
of
questions.
That's
going
to
fill
out
the
input
information,
and
here
so
I
can
use
to
call
it
a
prediction
model
and
get
a
prediction
from
it.
Alright.
A
So
now,
let's
look
at
some
new
get
packages
here
and
installs
them.
The
first
thing
we
need
is
amount
Annette
itself
using
version
1.4
here
alright
and
then
we're
going
to
need
the
Microsoft
ad
extensions,
that
ml
NuGet
package
version
1.4
and
the
reason
we
need
this
is
that,
because
the
bud
framework
is
essentially
a
NBC
project,
we
need
the
extensions
in
order
to
read
in
our
model
file
into
the
application
and
then
last
we
need
the
Microsoft
bot
builder
dialogues
package.
A
A
So
we
do
here
and
our
configure
services
method.
We
do
services
that
add
prediction
engine
pool-
and
this
comes
in
from
that
extensions-
that
ml
package
that
we
installed-
and
here
we
put
in
the
input,
schema
housing
data
and
then
housing
prediction
for
the
output
schema
and
then
we
do
from
file.
We
can
also
do
from
like
yah
if
you
want
to
get
it
from
blob,
storage
or
somewhere
else,
so
we
do
from
file
unison,
our
ml
model,
folder
housing
model
that
zip
and
I'll
I'll
say
watch
for
changes
false
for
now,
all
right.
A
So
next,
let's
create
our
dialog
here,
add
a
new
class
call.
It
housing
prediction
dialog
and
in
here
I
need
to
inherit
from
component
dialog
and
I
bought
builder
dialogues,
NuGet
package
that
we
installed
and
I'm
going
to
create
a
class
level
field
here,
be
private
read-only,
there's
gonna,
be
that
prediction
engine
pool.
A
Here
this
component
dialog,
and
that's
just
the
name
of
our
dialog,
so
I
can
use
the
name
of
operator
and
give
the
name
of
our
class
here.
So
inside
of
our
constructor
here,
I'm
going
to
set
the
prediction
engine
pool
equal
to
what
we
get
in
the
constructor,
and
we
get
this
from
our
start
up
here
that
we
need
a
input
here
and
we
need
to
set
a
couple
of
things
in
here.
First
of
all,
let's
add
a
singleton
for
off
storage,
they're
gonna
be
memory
storage.
A
A
Go
back
to
the
dialog
and
adding
those
Singleton's
is
how
we
know
to
get
the
user
state
and
the
prediction
engine
pool
within
our
constructor
it
as
its
own
dependency
injection
from
there
next
I'm
gonna
define
the
steps
of
my
dialogue
and
the
kind
of
dialogue
I'm
gonna
create
is
a
waterfall
dialogue.
So
each
step
that
we
define
is
going
to
be
happen,
one
after
another,
in
kind
of
a
waterfall
fashion.
There's
gonna
be
an
array
of
waterfall
steps
and
the
first
one
I
want
to
add
is
a
latitude
step.
A
A
setting-
and
these
are
methods
that
we're
gonna,
add
and
I
just
go
ahead
and
add
that
one
just
to
be
a
private
static.
It's
gonna
be
a
sync.
The
task
of
dialogue
turn
result
and
it's
latitude
step.
You
think
it's
gonna
take
in
the
waterfall
step
context
and
then
a
cancellation
token.
Alright
and
all
this
is
gonna.
Do
is
gonna
return.
An
awaited
method
here
from
the
step
context,
we're
going
to
return
a
prompt,
we're
gonna
tell
it
to
prompt
the
message
here.
A
First
thing
is:
give
it
a
dialog
ID
and
we
just
give
it
the
name
of
number
prompt,
because
we're
gonna
ask
for
another
hearing
and
if
it's
going
to
be
a
float
type
and
then
our
second
parameter
is
gonna,
be
the
prompt
options.
So
we
do
new
prompt
options
and
then
here
we
just
tell
the
prompt,
it's
gonna,
be
a
message:
factory
just
create
a
text
from
it
and
it
text
we
wanted
to
send
as
what
is
the
latitude.
A
So
that's
our
first
step
and
what
waterfall
step
items
here,
I'm
going
to
finish
the
constructor,
adding
a
few
things.
I'm
gonna
call
the
a
dialog
method
that
we
get
free
and
I'm
gonna.
Just
let
the
dialogue
know
about
a
few
things.
So
I
can
run
properly
first
I'm
gonna,
say:
there's
a
waterfall
dialog
and
give
it
a
the
name.
A
Waterfall
dialog,
as
the
ID
here
and
I'm
gonna-
tell
the
steps
here.
So
the
dialog
knows
of
these
steps
that
we
give
it
I'm,
gonna,
add
another
dialog
and
it's
gonna
be
a
number
prompt.
So
it
knows
to
use
this
dialog
down
here
from
our
prompts
and
we're
going
to
use,
float
number
of
prompts
and
again
just
give
the
name
of
number
problem
floats
and
then
I'm
gonna
doing
another
process
can
be
a
choice
prompt
and
now,
when
users
choice
prompts
for
our
last
question
in
our
dialog
here.
A
So
we
give
the
user
a
choice
of
the
bushing
proximity
items
because
it's
a
categorical
column
in
our
data
set,
and
so
we
just
give
our
user
some
choices,
so
they
don't
have
to
know
exactly
what
we
need
them
to
put
in
then.
Lastly,
I'll
set
the
initial
dialogue
ID
to
just
the
name
of
the
waterfall
download
and
now
I
can
continue
adding
steps
here
and
just
feels
like
a
time.
I'll
go
ahead
and
add
these
and
then
I'll
come
back
and
finish
our
dialogue
here.
A
All
right
so
I
have
added
the
rest
of
these
steps
here
and
for
the
remaining
steps.
I
added
the
step
contact
values
just
kind
of
this
dictionary
to
hold
the
result
of
the
previous
step
contacts.
So
the
longitude
step
is
gonna.
Take
in
the
result
from
this
prompt,
it's
gonna
have
it
in
this
result,
property
and
I'm
just
gonna
store
it
in
their
step.
Contacts,
values
and
I.
A
Do
that
with
pretty
much
all
the
rest
of
these
steps
here,
but
then
we
get
down
to
ocean
proximity
and
remember
that's
the
categorical
calling
that
we
have
here
and
since
we're
going
to
use
that
choice
prompt
to
do
that
as
returned
awaits
step
context-
and
we
do
another
prompt
this
time
with
your
name
of
choice
prompt
and
we
do
new,
prompt
options
that
stays
the
same.
Then
our
prompt.
We
still
give
it
a
message,
factory
text,
to
tell
the
user
what
we
want
them
to
descend
in.
A
A
A
So
we
have
the
less
choices
for
them
to
choose
from,
and
these
choices
will
pop
up
on
the
dialog
for
them
to
click
on
that's
our
choice
and
then
our
last
step
here
is
to
finish
dialog
async.
This
is
going
to
last
up
that
it
runs,
and
in
this
step
this
is
where
I'm
going
to
make
my
prediction
here
and
so
I
can
create
a
new
housing
data
object.
Again,
I
can
just
fill
in
my
items
that
we
got
from
our
store
values.
A
Most
of
them
are
going
to
be
floats
so
I'm
going
to
parse
these
items.
So
we
do
step
values.
We
do
longitude.
We
need
to
do
it
as
a
string
for
a
de
Porres
correctly.
So
let's
do
that.
Do
all
these
other
ones
here
and
then
for
the
ocean.
Proximity
like
to
do
something
a
little
bit
different.
So
we
can
do
step
values,
ocean
proximity,
those
coming
in
as
an
object
here,
and
that
object
is
found
choice
and
what
we
need
to
do
from
that.
A
I'm
still
an
object,
and
we
need
to
get
the
value
from
that
in
order
to
get
the
strain
value
from
it.
So
now
we
have
our
object
that
we
want
to
predict
on
so
now
we
can
use
that
prediction.
Engine
pool
call
predict
on
it
and
just
give
it
the
housing
data
and
then
to
send
the
prediction
to
the
user
for
our
our
but
you're
stuck
context
that
context
and
it
from
there.
We
need
to
send
activity.
Async
now
do
a
string
here.
A
A
Enter
this
flood,
so
I
do
return,
weight,
step
context
that
end
dialogue,
async,
that's
ending
the
step
context
at
values
and
certain
cancellation
token
in
there
as
well,
and
that's
it
for
our
dialogue,
and
you
see
that
encapsulate
all
that
we
want
to
do
from
asking
our
user
all
the
questions
and
then
and
handles
when
the
questions
have
ended.
So
just
go
back
to
the
bot
have
to
do
a
couple
things
here.
I
said:
first
create
a
couple
of
class
fields
here:
I'm
just
going
to
do
a
dialogue.
A
A
Do
it
another
bad
state?
It's
gonna
be
a
user
state
and
it
will
just
create
a
constructor
because
to
need
to
pass
in
some
stuff
on
dependency
injection.
First,
we'll
do
the
conversation
state
and
then
the
user,
state
and
I
need
pests
in
the
dialogue
do
a
type
of
T
dialogue
and
we
need
to
specify
this
class.
A
We
can
constrain
up
where
tea
inherits
from
dialogue
and
it
for
that
tea
to
work.
We
need
to
set
it
in
our
class
name
very
good.
We
can
create
as
many
dialogues
as
we
want,
but
and
used
to
inherit
from
the
dialogue
class
and
since
we
said
the
predictions
bot
of
tea
go
back
to
our
startup
got
an
error
here,
and
so
we
need
to
pass
in
tea
and
here
which
is
going
to
be
the
housing
prediction
dialogue
so
back
in
our
bot.
A
Here
in
our
constructor,
we
will
set
that
log,
II,
couldn't
dialogue
and
all
these
other
items
here
on
this
on
message,
activity,
async
put
some
new
stuff
in
here.
We
will
await
that
dialogue
and
we
tell
it
to
run
you
think
in
the
past
and
that
turn
context
that
we
get
on
this
method.
Signature
I
mean
the
conversation,
states,
great
property
of
dialogue,
states
and
then
give
it
and
pass
in
the
name
of
dialogue
state
to
it
and
then
again
send
the
cancellation
took
him.
A
A
First,
let's
make
sure
your
async
is
in
there
to
set
the
conversation,
State,
Save,
Changes,
a
think
and
just
passing
the
turn
context
tell
not
to
force
saving
and
then
passing
a
cancellation
token,
and
then
the
user
state
to
do
the
same
thing
and
then
the
last
method
that
we
need
is
the
on
end
of
conversation
activity
and
that
just
calls
the
base
method
there
and
I
just
toast
about
to
in
all
right.
So
we
have
that
let's
run
this
and
see
how
this
works
all
right.
So
it's
running.
A
Okay,
let's
launch
the
emulator
you're
good
and
I'll
copy
this
endpoint
and
good.
We
don't
need
a
app
ID
or
password
and
let's
kick
off
the
bot
here.
I
was
like
you've
got
an
error
somewhere.
Let's,
let's
see
okay,
so
we
need
to
set
this
property
to
the
dialogue
memory
that
was
set
here.
No,
let's
spell
this
correctly
all
right.
Let's
run
this
again
and
I'll
reconnect
to
the
bot
and
kick
it
off
again
and
I'm.
Just
gonna
put
some
pretty
random
stuff
for
these
values,
so
C
1,
21.
A
A
1602
for
total
number
of
rules
and
remember
this
data
is
from
a
general
area
and
itself
depending
on
the
longitude
and
latitude,
and
that's
why
these
numbers
seem
kind
of
vague
for
a
total
rooms
and
all
that
bedrooms
who
do
7
to
75
for
households
and
169
for
median
income
and
here
ocean
proximity.
Here's
that
choice
prompt
that
we
added.
So
we
get
the
number
of
choices
and
I
guess:
I'll
accused
Island.
A
House
prediction
is
almost
7
million,
so
remember
this
is
California
and
data
said
so
that
might
be
right,
but
it
shows
that
we
can
use
a
model
net
within
our
butt
framework
here
and
it
was
pretty
easy
to
do
and
main
thing
was
you're
setting
up
the
dialogue,
making
sure
that
runs
correctly
so
I'll
end.
Things
here
hope
you
enjoyed
the
video
I'll,
see
you
next
time,
Thanks.