2

I am trying to use Logistic Regression to make a spam filter, but I am having trouble understanding the weight update part. I have processed my email dataset, and I have an attribute vector of the top n words that are most likely to be contained within a spam.

From my understanding, during training, I will have to implement an optimization formula after each training example in order to update the weights.

$$ w_l \leftarrow w_l + \eta \cdot \sum_{i=1}^m [ y^{(i)} - P(c_+ \mid \vec{x}^{(i)} )] \cdot x_l^{(i)} $$

How does a formula such as this work? How can it be implemented in Python?

nbro
  • 42,615
  • 12
  • 119
  • 217
kostas
  • 31
  • 2

1 Answers1

1

I think i found out how that works, so i made a short article about it . https://medium.com/@kourloskostas/python-spam-filter-86b21d7d1564 I hope it helps!

kostas
  • 31
  • 2