How would I approach training a model and encoding this categorical data So I have the following data:
I have one series where each word has a value that describes the average review score that would get.
For example, if the word &quot;excellent&quot; showed up in reviews with a score of 2,3,5,4 it would gain a value of 3.5.
I also have a list of the words contained in a review, and the review scores of each of those written reviews.
For example,
Unique_words
[&quot;good&quot;,&quot;clean&quot;,&quot;hotel&quot;,&quot;enjoyed&quot;,&quot;stay&quot;,&quot;here&quot;]

score
4

(These are ofc simplified examples, my actual data is a lot longer)
I also have the original reviews, from which the unique_words are taken from.
The question is, how would I use this data in order to train a machine-learning algorithm to predict what score a review would get, given the unique words contained inside it.
You need to encode categorical variables as dummies.
This means to create new features for each type of category and then assigned either a 1 (where a record has that category) or 0 (to each record that doesn't have that category). With some examples, this should look something like this
                        good  clean  hotel  enjoyed  stay  here
I am good               1     0      0      0        0     0
My face is clean        0     1      0      0        0     0
This is a clean hotel   0     1      1      0        0     0
I enjoyed a good meal   1     0      0      1        0     0
Don't stay here         0     0      0      0        1     0

In python you can use the pandas function pd.get_dummies()