How do I constrain the output of linear regression (e.g. predicting review scores 1-10) So my training set labels are bounded by 1-10, but if I fit a regression curve it will predict outside this range as well, including negative numbers. Is there a good way to constrain the model outputs besides simply changing all < 1 values to 1 and > 10 values to 10?
I am coding in Python with sklearn.
 A: I think the easiest way to achieve this is to transform your data by dividing every value by 10.  So, instead of ranging from 1-10, it will range from 10% to 100%.
After this transformation, you could use a Logit Regression model.  In Python, you would use the following function: sklearn.linear_model.Logistic Regression. 
A: It really depends on what you need this analysis for. Quite often a linear regression is still used for this kind of data, with any prediction higher than the maximum interpreted as maximum value and any prediction lower than the minimum as minimum value. This approach also has high external validity, if your data at the end of the scale refers to categories labelled with "or more". E.g. if your data is from a questionnaire on willingness to spend and the final category refers to something like "100$ or more". 
A multinomial regression (or multiclass) may also work, but in that case you loose the ordering constraint on your data (assuming the scores imply some kind of order). If your numbers just refer to arbitrary categories without any kind of ordering, then this approach works best.
Any kind of approach that actually limits the data will also suffer from bad prediction at the end of the scale. There are multiple approaches you may try:


*

*Ordinal regression. This approach, however, will only give you probabilities that the answer is below or above a certain range. E.g. in this example the category "Y>=1" is alway Inf, meaning that the value is always larger than 1 (of course it must be, since this is the actual lowest value).

*Multiple logistic regression with varying cut points. Ordinal regression assumes that the change from 1 to 2 is driven by the same variables with the same strength as the change from 9 to 10, which may not be the case. To relax this assumption, you can run 9 different logistic regression. the first predicts the probability that the value is higher than 1 (split your data between 1 and other numbers), the second for being higher than 2 etc. This will, however, suffer from the same drawback as ordinal regression, i.e. low values cannot be predicted well.

*You may also restructure your data, such that you may be able to use a logistic regression. Simply replicate your dataset 9 times. For answers of 1 in the original dataset make all nine responses 0, for answers of 2 make 1 response a 1 and the other 8 a 0, etc with an answer of 10 being coded as 9 answers of 1. Then you can run a logistic regression on this restructured dataset. The resulting probabilities from the logistic regression can also be re-translated to answers in the range 1-10. In this case you loose any possibility to interpret standard errors of the coefficient or p-values, but you will be able to predict the actual score (not just the probability of the score being higher/lower than k). Also, this approach suffers from bad prediction at the end of the scale, since neither 1 nor 10 is a number that ever lies in the prediction range (because they are just the limits of the transfer function).


Best is to try all these approaches and do some cross-validation to see which one works best on your data.
