# Predicting Reputation in the Sharing Economy with Twitter Social Data
## 4 Prediction Model
This experiment shares two characteristics with the challenges that actuaries face when doing risk modeling in the insurance industry: first, the events are infrequent counts, and second, there is high uncertainty about the predictions of a single entity [88]. Because of these similarities, we have designed our experiment with the tools of actuarial science, such as Generalized Linear Models for modeling of count data and gain curves for model performance evaluation [89]. Generalized Linear Models (GLMs) [90] are a means of modeling the relationship between a variable whose outcome we wish to predict and one or more explanatory variables. GLMs are parametric models, which are simpler and easier to understand than non-parametric models as the ones usually used in ML. At the same time, as a generalization of ordinary linear regression, they can be used to model the probability of occurrence or non-occurrence of counts, which is not possible with a simple Linear Regression. These characteristics make GLMs a good fit for the task of explaining the effects of the features on the predictions of the target variable. Two of the limitations of parametric models are: i) the necessity of choosing the right distribution for the model and ii) the lack of robustness to correlated features. Nevertheless, determining accurate estimates of relativities in the presence of weakly correlated rating variables is a primary strength of GLMs versus other univariate analyses, ensuring that no information is double-counted [89]. No strong correlation (understood as a Pearson coefficient bigger than 0.4 [91]) is found between any of the features. In a generalized linear model, each outcome of the dependent variables is assumed to be generated from a particular distribution in the exponential family. GLMs model the relationship between \(\upmu\) (the model prediction) and the predictors as follows:  
\[g(\mu)=\beta_{0}+\beta_{1}x_{1}+...+\beta_{n}x_{n} \tag{1}\]  
Equation 1 states that some transformation \(g\) (link function) of \(\mu\) (target variable) is equal to a linear combination of an intercept coefficient \(\beta_{0}\) and a set of weighted predictors, where \(x_{1}...x_{n}\) are the predictors, \(\beta_{1}...\beta_{n}\) are the weight coefficients and \(n\) the number of predictors. By training the model, the coefficients (\(\beta_{0}...\beta_{n}\)) are estimated and used to predict the target variable. GLMs, and more specifically, multiplicative models, are widely used in the risk assessment insurance industry for their capacity to produce a multiplicative rating structure that easily explains the effect of each predictor in the final score [89]. In case of using the log link (natural logarithm \(ln\)):  
\[ln(\mu)=\beta_{0}+\beta_{1}x_{1}+...+\beta_{n}x_{n} \tag{2}\]  
\[\mu=e^{\beta_{0}+\beta_{1}x_{1}+...+\beta_{n}x_{n}}=e^{\beta_{0}}\cdot e^{ \beta_{1}x_{1}}\cdot...\cdot e^{\beta_{n}x_{n}} \tag{3}\]  
For our experiments, we have built a GLM from the Negative Binomial distribution family, using the _set of Twitter features_ as predictors (\(x_{1}\),..., \(x_{n}\)). While the target variable \(y\), defined as the ratio of bad ratings for each user \(count_{bad}\) to the total count of ratings for each user \(count_{total}\), is not a discrete variable but \(y\in[0,1]\), we can still perform a Negative Binomial regression by using the logarithm of the total count of ratings as an offset to the regression. By multiplying both sides of the equation by the count \(count_{total}\), we move it to the right side of the equation.