I would like to apply Bayesian network on some data. However, some of the variables are related to time.

E.g. Number of time he/she visit library.

As the value can be defined as Total number of this person visits, Average weekly number of he/she visit, Daily number of visits, or even Number of visits in the last 3 days etc... I do not want to include all these different variations in my network

Then how should I treat feature like this properly?

Many thanks for your help


I am afraid you won't like this answer, but it depends on what you want to do.

Non-Time-Series-Modelling-Point of View

Here is an example: Suppose you want to predict whether a certain person is visiting the library at the next day. The starting point for your data is hence the data-id + person_id + label (visit=true/false). Now the question is which predictors are needed. Can you tell me which of this predictors is meaningful or not (without performing any modelling) ?

  • average-number-of-visits per week: Persons visiting the library more often have a higher chance of visiting the next day
  • number-of-visits-in-the-last/days/hours: Some people go one only once per week to the library, but not always on the same day. So depending on the total-visit-count per week + whether the customer has visited the library recently, one could say whether the same person will come in again the next day.
  • daily-number-of-visits: Every day multiple visits ? Or only multiple visits on the one weekday where the person comes in ?

and so on ... I think you get the idea. I would try to generate a good amount of predictors and then apply subset selection techniques to find the best combination (yes, I am a machine learner).

Time-Series-Modelling-Point of View

I admit I do not know that much about time-series analysis. I can only imagine that drawing one timeline per customer (e.g. in days or hours on the time/x-axis + plus a peak everytime the customer visits) and classifying this timelines (in context of the example in the first section) might help.

PS: I am aware that this answer is not as complete as it should be. However, I hope to stimulate the discussion that way so one can come up with the true answer.

  • $\begingroup$ Thank you very much for your answer. All the preidictor you mentioned are meaningful. To simply the problem, lets suppose I am trying to find out the number of library visit and how many book borrowed, how long each book kept etc realted to a student final mark of this course. $\endgroup$
    – zhang
    Feb 1 '11 at 17:46
  • $\begingroup$ if I use predictor a1, b1, c1 to build network(a1 is avearge number of library visit per week, b1 is average book borrowed weekly etc). and I build another network with a2, b2, c2 (a2 is total number of libary visit, b2 is total book borrowed). ... what if I want to find out combination (a1, b2, c1)?? Does that mean I have to include all these variation in the network? if yes, which one is parents? a1 or a2 ... and I think the network will be very compliate. there must be smart way to do it I think? $\endgroup$
    – zhang
    Feb 1 '11 at 17:53
  • $\begingroup$ My main goal is to find something like: if a student go to libary total number >50,and average weekly borrowed books >3, or last week borrow book.2 .... then the probability of the student get good mark is 80%. as you can see, not only the structure of these rules will be different combination of different predictor, I also need to find the threshold for each one, such as 50 for total book borrowed in the example. as Bayesian network normally do not take contiunous values, thus I possibly could try different thresholds to discretize these continuous value. $\endgroup$
    – zhang
    Feb 1 '11 at 18:09
  • $\begingroup$ You may think a decision tree will work best for this kinda problem. however, there are a lot unknown factors will affect the result, thus I think probability based model like Bayesian network might be more suitable $\endgroup$
    – zhang
    Feb 2 '11 at 10:18
  • $\begingroup$ @Zhang: 1. decision trees are also based "on counting" and calculating approximate probabilities (similar to bayes), so this is no argument. The question is whether you want to have rules at the end (as stated in one of your comments) or not. 2. If you do not want to have rules, I'd try a naive bayes first and if the results are not satisfying, switch to bayesian network 3. a) Bayesian Networks do take continuous variables, it is just more difficult b) finding the correct/best network architecture is an NP-problem. I suggest to learn/read more how to build BN. $\endgroup$
    – mlwida
    Feb 2 '11 at 10:53

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.