These are the code I wrote and referred to for doing my homework

Doc_classification.m is the master file. To run the code, change the
parameters in doc_classification appropriately and run.