Blog

Co-occurrence Matrix : The Definitive Guide

co-occurence matrix

A co-occurrence matrix, also referred to as a co-occurrence distribution, is defined over an image to be the distribution of co-occurring values at a given offset. Any matrix or pair of matrices can be used to generate a co-occurrence matrix, though their most common application and also in best SEO strategies.

In this case, we used co-occurrence matrix to differ out the co-occurring terms from the main site’s content and the competitor site’s content in a matrix form. The terms which appear mostly in the matrix have high TF(term frequency).

Loading Libraries: 

coocurrance 1

Loading stopwords:

Fetching the file:

coocurrance 3

Creating corpus and cleaning it:

Creating a document term matrix:

coocurrance 5

Creating the co-occurrence matrix:

coocurrance 6

Output:

coocurrance 7

  •  
  •  
  •  
  •  

Leave a Reply

Your email address will not be published. Required fields are marked *