This is the implementation for the paper titled “Modeling Social Norms Evolution for Personalized Sentiment Classification”. We provide all the source codes for the algorithm and related baselines.

Quick Start (For Linux and Mac)

1. Download the whole compressed file named MTLinAdapt.tar.gz to your local machine.


Use the command to extract the whole file.


Use the command to compile the whole project.


Use the command to run the MTLinAdapt algorithm with default setting.

Questions regarding running MTLinAdapt and Baselines

Q1: What’s inside the folder /MTLinAdapt?

There are four folders and two files inside the folder:


Four folders:

/src folder provides all the source codes for our algorithms and baselines.

/libs folder has all the jar files needed for the project. If you want to import the project into IDE, you may need to import these lib files too.

/bin folder is usually where the compiled files are copied to. After you compile the whole project, the bin folder will be updated.

/data folder has all the data needed for the experiments reported in the paper, including both Amazon data(/data/CoLinAdapt/Amazon/) and Yelp data(/data/CoLinAdapt/Yelp/).


/data/CoLinAdapt/Amazon contains all the files needed for running on Amazon dataset:

-SelectedVocab.csv is the 5000 features we selected for training for Amazon dataset.

-GlobalWeights.txt is the weights for features trained on a separate data.

-Users contains 9760 users.

-CrossGroups_400.txt is the 400 feature group indexes for all features. Similarly, CrossGroups_800.txt, CrossGroups_1600.txt are feature indexes for 800 feature groups and 1600 feature groups. At most, we can have 5000 feature groups, which means each feature will form a group.

Two files:

compile is the compiling file.

run is execution file.

Q2: How to run the algorithm MTLinAdapt with different parameters?

We use ‘-model’ to select different algorithms and the default one is MTLinAdapt in batch mode. If you would like to run MTLinAdapt in batch mode, just use the default model setting. If you would like to run MTLinAdapt in online mode, you MUST set the adaptRatio to be 1, together with setting the model being “mtlinonline”.

The following table lists all the parameters for MTLinAdapt:


One sample command is as follows:


Q3: How to run baselines?

As reported in the paper, we have six baselines in batch mode. We can use “-model” to select baselines, the corresponding parameters are specified in the above table. For example, I would like to run GlobalSVM on Amazon dataset, then after the compiling, input the following command line:


Q4: What does the output mean?

The expected output is as follows:


The first seven lines of text are training information, 5000 features, 2-gram, 9760 users in training, 143161 reviews in total. Feature group size for individual users is 801, the additional dimension is for bias. We have 69235 training reviews, which have ratio of positive reviews being 0.75, together we have 73911 testing reviews with positive ratio being 0.73.

The circle means the function value decrease during the optimization process while the cross means the function value increases. Since the optimization process involves the line search, the function value increases sometimes.

The next line is the information of the parameters used in the current run, dim is the feature groups for individual users, dimSum is the feature group for super user and personalized being true means we are doing personalized sentiment modeling. We also print out the confusion matrix, together with Micro F1 and Macro F1 for both classes. Class 0 is negative class and Class 1 is positive class. More detail about the experimental setting can be found in our paper.