Machine Learning Classification Model
This scribbling is about Machine Learning - Linear Classification - Model
*The K (Key word), W (Weight) are the two important input an output of Classification model
Q: How is the classification is "linear" ?
A: The output "y" of function f(x) is the linear sum of weighted sum of inputs.
y =f(x)= w1*x1 + w2* x2.... w(i) * x
where w(i) is the weight of parameter x(i). For example, to know the overall sentiment of a restaurant review, we give a weight to each "key word" in the review. The positive keywords have +ve sign and negative ones a -ve. Hence a over all review is calculated by sum of (product of weights * #of occurrences of a word).
If the outcome is > 0 then it is a positive sentiment, otherwise negative. The degree of +ve or -ve is then evaluated.
Lets take this example:
When i train a model on training set of customer reviews, the Liner Classification algorithm results in:
Key word Weight/coefficient
Clean 4
Awesome 5
Good 4
OK 2
Bad -4
Awful -5
disgusting -5
Forget -2
So, when the classification model hence formed is "validated" against the validation set, it purpose of validation set is to make sure the model is not overfitted. if running improvements could be made to the weights, then those need to be made.
The outcome of classfication could be
1) Binary Value - Yes/No - True/False etc... there is no middle groudn
2) Identifying the Class - Which breed does this dog belong ? What type of shoes are these?
The "Class" can be identified by knowing the probability of the item belonging to that class. It should be noted here that Conditional Probability is used here to assess the chances of the predictions could be true.
The probability of binary classification model, resulting in either or TRUE or FALSE, is calculated by formula =
1 / ( 1+ e **(- sun(Wi*H(Xi)).
Note: W is the outcome of ML model "create". This based on feeding the algorithm with TEST DATA which includes the Keyworkds, count of keywords and the outcome/sentiment.
The probability of a prediction belonging to a class gives us a good sense if the prediction made is trust worthy or not. There is another concept of Accuracy in the Classification modelling.
Accuracy measures the overall Model trust worthiness. The formula for Accuracy is
(# of predictions that matched with actual results in the Input Set) / Total Input set.
The Classification model needs to remove "Noise" to allow the model predict the outcomes efficiently. The noise in Classification modeling is the Input with unrelated/unimportant/irrelevant keywords that can influence the algorithm's fucntionality in a negative way.
For example, let us take two customer reviews:
1) This product is really awesome and has arrived on the exact date mentioned when the order was placed. The product is placed in a box that was left in front of the door as expected. But i only opened 3 days after the arrival LOL
2) Awesome Product and arrived on time.
The first example is verbose with all sorts of irrelevant commentary about the product. The second example was spot on. When you feed more of #1 above the outcome of the algorithm could be as crappy as input. One way of solving this is to edit out content from input that is not relevant and keep the keywords as you determined from observing past. "Word Count" is one feature that many Python libraries provide to edit and mask out stuff .
Comments
Post a Comment