I see basically two more or less simple ways to solve this problem: method of least squares and maximum likelihood:
Máxima Verossimilhança
One approach to your problem is to consider temperature as a random variable t
:
t ~ T(x, k)
That is to say, t
is random variable with distribution T
and parameters k
, being x
the time.
t
is what you want to predict, x
is the time that in case would tempo atual + 30 minutos
, and k
is a set of 1 or more unknown parameters of its distribution.
Looking at a sample of temperature values as a function of time, you can do a surface analysis of how the values behave and then choose their distribution function T
. There are many distributions, and the most common are uniform, Poisson, exponential, binomial, Bernoulli, Beta, Gamma. Each is best suited for a specific case (it would be an article describing each of them!).
Once you have chosen the distribution, you will need to define the distribution parameters (each distribution requires different parameters). To obtain these parameters the simplest method is the Maximum Likelihood (MVS), but Bayes could also be used.
I recommend using a statistical book to understand the method, or a library that already implements it ready (I don’t know of any to indicate).
Methods of Least Squares
Generally taught in the disciplines of Numerical Methods or Numerical Calculus in higher engineering courses, it consists of observing the behavior of values in a graph (in the case of temperature as a function of time) and visually identify a behavior to construct any function, which can be first degree, or second or any other (including not necessarily a polynomial).
Assuming a function of the first degree, we can say that:
t = aX + E
Being t
the observed value, X
the time of the observed value, a
unknown coefficient and E
the error. That is, we are approaching the value observed by a function of the first degree plus the error.
Our goal then is to find a
that minimises the sum of the quadratic errors in each sample value. That is:
t - aX = 0
Deriving and matching the 0
and by solving the formed system, one can find the value of a
. It is then necessary to derive the function again to identify whether a
is the minimum or maximum point.
I believe these are the simplest methods to solve the problem, but there must be others (I am not a mathematician). Of course, several libraries already implement them, but I don’t know them, since I only used these methods in university tests.
I hope I’ve helped!
Hello. Welcome. Instead of asking for tutorials, you could try explaining your problem in more detail and asking for help directly. You can start by exposing examples of your variable and annotated values. :)
– Luiz Vieira
In all cases, the scikit-Learn is a fantastic library for machine learning in Python.
– Luiz Vieira