Missing Values in Time Series Data Sklearn Random Forest
<p>I am trying to use scikit-learn to build a model, and I want to know what the best way is to deal with my particular type of missing features.</p>

<p>I have a base of users, who each need to complete a goal within a given time frame (for example 3 days). I have basic information about each user that is constant throughout. I've trained a simple Random Forest Classifier on this information, and it is so far pretty good at predicting whether the user will complete the goal.</p>

<p>I also have a day-by-day breakdown of completion percentage for all users who have already completed (or not completed). Two samples with one user who completed and one who didn't might look something like this for three days: <code>[[0., 0.58, 1.], [0.2, 0.5, .8]]</code> where each feature is the percentage through achieving the goal. The first user got to 100% within the timeframe, the second didn't.  </p>

<p>I want to be able to make the predictions for goal completion on the fly. So if there's a new user who's 1 day through the time limit and 20% of the way to the goal, their data might look like this: <code>[[.2, NaN, NaN]]</code></p>

<p>The only way I can see integrating this data into the existing model is fitting a different model for each day (model for day 1, model for day 2, etc.). But this is not at all feasible for my production environment. I also thought about trying to impute the missing values (for the above, something like .2, .4, .6), but I know for a fact that the user goal completion tends not to be linear like this.</p>

<p>Is there a good way to train a model with this kind of data? Or an algorithm supported by scikit-learn or another python library that is built for this kind of task? Note that my model also needs to support probability estimates.</p>

<p>If you are having a Time Series data, one way to deal it with efficiently is to break the time series into different parts. </p>

<p>Also, RandomForest have a very interesting property, the model can handle missing values. And for the probability estimates, the predict_proba() method of the RandomForestClassifier can be used. For more details on this you can have a look at the sklearn RandomForest documentation here : <a href="http://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html" rel="nofollow">http://scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html</a></p>

python scikit-learn