►
From YouTube: Create a Recommendation Model in ML.NET
Description
Quick video to show how to create a recommendation model with the Matrix Factorization trainer using the GoodReads book rating data set.
Data - https://www.kaggle.com/dicoderdisha/goodreads-dataset
Matrix factorization video - https://www.youtube.com/watch?v=ZspR5PZemcs
Full sample code - https://github.com/jwood803/MLNetExamples/tree/master/MLNetExamples/BookRecommendations
Contact:
Twitter: https://twitter.com/JWood/
Blog: https://jonwood.co/
A
Hey
everyone
and
welcome
in
this
video
I,
look
at
a
book
rating
data
set
from
Goodreads
and
will
create
a
recommendation
model
using
MLM
net
note
that
this
will
be
using
version
0.7
of
mo
net.
For
some
reason,
I've
been
getting
some
errors
when
using
0.8
with
this
project,
but
as
soon
as
they
resolved,
I
will
mention
how
to
update
this
example
to
0.8.
Now,
let's
take
a
quick
look
at
the
data
set
itself,
it's
from
kegels,
so
the
data
is
mainly
a
pre-processed
already.
A
There
are
two
CSVs
that
I'll
be
using
their
ratings
file,
which
has
each
user
ID
book
ID
and
the
user's
rating
for
the
book.
There's
also
the
book
features
CSV,
which
has
all
the
details
for
each
book,
and
this
is
mainly
for
getting
the
book
details
for
the
IB,
so
I'm
in
visual
studio
and
a
dinette
core
console
project.
I
already
have
the
project
set
up
to
get
started,
for
instance,
already
have
them
emailed
a
net
zero
point.
Seven
package
downloaded
and
have
put
in
the
datasets
into
the
project.
A
No
debt
for
this
recommendation
model
I
also
need
them.
Microsoft
email
that
matrix
factorization
package.
Since
we
will
be
using
the
matrix,
factorization
trainer
for
a
good
explanation
about
matrix,
factorization,
there's
a
link
to
a
good
video
for
it
in
the
description
alright,
so
the
first
thing
to
do
here
is
to
set
up
where
to
get
the
data
from
so
I'll,
get
the
data
path
set
up
and
then
get
a
variable
to
hold
where
the
data
is
and
then
I
need
to
read
in
the
data.
First,
though,
I
need
to
create
the
ml
context.
A
Now
I
can
create
the
text
reader
from
it,
and
this
takes
in
an
instance
of
the
text
loader
arguments
as
a
parameter.
So
I
can
use
this
to
tell
how
the
data
looks.
For
instance,
I
can
see
what
separator
it
has
and
if
it
has
a
header
I
can
also
specify
the
columns,
there's
only
three
columns
here,
the
rating
which
are
called
label.
The
user.
In
the
book,
ID
now
said
that
data
counter
or
for
which
I
believe
is
a
float
and
then
I'll
tell
at
which
location
they're
on
the
file.
What
does
it
up?
A
We
can
call
the
read
on
the
reader
and
pad
in
the
path
of
the
data.
Now
I
like
to
split
my
data,
so
I
can
use
some
of
it
to
test
my
model
with
to
do
this.
I'll
call
a
train
test,
split
method,
that's
located
on
the
context
and
the
binary
classification
property,
give
it
the
data
from
the
reader
above
and
then
I'll
put
in
a
test
fraction
as
zero
point
to
note
that
I
have
the
parentheses
in
the
variable,
and
this
is
because
the
Train
test
split
method
returns
a
tuple.
A
The
first
item
is
the
training
data,
and
the
second
item
is
the
test
data.
Now
that
we
have
our
data
prepared,
this
build
our
pipeline.
The
first
thing
to
do
is
to
encode
or
user
and
book
IDs,
so
we'll
use
the
map
value
two
key
method.
That's
on
the
context
that
transforms
the
categorical
property
and
this
method
takes
in
the
original
column
name.
We
use
when
reading
the
data
at
first
I'll.
A
Do
the
user
they're
not
do
not
encode
the
book
ID
for
each
one
of
these
items,
you
can
use
the
a
pin
method
to
attach
them
to
the
Python,
and
the
last
item
in
the
pop-on
will
be
to
use
the
algorithm
and,
as
mentioned
above,
are
used
to
matrix
factorization
trainer
now
pass
in
the
context,
as
well
as
the
string
with
the
label
name
which
I
named
label
from
the
reader
and
then
I'll
use
the
encoded
user.
Id
and
book
ID
names.
A
I
can
add
some
advanced
settings
such
as
the
number
of
iterations
that
it
goes
through,
which
I'll
said
to
20
and
the
number
of
K
to
100,
which
you
can
think
of
it
as
using
k-means
clustering
within
this
trainer.
With
the
pop-up
setup,
I
can
now
train
the
model
by
calling
a
fit
method
and
passing
in
the
training
data
all
right.
So
now
that
I
had
the
model
is
evaluated
with
the
test
set
and
in
order
to
do
that,
I
need
to
transform
it
the
same
way.
A
I
do
need
to
make
some
classes
specifically
the
classes
that
hold
a
schema
of
the
input,
data
and
another
to
hold
the
prediction.
Output
I'll
create
a
new
class
and
name
a
book
writing
and
in
here
I
just
add
a
few
fields:
fields,
label,
user
and
book.
Id
I'll
create
another
new
class
and
call
the
book
rating
prediction,
and
then
we
just
have
label
and
score
fields
on
it.
A
It
goes
through.
Some
root
mean
squared
error,
information
for
each
iteration,
and
then
there
is
also
the
model
evaluation.
Metrics
then
there's
the
prediction.
So
if
the
user
that
we
chose
or
model
predicts
that
they
will
read,
the
book
that
we
chose
is
around
two
and
there
we
have
it.
We
have
a
recommender
for
book
ratings
use,
an
ml
net.
I
hope
you
learned
something
from
this
video
and
if
you
like,
more
videos
like
this,
please
subscribe
thanks
for
watching
and
I'll
see
you
next
time.