--- title: Errors keywords: fastai sidebar: home_sidebar summary: "Types of error response of a percectual control hierarchy." description: "Types of error response of a percectual control hierarchy." nb_path: "nbs/07_errors.ipynb" ---
{% raw %}
{% endraw %} {% raw %}
%load_ext autoreload
%autoreload 2
{% endraw %} {% raw %}
#import sys
#sys.path.append("..")
{% endraw %} {% raw %}
{% endraw %} {% raw %}
from pct.hierarchy import PCTHierarchy
{% endraw %} {% raw %}

class BaseErrorType[source]

BaseErrorType() :: ABC

Base class of a type error response. This class is not used direclty by developers, but defines the interface common to all.

{% endraw %} {% raw %}
{% endraw %} {% raw %}

class RootSumSquaredError[source]

RootSumSquaredError() :: BaseErrorType

The square root of the sum of the square of the errors.

{% endraw %} {% raw %}
{% endraw %} {% raw %}

class RootMeanSquareError[source]

RootMeanSquareError() :: BaseErrorType

The square root of the sum of the square of the errors.

{% endraw %} {% raw %}
{% endraw %} {% raw %}

class CurrentError[source]

CurrentError() :: BaseErrorType

The current error, rather than a function of the historical values.

{% endraw %} {% raw %}
{% endraw %} {% raw %}

class SmoothError[source]

SmoothError() :: BaseErrorType

The exponential smoothed value of the error.

{% endraw %} {% raw %}
{% endraw %} {% raw %}

class BaseErrorCollector[source]

BaseErrorCollector(limit, error_response) :: ABC

Base class of an error collector. This class is not used direclty by developers, but defines the interface common to all.

{% endraw %} {% raw %}
{% endraw %} {% raw %}

class TotalError[source]

TotalError(limit=1000, error_response=None, **cargs) :: BaseErrorCollector

A class to collect all the errors of the control system run.

{% endraw %} {% raw %}
{% endraw %} {% raw %}

class TopError[source]

TopError(limit=1000, error_response=None, **cargs) :: BaseErrorCollector

A class to collect all the errors of the top-level nodes.

{% endraw %} {% raw %}
{% endraw %} {% raw %}

class InputsError[source]

InputsError(limit=1000, error_response=None, **cargs) :: BaseErrorCollector

A class to collect the values of the input values.

{% endraw %} {% raw %}
{% endraw %} {% raw %}

class ReferencedInputsError[source]

ReferencedInputsError(limit=1000, error_response=None, **cargs) :: BaseErrorCollector

A class to collect the values of the input values subtracted from reference values.

{% endraw %} {% raw %}
{% endraw %} {% raw %}

class RewardError[source]

RewardError(limit=1000, error_response=None, **cargs) :: BaseErrorCollector

A class that collects the reward value of the control system run.

{% endraw %} {% raw %}
{% endraw %} {% raw %}

class ErrorFactory[source]

ErrorFactory()

{% endraw %} {% raw %}
{% endraw %} {% raw %}
rms = RootMeanSquareError()
for i in range(10):
    rms(i)
er = rms.get_error_response()
print(er)
assert er == 5.338539126015656
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-18-05ea68d12deb> in <module>
----> 1 rms = RootMeanSquareError()
      2 for i in range(10):
      3     rms(i)
      4 er = rms.get_error_response()
      5 print(er)

TypeError: Can't instantiate abstract class RootMeanSquareError with abstract methods reset
{% endraw %} {% raw %}
er = RootSumSquaredError()
te = TotalError(error_response=er)   
print(te)
{% endraw %} {% raw %}
hpct = PCTHierarchy(1,1,error_collector=te)
hpct.run(steps=5, verbose=True)
{% endraw %} {% raw %}
err=te.error()
print(err)
{% endraw %} {% raw %}
et = ErrorFactory.createError('RootSumSquaredError')   
et(102)
print(et.get_error_response())

ec = ErrorFactory.createError('TotalError')   
ec.set_limit(100)
ec.set_error_response(et)
print(ec.error())
{% endraw %} {% raw %}
ec = BaseErrorCollector.collector( 'RootMeanSquareError','InputsError', 10)
{% endraw %} {% raw %}
ec.reset()
{% endraw %}