Question: I am really stumped at the moment about how to solve a particular problem. I have many time series like this:

[![enter image description here](https://i.stack.imgur.com/xTjYc.png)](https://i.stack.imgur.com/xTjYc.png)

This represents the number of hours a person spends on a website each day throughout the year. Any days where they are not seen to be using the website have zero values, rather than missing values.

What I really want to do is to calculate a metric telling me to what extent there is a consistent "1 hour per day, once per week" pattern, or, say a "10 minutes a day 6 times per week" pattern and I have written some code that produces this pattern. I don't have any background really in machine learning or deep learning, but I have looked into some techniques from spectral analysis and time series. I also found a technique called "Dynamic Time Warping" which I could in theory use to find out how much of a cost there is in mapping this time series onto the "ideal" one (representing the usage patterns I just mentioned).

I tried plotting the periodogram and correlogram, but there seems to be very little correlation indicating periodicity of any kind:

[![enter image description here](https://i.stack.imgur.com/dwt2H.png)](https://i.stack.imgur.com/dwt2H.png)

Can anyone shed some light onto how I could use certain techniques to get the information I need, or any introductory texts on periodicity detection or data mining for those who have never really used it before?

Answer: 
To construct sentence embeddings Spacy just averages the word embeddings. I do not have access to Spacy right now, else would have give a demonstration but you can try:

```
spacy_nlp('hello I').vector == (spacy_nlp('hello').vector + spacy_nlp('I').vector) / 2

```

If this also gives `False`, it will be because the float values might not be exactly equal after the computation. So, just print them out separately and you will see that they are really close.
The answer is: **average embeddings of the parsed tokens**.
Mind that the tokenizer may be customized/different from what you expect.

Here you find a full example

```
import spacy
import numpy as np

nlp = spacy.load("en_core_web_md")
txt= 'ChatGPT could automatically compose comments submitted in regulatory processes. It could write letters to the editor for publication in local newspapers. It could comment on news articles, blog entries and social media posts millions of times every day." https://t.co/rXL8WgJ4hV'

vec1 = nlp(txt).vector
vec2 = np.array([t.vector for t in nlp(txt)]).mean(0)

np.testing.assert_almost_equal(vec1,vec2)

```