I'm pretty new in this field and I need some advice for my first professional challenge.I'm trying to create a sort of client segmentation from a my company's sales log which has the peculiarity that the clients has a pretty long-term relationship and a periodic behavior.Based on when does he has bought (Ex: Twice a month, once a week, once every three months...) determine the frequency of purchase.I need to figure out the phase of this client, so I can know in what stage of his/her period is. I would like to know how much does it buys each time purchase amplitudeOnce i have his three elements I want to be able to use that info to detect when the client changes his behavior (specially when they have an missing period or they decrease the buying amplitude)I would like to get a really neat result, because i think that i will use it to a Markovian process.  So far I've tried astropy's lomb-scargle implementation but it seems that is too-precise and needs to many data points.
Periodic Pattern recognition In a Sales Log
machine learning;pattern recognition
These are the steps you need to follow.ModelYou need to pick a model that you think explains your data. It can be very simple (e.g. linear regression) or very complex (e.g. a four-layer neural network). You want to pick as simple a model as possible!Example: Assume sales follow $s(x) = a + b\sin(cx)$.TrainUsing one part of the data, you determine which parameters of the model fit your data best. The method of training depends on your model of choice.Example: You fit the parameterized sine against the first half of your data with least-squares and find $(a,b,c) = (3,77, 13)$ is best.ValidateInspect how well the model explains the rest of the data. You will have to decide in step 1 how you quantify quality here, and what your acceptance criteria are.Separately, if that makes sense in your domain, apply the model entirely different data sets that should follow the same model if your hypotheses are correct. Does it predict anything there? What does the answer say about your model and/or your assumptions?Example: Inspecting the squared error between $3 + 77\sin(13x)$ and the second half of the timeline data, you notice it is far too large.IterateUnless the predictive quality of your model is good, go back to step 1. Sometimes, more training data can be the answer, too; note how that weakens your result, though.