I have a dataset that looks like this :

timestamp          event

12/1/2020 14:30     A  
12/1/2020 14:12     C
12/1/2020 14:10     A
12/1/2020 12:01     B
11/1/2020 21:20     A
11/1/2020 21:00     B
   .....           ...

events are actions by the user on an application. timestamp is when that particular event was raised. I want to mine for sequences of events in the data to find out what a user's work-flow (market basket analysis with time constraint?) has been inside the application from the day user started using the application.

What would the proper approach to solving this problem be? Are there any libraries that will allow me to apply sequence mining as a black box??

  1. Tru to make some features from the datetime columns -

    attr = ['Year', 'Month', 'Week', 'Day', 'Dayofweek', 'Is_month_end', 'Is_month_start', 'Is_quarter_end', 'Is_quarter_start', 'Is_year_end', 'Is_year_start']

you can google search about making date features. 2) Find the cumulative sum of the events -

cumsum_df_all = df.groupby('column')[other-columns].cumsum()
cumsum_14_day = (df.groupby('column')[other-columns].rolling(14, min_periods=1).sum().reset_index(0, drop=True)

like wise for 7,3,1 day, just look how frequent the data is and fast it changes.

  1. Likewise find the roling std dev. and avg.

rolling_avg_14_day = (df.groupby('column')[other-columns].rolling(14,min_periods=1).mean().reset_index(0, drop=True))

set the rolling period accordingly.

  1. find the difference between the event values for a specific period -

    diff_7_day = df.groupby('column')[other-columns].diff(periods=7)

basically, we are trying to convert time ordered sequences to linear regression problem.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.