I am trying to achieve the following: given a sequence of phase space points $\left\{z_j\right\}=\left\{\left(q_j, p_j\right)\right\}$ for $j=1, \ldots, T$.

Goal: Project this sequence to a single phase space point $(\mathrm{Q}, \mathrm{P}) \in \mathrm{R}^{\wedge}(2 \mathrm{~N})$

Attempt: I want to verify that this can be done using the following method

Let's define a type 2 generating function such that we have:

$S\left(q_1, \ldots, q_T, P\right)=\sum_{j=1}^T \sum_{i=1}^N\left(w_j q_{j_i} P_i\right)+\sum_{i=1}^N b_i P_i+\frac{1}{2} \sum_{i=1}^N c_i P_i^2+d$

Here $w_j, b_i, c_i, d$ are some learnable parameters. Then the transforming equations are given by:

$\begin{gathered} Q_i=\frac{\partial S}{\partial P_i}=\sum_{j=1}^T w_j q_{j_i}+b_i+c_i P_i \\ p_{j_i}=\frac{\partial S}{\partial q_{j_i}}=w_j P_i \end{gathered}$

Is this a valid method to aggregate a sequence of phase space points?