Best model for regression of data I have a dataset where:
X        Y
123      123
141      151
424      525
12       12
90       90
24       25

Well, the pattern is clear to me. If X contains 4s, replace all of them with 5. If it doesn't, then do nothing.
Now I know the pattern because I generated the dataset myself. I want the model to understand this pattern on its own.
I have tried splitting X into individual digits but can't seem to figure out the best model to give accurate predictions. Any help is appreciated.
 A: In my opinion, Your problem/dataset seems more like a text-processing problem rather than a statistical analysis problem, but still linear regression with some particular dataset can give fairly satisfying results. That means in this case, the regression results depends on the data provided for training such model. 
For example, I've generated a dataset of 10,000 samples ranging in [0, 100]. Fitting a straight line will give more accurate predictions for the points which does not contains 4, because from the below figure, you can see that the straight line(which is result of linear regression) is imposed on such data points but due to the data points which contains 4, the line is slightly shifted above from the position where it should be. This will be more clear in next example. 

Now consider the dataset of 1000 examples of points ranging in [0, 4999]. 

Due to 4's in thousands place, we can see more variance in output. This gives even worse results on the data points which do not contains 4. (You can notice this by observing the resulting line in above graph).
So regression would not be the best choice for such problems. 
