saaps.sapm
Class Anom002Model

java.lang.Object
  |
  +--saaps.sapm.Anom002Model

public class Anom002Model
extends java.lang.Object

The Anom002Model implements the neural network for nowcasting of satellite S001 anomalies on a daily basis. The input to the network are Kp summed over 24 hour periods extending over eights days.

The output from the model is a TimeSeries object that contain one data field which gives the probability in percent that an anomaly will occur.

The time stamp of the latest predicted value will always be the time of the last Kp value minus 24 hours. A prediction like

2001 04 01 18 00 00 1 80

has used Kp values over the period 2001-04-01 18:00 to 2001-04-02 18:00, and the predicted anomaly (1) with 80% probability is valid over the same time period.

Version:
1.1
Author:
Peter Wintoft

Field Summary
private  DataNorm dataNorm
           
private  int[] fields
           
private  double[] inMax
           
private  double[] inMin
           
private  Data inputData
           
private  TimeSeries inputTS
           
private  saaps.ann.mlff.Network network
           
private  double[] outMax
           
private  double[] outMin
           
private  Data outputData
           
private  TimeSeries outputTS
           
private  int[] times
           
private  TimeSeriesToDataMap tsMap
           
 
Constructor Summary
Anom002Model()
          Creates a new Anom002Model by loading the neural network weights.
 
Method Summary
private  void createNetwork()
          Create the network from the ASCII files.
private  void createOutputTimeSeries()
          When the neural network has been run the output is available as a saaps.ann.Data object.
 TimeSeries getOutput()
          Get the predicted output.
private  double getProbability(double y)
          Return the probability, in percent, that the prediction is an anomaly.
 void readTimeSeries()
          Read the data for the last 15 days.
 void readTimeSeries(java.util.Date d1, java.util.Date d2)
          Read data for the interval given by the two dates.
 void run()
          Run the model.
 java.lang.String toString()
          Get a description of the model.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

network

private saaps.ann.mlff.Network network

times

private int[] times

fields

private int[] fields

tsMap

private TimeSeriesToDataMap tsMap

inMin

private double[] inMin

inMax

private double[] inMax

outMin

private double[] outMin

outMax

private double[] outMax

dataNorm

private DataNorm dataNorm

inputTS

private TimeSeries inputTS

inputData

private Data inputData

outputData

private Data outputData

outputTS

private TimeSeries outputTS
Constructor Detail

Anom002Model

public Anom002Model()
Creates a new Anom002Model by loading the neural network weights.
Method Detail

createNetwork

private void createNetwork()
Create the network from the ASCII files. It is assumed that the network has two layers and that the transfer functions for both layers are tanh.

createOutputTimeSeries

private void createOutputTimeSeries()
When the neural network has been run the output is available as a saaps.ann.Data object. This method creates a TimeSeries object. The time field is obtained from the input time series and the data field is obtained from the output Data object. The data field contain the probability in percent that the predicted event is an anomaly.

The output from the network is a number in the interval -0.8 to 0.8. If the output is less than zero then we have a "no anomaly" event (0), else we have an "anomaly" event (1). The absolute value of the network output is used to determine the probability that the prediction is correct. The table below gives the probabilies for different outputs.
Output range No anomaly Anomaly
0 , 0.125 49% 52%
0.125 , 0.250 64% 61%
0.250 , 0.375 68% 70%
0.375 , 0.500 81% 82%
Above 0.500 89% 85%


getProbability

private double getProbability(double y)
Return the probability, in percent, that the prediction is an anomaly. The limits and probabilities are
y < -0.500 11%
-0.500 < y < -0.375 19%
-0.375 < y < -0.250 32%
-0.250 < y < -0.125 36%
-0.125 < y < 0.000 51%
0.000 < y < 0.125 52%
0.125 < y < 0.250 61%
0.250 < y < 0.375 70%
0.375 < y < 0.500 82%
0.500 < y 85%

readTimeSeries

public void readTimeSeries()
Read the data for the last 15 days. The network needs eights days of data for the time delay lines. This means that the network will make predictions for the last seven days.

readTimeSeries

public void readTimeSeries(java.util.Date d1,
                           java.util.Date d2)
Read data for the interval given by the two dates. At least eight days of data need to be read as the time delay line is eight days long. If n days are read then the model will produce n-8+1 days with predictions.
Parameters:
d1 - The start date
d2 - The end date

run

public void run()
Run the model.

getOutput

public TimeSeries getOutput()
Get the predicted output. The output will be a TimeSeries object with two data fields. The two data fields are: The output from the network is a number in the interval -0.8 to 0.8. If the output is less than zero then we have a "no anomaly" event (0), else we have an "anomaly" event (1). The absolute value of the network output is used to determine the probability that the prediction is correct. The table below gives the probabilies for different outputs.
Output range No anomaly Anomaly
0 , 0.125 49% 52%
0.125 , 0.250 64% 61%
0.250 , 0.375 68% 70%
0.375 , 0.500 81% 82%
Above 0.500 89% 85%
Returns:
The TimeSeries object.

toString

public java.lang.String toString()
Get a description of the model.
Overrides:
toString in class java.lang.Object
Returns:
A String with model information.