<p>I understand that in your example you are interested in modelling the outcome of the 'result' column.</p>

<p>One easy model I would suggest is to model it using the Bernoulli distribution (<a href="https://en.wikipedia.org/wiki/Bernoulli_distribution" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Bernoulli_distribution</a>) with the probability of success <em>p</em>.</p>

<p>Then you can model <em>p</em> with something like this</p>

<p>x = a + b * log(page_views) + c * log(time_spent) + e</p>

<p>p = exp(x) / (1+exp(x))</p>

<p>where <em>e</em> is normally distributed,
e ~ N(0, sigma^2)
(or simply centered around zero).</p>

<p>a, b and c are parameters that you can estimate.</p>

<p>I.e. the probability of success (conversion) is modeled as a sigma function of a certain variable that depends on page_views and time_spend. You can also add squares (and higher powers) of page_views and time_spend in the equation of <em>x</em> (i.e. upto a certain threshold page_views can have a positive effect on conversion and then a negative one, then again a positive effect).</p>

<p>Also reading about logistic regression should put you on the right track: <a href="https://en.wikipedia.org/wiki/Logistic_regression" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Logistic_regression</a></p>

CC BY-SA 3.0
2018-03-08T13:46:57.650Z
2018-03-08T13:56:55.037Z
2018-03-08T13:56:55.037Z
hellmean
<p>I would model this data as a 3d-tensor (user,timestep,features) [organization depends on which DL Framework you use] for your input data. Also for the output data is a 3d-tensor (user,timestep,result) appropriate.</p>

<p>The next step would ne tp train a LSTM or CNN model to predict the result (what requires a lot of data)(Would be my first choice). If you have less data, try out logistic regression as supposed by the other answer.</p>

<p>Good luck!</p>

CC BY-SA 3.0
2018-04-09T16:25:01.163Z
2018-04-09T16:25:01.163Z
user3352632
<p>Google Analytics allows me to collect data about every web-session. For simplicity, let's assume for each user, we collect the number of pages and time spent on site for each session:</p>

<pre><code>user_id visit_id page_views time_spent result
1       1        10         100        0
1       2        31         510        0
1       3        1          10         1
</code></pre>

<p>How would you model this data? What I would like the <strong>ML algorithm to
    do</strong>: </p>

<ol>
<li>Extract as much information as possible</li>
<li>Have a flexible number of
inputs (e.g. the number of sessions can go to infinity)</li>
</ol>

<p><strong>What I can think of</strong>:</p>

<ol>
<li>Aggregate the data per user e.g. average page_views or total page_views and feed it into a general algorithm e.g. random forrest (but I lose information with aggregation)</li>
<li>Use LSTM and feed at most last 3 visits (will also lose information, but would this perform better than aggregation?)</li>
</ol>

<p><strong>Goal:</strong>
To build a predictive model to analyse all user sessions and make a prediction whether the person will convert or not.</p>

CC BY-SA 3.0
2018-03-07T22:48:19.307Z
Your goal is so vague and unclear.  The title and introduction is about Google Analytics data but you end with a goal about predicting whether or not a person will convert or not.  What is 'result'?  What does 'extract as much information as possible' mean?  Is your page a site to convert a person's ideology or religion?  If so what are the people doing on your site?  Are they filling out forms or taking surveys?  Is the data dynamic?
Brian O'Donnell
<machine-learning><deep-learning><reinforcement-learning>
ML model that is most suited to analyse Google Analytics data
George
# ML model that is most suited to analyse Google Analytics data

(Asked by: username_0 on 2018-03-06)

Google Analytics allows me to collect data about every web-session. For simplicity, let's assume for each user, we collect the number of pages and time spent on site for each session:
user_id visit_id page_views time_spent result
1       1        10         100        0
1       2        31         510        0
1       3        1          10         1

How would you model this data? What I would like the ML algorithm to
    do: 

Extract as much information as possible
Have a flexible number of
inputs (e.g. the number of sessions can go to infinity)

What I can think of:

Aggregate the data per user e.g. average page_views or total page_views and feed it into a general algorithm e.g. random forrest (but I lose information with aggregation)
Use LSTM and feed at most last 3 visits (will also lose information, but would this perform better than aggregation?)

Goal:
To build a predictive model to analyse all user sessions and make a prediction whether the person will convert or not.

**Tags:** machine-learning, deep-learning, reinforcement-learning

> **Comments:**
> **username_1**: Your goal is so vague and unclear.  The title and introduction is about Google Analytics data but you end with a goal about predicting whether or not a person will convert or not.  What is 'result'?  What does 'extract as much information as possible' mean?  Is your page a site to convert a person's ideology or religion?  If so what are the people doing on your site?  Are they filling out forms or taking surveys?  Is the data dynamic?  

---

## 2 answers

### Answer by username_2 on 2018-03-08. Score: 1

I understand that in your example you are interested in modelling the outcome of the 'result' column.

One easy model I would suggest is to model it using the Bernoulli distribution (<https://en.wikipedia.org/wiki/Bernoulli_distribution>) with the probability of success *p*.

Then you can model *p* with something like this

x = a + b \* log(page\_views) + c \* log(time\_spent) + e

p = exp(x) / (1+exp(x))

where *e* is normally distributed,
e ~ N(0, sigma^2)
(or simply centered around zero).

a, b and c are parameters that you can estimate.

I.e. the probability of success (conversion) is modeled as a sigma function of a certain variable that depends on page\_views and time\_spend. You can also add squares (and higher powers) of page\_views and time\_spend in the equation of *x* (i.e. upto a certain threshold page\_views can have a positive effect on conversion and then a negative one, then again a positive effect).

Also reading about logistic regression should put you on the right track: <https://en.wikipedia.org/wiki/Logistic_regression>


---

### Answer by username_3 on 2018-04-09. Score: 0

I would model this data as a 3d-tensor (user,timestep,features) [organization depends on which DL Framework you use] for your input data. Also for the output data is a 3d-tensor (user,timestep,result) appropriate.

The next step would ne tp train a LSTM or CNN model to predict the result (what requires a lot of data)(Would be my first choice). If you have less data, try out logistic regression as supposed by the other answer.

Good luck!


---

