ragulpr / wtte-rnn

WTTE-RNN a framework for churn and time to event prediction
MIT License
765 stars 187 forks source link

Example for predicting the destruction of jet-engines #14

Closed aprotopopov closed 7 years ago

aprotopopov commented 7 years ago

In your blog post you have a nice visualization and good predictive results for Predicting the destruction of jet-engines.
Could you attach python code or jupyter notebook to examples directory to reproduce visualizations and prediction results?

ragulpr commented 7 years ago

I'm working on releasing code for the turbofan dataset using Keras. I've added the plots/heatmaps with 7fea00eb4da5fe54d39b72e39c673f69b4e56f00

Try

    from wtte.plots.plot_heatmap import plot_heatmap

    a = predicted[batch_indx,:,0]
    b = predicted[batch_indx,:,1]
    this_x_train = x_train[batch_indx,:,:].mean(axis=1)
    this_x_test =  x_test[batch_indx,:,:].mean(axis=1)

    this_tte_train = y_train[batch_indx,:,0]
    this_tte_test =  y_test[batch_indx,:,0]

    t= np.array(xrange(n_timesteps))
    fig, ax = plt.subplots(1)

    plot_heatmap(
        fig,ax,
        t,
        a,
        b,
        max_horizon = every_nth,
        time_to_event=this_tte_train,
        true_time_to_event=this_tte_test,
        censoring_indicator = None,
        title='predicted Weibull pmf $p(t,s)$',
        lw=1.0,
        is_discrete=True,
        resolution=None,
        xax_nbins=10,
        yax_nbins=4 
    )
    plt.show()
ragulpr commented 6 years ago

I never got around to release turbofan, but @gm-spacagna did it so much better than the original experiment anyway. Check out https://github.com/gm-spacagna/deep-ttf