1
$\begingroup$

I would like to build a simple sentiment analysis classifier using logistic regression. I downloaded a list of positive and negative words from cs.uic.edu. There are more than 6000 words both positive and negative. Linear Classifier has the form: (Wikipedia Reference)

$$\sum_{1}^{N} w_j*x_j$$

where $w$ is the weight of the vector $x$ and N is the number of words. So for example, if the weight of vector awesome is 3, then in the following sentence:

Food is awesome and music is awesome.

according to the formula, it will become:

$$3 * 2$$

where 3 is the weight of the vector awesome and 2 is the vector itself (denotes the number of times it occurs in a sentence)

My question is how do I decide the coefficients to start with? Will it be a manual process? There are more than 6000 words. What is the way to approach this?

$\endgroup$

1 Answer 1

0
$\begingroup$

If you are adding up the occurrences of positive or negative words to predict sentiment, there is no reason to build a machine learning model.

In order to build a logistic regression model, you need labeled data. It is not clear what the labels you are using for your problem.

The initial weights for a model depend on the optimization technique. Logistic regression is often optimized with gradient descent. If gradient descent is used, the initial weights are random. Then the model learns how to adjust the weight to minimize errors on the target.

$\endgroup$
1
  • 1
    $\begingroup$ "If you are adding up the occurrences of positive or negative words to predict sentiment, there is no reason to build a machine learning model." I adisagree. The question asked is: "how do I decide the coefficients to start with?" Learning the coefficients is certainly a machine-learning task, by definition. $\endgroup$
    – Stef
    Jan 25, 2022 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.