Observations weight-age in a Machine Learning model I want to know is there any way in R/Python to specify to the model to emphasize its learning more on specific subset of data , while it considers the whole data. 
For example - i have sales behavior data from 2011 to 2016 and i am predicting likelihood to buy in 2017 - i want the model to emphasize more on 2015-2016 data ( i.e. capture new learning - which may not be very evident when you consider the whole data from 2011 ). I can always build a separate model for for that time period or consider a time year variable for it to capture the effect , but is there some way to specify to the model that focus more on rows ( x to y ) as in give more weight-age to the learning from this subset from whole data. 
 A: One general approach is to try oversampling more/undersampling less important data.
With respect to weights it will depend on the algorihtm. 
In Python it seems many algorithms in scikit-learn have it, for example SVMs, Stochastic Gradient Descent classifiers, and Random Forests have it, though unfortunately I can't find general documentation on this parameter.
A: Keras offers the ability to apply weight to every sample invdividually.
You can view the entire keras model api here.
The description of the sample_weight parameter of keras "fit" function is as follows:

sample_weight: Optional Numpy array of weights for the training samples, used for weighting the loss function (during training only). You can either pass a flat (1D) Numpy array with the same length as the input samples (1:1 mapping between weights and samples), or in the case of temporal data, you can pass a 2D array with shape  (samples, sequence_length), to apply a different weight to every timestep of every sample. In this case you should make sure to specify sample_weight_mode="temporal" in compile().

As far as i know keras is used for neural networks, so this feature is available for those but not for other models like svm or random forest
