You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"#### This tutorial illustrates the use of SIF algorithm, a comprehensive single-valued metric, to measure outlier impacts on future predictions. It provides a quantitative measure regarding the outlier impacts, which can be used in a variety of scenarios, such as the evaluation of outlier detection methods, the creation of more harmful outliers, etc. This is a demonstration for AAAI-2021 paper [Outlier Impact Characterization for Time Series Data](https://ojs.aaai.org/index.php/AAAI/article/view/17379).\n",
8
+
"#### SIF algorithm mainly tackles the challenge of outlier interpretation in time series data via [contamination processes](https://www.jstor.org/stable/pdf/3035535.pdf). It assumes that the observed input time series is obtained from separate processes for both the core input and the recurring outliers, i.e., the core process and the contaminating process. At each time stamp, with a certain (small) probability, the observed value of the contaminated process comes from the contaminating process, which corresponds to the outliers. The SIF algorithm focuses on the generic patchy outliers where the outlying patterns can be present over consecutive time stamps, and aims to study the impact of the contaminating process on both parameter estimation and future value prediction.\n",
9
+
"#### The tutorial is organized as folows:\n",
10
+
"#### 1. [Train a Model Inherited from SIFExplainer](https://github.com/Leo02016/AIX360/blob/dc0efab88b90f225427347b080897a3e19792403/examples/sif/SIF.ipynb#L12)\n",
11
+
"#### 2. [Initialize the Required Parameters and Synthesize the Dataset](https://github.com/Leo02016/AIX360/blob/dc0efab88b90f225427347b080897a3e19792403/examples/sif/SIF.ipynb#L61)\n",
12
+
"#### 3. [Interpret the Model by SIF Value](https://github.com/Leo02016/AIX360/blob/dc0efab88b90f225427347b080897a3e19792403/examples/sif/SIF.ipynb#L139)"
16
13
],
17
14
"metadata": {
18
-
"collapsed": false,
19
-
"pycharm": {
20
-
"name": "#%%\n",
21
-
"is_executing": false
22
-
}
15
+
"collapsed": false
23
16
}
24
17
},
25
18
{
26
19
"cell_type": "markdown",
27
20
"source": [
28
-
"#### model below can be changed to AllLSTM or AllRNN model defined in SIF_NN.py"
21
+
"## 1. Train a Model Inherited from SIFExplainer\n",
22
+
"#### First, we define a function that trains a AR2 model inherited from SIFExplainer and this model (AR2) is what we are going to interpret. Notice that the AR2 model below can be changed to AllLSTM or AllRNN model defined in SIF_NN.py file. AllRNN, AllLSTM, AllAR are also inherited from SIFExplainer Model defined in SIF.py file."
"#### In default, we use the fast mode to accelerate the computation.\n"
99
+
"## 2. Initialize the Required Parameters and Synthesize the Dataset\n",
100
+
"#### In the second step, we initialize the parameters for SIFExplainer. \n",
101
+
"#### By default, we use the fast mode to accelerate the computation. In the fast mode, we load the pre-trained AR2 model and dataset to skip training stage. If the user plans to retrain the AR2 model, please set the parameter [fast_mode](https://github.com/Leo02016/AIX360/blob/dc0efab88b90f225427347b080897a3e19792403/examples/sif/SIF.ipynb#L65) to be False. Then, the algorithm will generate a new synthetic dataset and train AR2 model from scratch.\n"
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Desktop\\SIF\\aix360\\algorithms\\sif\\SIF_NN.py:18: The name tf.random_normal is deprecated. Please use tf.random.normal instead.\n\n",
164
-
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Desktop\\SIF\\aix360\\algorithms\\sif\\SIF.py:28: The name tf.set_random_seed is deprecated. Please use tf.compat.v1.set_random_seed instead.\n\n",
165
-
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Desktop\\SIF\\aix360\\algorithms\\sif\\SIF_NN.py:38: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.\n\n",
166
-
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Desktop\\SIF\\aix360\\algorithms\\sif\\SIF.py:634: The name tf.squared_difference is deprecated. Please use tf.math.squared_difference instead.\n\n",
167
-
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Desktop\\SIF\\aix360\\algorithms\\sif\\SIF.py:639: The name tf.is_nan is deprecated. Please use tf.math.is_nan instead.\n\n",
176
+
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Documents\\GitHub\\AIX360\\aix360\\algorithms\\sif\\SIF_NN.py:18: The name tf.random_normal is deprecated. Please use tf.random.normal instead.\n\n",
177
+
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Documents\\GitHub\\AIX360\\aix360\\algorithms\\sif\\SIF.py:29: The name tf.set_random_seed is deprecated. Please use tf.compat.v1.set_random_seed instead.\n\n",
178
+
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Documents\\GitHub\\AIX360\\aix360\\algorithms\\sif\\SIF_NN.py:38: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.\n\n",
179
+
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Documents\\GitHub\\AIX360\\aix360\\algorithms\\sif\\SIF.py:649: The name tf.squared_difference is deprecated. Please use tf.math.squared_difference instead.\n\n",
180
+
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Documents\\GitHub\\AIX360\\aix360\\algorithms\\sif\\SIF.py:654: The name tf.is_nan is deprecated. Please use tf.math.is_nan instead.\n\n",
168
181
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Anaconda3\\envs\\tf_115\\lib\\site-packages\\tensorflow_core\\python\\ops\\array_ops.py:1475: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.\nInstructions for updating:\nUse tf.where in 2.0, which has the same broadcast rule as np.where\n",
169
-
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Desktop\\SIF\\aix360\\algorithms\\sif\\SIF.py:642: The name tf.add_to_collection is deprecated. Please use tf.compat.v1.add_to_collection instead.\n\n",
170
-
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Desktop\\SIF\\aix360\\algorithms\\sif\\SIF.py:644: The name tf.get_collection is deprecated. Please use tf.compat.v1.get_collection instead.\n\n",
171
-
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Desktop\\SIF\\aix360\\algorithms\\sif\\SIF.py:95: The name tf.assign is deprecated. Please use tf.compat.v1.assign instead.\n\n",
172
-
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Desktop\\SIF\\aix360\\algorithms\\sif\\SIF.py:599: The name tf.train.AdamOptimizer is deprecated. Please use tf.compat.v1.train.AdamOptimizer instead.\n\n",
173
-
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Desktop\\SIF\\aix360\\algorithms\\sif\\SIF.py:610: The name tf.train.GradientDescentOptimizer is deprecated. Please use tf.compat.v1.train.GradientDescentOptimizer instead.\n\n",
174
-
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Desktop\\SIF\\aix360\\algorithms\\sif\\SIF.py:103: The name tf.train.Saver is deprecated. Please use tf.compat.v1.train.Saver instead.\n\n",
175
-
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Desktop\\SIF\\aix360\\algorithms\\sif\\SIF.py:160: The name tf.global_variables_initializer is deprecated. Please use tf.compat.v1.global_variables_initializer instead.\n\n",
182
+
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Documents\\GitHub\\AIX360\\aix360\\algorithms\\sif\\SIF.py:657: The name tf.add_to_collection is deprecated. Please use tf.compat.v1.add_to_collection instead.\n\n",
183
+
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Documents\\GitHub\\AIX360\\aix360\\algorithms\\sif\\SIF.py:659: The name tf.get_collection is deprecated. Please use tf.compat.v1.get_collection instead.\n\n",
184
+
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Documents\\GitHub\\AIX360\\aix360\\algorithms\\sif\\SIF.py:96: The name tf.assign is deprecated. Please use tf.compat.v1.assign instead.\n\n",
185
+
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Documents\\GitHub\\AIX360\\aix360\\algorithms\\sif\\SIF.py:614: The name tf.train.AdamOptimizer is deprecated. Please use tf.compat.v1.train.AdamOptimizer instead.\n\n",
186
+
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Documents\\GitHub\\AIX360\\aix360\\algorithms\\sif\\SIF.py:625: The name tf.train.GradientDescentOptimizer is deprecated. Please use tf.compat.v1.train.GradientDescentOptimizer instead.\n\n",
187
+
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Documents\\GitHub\\AIX360\\aix360\\algorithms\\sif\\SIF.py:104: The name tf.train.Saver is deprecated. Please use tf.compat.v1.train.Saver instead.\n\n",
188
+
"WARNING:tensorflow:From C:\\Users\\lecheng4\\Documents\\GitHub\\AIX360\\aix360\\algorithms\\sif\\SIF.py:161: The name tf.global_variables_initializer is deprecated. Please use tf.compat.v1.global_variables_initializer instead.\n\n",
176
189
"Total number of parameters: 2\nLoading pre-trained model......\nINFO:tensorflow:Restoring parameters from ../../aix360/models/sif/ar2\n"
"#### In the last step, we compute SIF value. Notice that the model is inherited from SIFExplainer and the user could simply call model.explain_instance() function to get the SIF value."
273
287
],
274
288
"metadata": {
275
289
"collapsed": false
276
290
}
277
291
},
278
292
{
279
293
"cell_type": "code",
280
-
"execution_count": 19,
294
+
"execution_count": 8,
281
295
"outputs": [
282
296
{
283
297
"name": "stdout",
284
298
"text": [
285
-
"Regression R-squared: 0.270422\nRegression R-squared: 0.149079\n54.085068464279175 s to compute if_v\n0.0359044075012207 s to compute patchy pred gamma\n0.06781840324401855 s to compute psi_y\nSIF = 166.51340947947648\n"
299
+
"Regression R-squared: 0.179848\n162.92198777198792 s to compute if_v\n0.03913569450378418 s to compute patchy pred gamma\n0.0718080997467041 s to compute psi_y\nSIF = -119.54141353277345\n"
0 commit comments