Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@model_tmin_tmax
def many(self, tmin=None, tmax=None, stats=None):
"""This method returns the values for a provided list of statistics.
Parameters
----------
tmin
tmax
stats: list
list of statistics that need to be calculated.
Returns
-------
"""
if not stats:
stats = ['evp', 'rmse', 'rmsi', 'rsq']
@model_tmin_tmax
def plot(self, tmin=None, tmax=None, oseries=True, simulation=True,
show=True, **kwargs):
"""Make a plot of the observed and simulated series.
Parameters
----------
oseries: Boolean
True to plot the observed time series.
simulation: Boolean
True to plot the simulated time series.
Returns
-------
fig: matplotlib.figure
MPL figure with the simulated and optionally the observed time
series.
@model_tmin_tmax
def rmse(self, tmin=None, tmax=None):
"""Root mean squared error of the residuals.
Notes
-----
.. math:: rmse = sqrt(sum(residuals**2) / N)
where N is the number of residuals.
"""
res = self.ml.residuals(tmin=tmin, tmax=tmax).values
N = res.size
return np.sqrt((res ** 2).sum() / N)
@model_tmin_tmax
def summary(self, tmin=None, tmax=None, stats='basic'):
"""Prints a summary table of the model statistics. The set of
statistics that are printed are stats by a dictionary of the desired
statistics.
Parameters
----------
tmin
tmax
stats : str or dict
dictionary of the desired statistics or a string with one of the
predefined sets. Supported options are: 'basic', 'all', and 'dutch'
Returns
-------
stats : Pandas.DataFrame
@model_tmin_tmax
def results(self, tmin=None, tmax=None, show=True):
"""Plot different results in one window to get a quick overview.
Parameters
----------
tmin/tmax: str
start and end time for plotting
Returns
-------
"""
fig = self._get_figure()
#Number of row to make the figure with
@model_tmin_tmax
def rmsn(self, tmin=None, tmax=None):
"""Root mean squared error of the noise.
Returns
-------
float or nan
Return a float if noisemodel is present, nan if not.
Notes
-----
.. math:: rmsi = \\sqrt{\\frac{\\sum(noise^2)}{N}}
where N is the number of noise.
"""
if not self.ml.noisemodel:
@model_tmin_tmax
def avg_dev(self, tmin=None, tmax=None):
"""Average deviation of the residuals.
Notes
-----
.. math:: avg_dev = sum(E) / N
Where N is the number of the residuals.
"""
res = self.ml.residuals(tmin=tmin, tmax=tmax).values
return res.mean()
@model_tmin_tmax
def rmsi(self, tmin=None, tmax=None):
"""Root mean squared error of the noise.
Notes
-----
.. math:: rmsi = sqrt(sum(noise**2) / N)
where N is the number of noise.
"""
res = self.ml.noise(tmin=tmin, tmax=tmax).values
N = res.size
return np.sqrt((res ** 2).sum() / N)
@model_tmin_tmax
def bic(self, tmin=None, tmax=None):
"""Bayesian Information Criterium. The noise is used if a noisemodel is
present, otherwise the residuals are used.
Notes
-----
The Bayesian Information Criterium is calculated as follows:
.. math:: BIC = -2 log(L) + nparam * log(N)
Where nparam is the number of free parameters
"""
if self.ml.noisemodel:
noise = self.ml.noise(tmin=tmin, tmax=tmax).values
else:
@model_tmin_tmax
def all(self, tmin=None, tmax=None):
"""Returns a dictionary with all the statistics.
Parameters
----------
tmin: str
tmax: str
Returns
-------
stats: pd.DataFrame
Dataframe with all possible statistics
"""
stats = DataFrame(columns=['Value'])
for k in self.ops.keys():