Errors

Types of error response of a percectual control hierarchy.
The autoreload extension is already loaded. To reload it, use:
  %reload_ext autoreload
from pct.hierarchy import PCTHierarchy

source

BaseErrorType

 BaseErrorType (flip_error_response=False)

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


source

RootSumSquaredError

 RootSumSquaredError (flip_error_response=False)

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


source

RootMeanSquareError

 RootMeanSquareError (flip_error_response=False)

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


source

SummedError

 SummedError (flip_error_response=False)

Sum of all errors.


source

CurrentError

 CurrentError (flip_error_response=False)

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


source

SmoothError

 SmoothError (flip_error_response=False)

The exponential smoothed value of the error.


source

BaseErrorCollector

 BaseErrorCollector (limit, error_response, min=True)

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


source

TotalError

 TotalError (limit=None, error_response=None, min=None, **cargs)

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


source

TopError

 TopError (limit=None, error_response=None, min=None, **cargs)

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


source

InputsError

 InputsError (limit=None, error_response=None, min=None, **cargs)

A class to collect the values of the input values.


source

ReferencedInputsError

 ReferencedInputsError (limit=None, error_response=None, min=None,
                        **cargs)

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


source

RewardError

 RewardError (limit=None, error_response=None, min=None, **cargs)

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


source

ErrorResponseFactory

 ErrorResponseFactory ()

Initialize self. See help(type(self)) for accurate signature.


source

ErrorCollectorFactory

 ErrorCollectorFactory ()

Initialize self. See help(type(self)) for accurate signature.

rms = RootMeanSquareError()
for i in range(10):
    rms(i)
er = rms.get_error_response()
print(er)
assert er == 5.338539126015656
5.338539126015656
er = RootSumSquaredError()
te = TotalError(error_response=er, limit=250,min=True)   
te.add_error_data([1, 2])
print(te)
TotalError limit:250, limit_exceeded:False, : RootSumSquaredError error_response:2.23606797749979
hpct = PCTHierarchy(1,1,error_collector=te)
hpct.run(steps=5, verbose=True)
[0] 
level0col0 0.000 0.000 0.000 0.000 

Current score=2.23606797749979
[1] 
level0col0 0.000 0.000 0.000 0.000 

Current score=2.23606797749979
[2] 
level0col0 0.000 0.000 0.000 0.000 

Current score=2.23606797749979
[3] 
level0col0 0.000 0.000 0.000 0.000 

Current score=2.23606797749979
[4] 
level0col0 0.000 0.000 0.000 0.000 

Current score=2.23606797749979
<4 2.23606797749979>
0
err=te.error()
print(err)
2.23606797749979
et = ErrorResponseFactory.createErrorResponse('RootSumSquaredError')   
et(102)
print(et.get_error_response())

ec = ErrorCollectorFactory.createErrorCollector('TotalError')   
ec.set_limit(100)
ec.set_error_response(et)
print(ec.error())
102.0
102.0
ec = BaseErrorCollector.collector( 'RootMeanSquareError','InputsError', 10, flip_error_response=True, min=False)
ec.add_error_data([1])
print(ec.error())
print(ec)
-1.0
InputsError limit:10, limit_exceeded:False, : RootMeanSquareError error_response:-1.0
ec.reset()
print(ec)
InputsError limit:10, limit_exceeded:False, : RootMeanSquareError error_response:None