Skip to content

Commit

Permalink
fix typos, add reference
Browse files Browse the repository at this point in the history
  • Loading branch information
tms-bananaquit committed Aug 8, 2023
1 parent f403fa1 commit 50f0701
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
"source": [
"These examples show how to set up and apply the synthetic drift injectors in the injection module. The following examples use the Rainfall dataset, a real source of weather data. We use the first 1000 samples, where no drift has been injected. \n",
"\n",
"As true drift is rarely known, these synthetic drift injectors are useful for validating drift detector performance and calibrating detector parameters"
"As true drift is rarely known, these synthetic drift injectors are useful for validating drift detector performance and calibrating detector parameters.\n",
"\n",
"These implementations are based on their descriptions in [Souza 2020](https://arxiv.org/abs/2005.00113)."
]
},
{
Expand Down Expand Up @@ -63,7 +65,7 @@
"source": [
"### Feature Shift Injector\n",
"\n",
"This injector shifts the distribution of a single feature by a fixed value. The fixed value is a function of the mean to ensure the shift is relative to the feature valeus. An alpha parameter is added to ensure the distribution shifts for cases where the mean of the feature is 0."
"This injector shifts the distribution of a single feature by a fixed value. The fixed value is a function of the mean to ensure the shift is relative to the feature values. An alpha parameter is added to ensure the distribution shifts for cases where the mean of the feature is 0."
]
},
{
Expand Down Expand Up @@ -147,8 +149,8 @@
"plt.title('Feature Shift Injector', fontsize=22)\n",
"plt.xlabel('Time', fontsize=18)\n",
"plt.ylabel('Average Wind Speed', fontsize=18)\n",
"plt.xlim((0,12000))\n",
"plt.ylim((min,max)) # limit y to show more informative plot\n",
"plt.xlim((0, 12000))\n",
"plt.ylim((min, max)) # limit y to show more informative plot\n",
"plt.axvspan(drift_start, drift_end, alpha=0.3, label='Drift Injection Window')\n",
"# apply legend()\n",
"plt.legend([\"No Rain\" , \"Rain\",\"Rolling Average: Average Wind Speed\", \"Drift Injection Window\"],loc = 'upper right')"
Expand Down Expand Up @@ -251,13 +253,13 @@
"plt.title('Feature Swap Injector: Average Wind Speed', fontsize=22)\n",
"plt.xlabel('Time', fontsize=18)\n",
"plt.ylabel('Average Wind Speed', fontsize=18)\n",
"plt.xlim((0,12000))\n",
"plt.xlim((0, 12000))\n",
"plt.axvspan(drift_start, drift_end, alpha=0.3, label='Drift Injection Window')\n",
"# apply legend()\n",
"plt.legend([\"No Rain\" , \"Rain\",\"Rolling Average: Average Wind Speed\", \"Drift Injection Window\"],loc = 'upper right')\n",
"plt.legend([\"No Rain\" , \"Rain\",\"Rolling Average: Average Wind Speed\", \"Drift Injection Window\"], loc = 'upper right')\n",
"\n",
"# Plot for second column\n",
"plt.figure(2,figsize=(24,8))\n",
"plt.figure(2, figsize=(24,8))\n",
"plt.scatter(df0.index, df0[col2], c = palette[5]) \n",
"plt.scatter(df1.index, df1[col2], c = palette[14])\n",
"# Add rolling mean of column \n",
Expand All @@ -268,10 +270,10 @@
"plt.title('Feature Swap Injection: Visibility', fontsize=22)\n",
"plt.xlabel('Time', fontsize=18)\n",
"plt.ylabel('Visibility', fontsize=18)\n",
"plt.xlim((0,12000))\n",
"plt.xlim((0, 12000))\n",
"plt.axvspan(drift_start, drift_end, alpha=0.3, label='Drift Injection Window')\n",
"# apply legend()\n",
"plt.legend([\"No Rain\" , \"Rain\",\"Rolling Average: Average Wind Speed\", \"Drift Injection Window\"],loc = 'upper right')\n",
"plt.legend([\"No Rain\" , \"Rain\",\"Rolling Average: Average Wind Speed\", \"Drift Injection Window\"], loc = 'upper right')\n",
"plt.show()"
]
},
Expand Down Expand Up @@ -695,7 +697,7 @@
"source": [
"### Label Probability Injector\n",
"\n",
"This injector changes the probability of labels. Drift is injected by the user specifying labels and their desired probability. If any classes in the dataset are not specified with a desired probability, they are assigned uniform probability. "
"This injector changes the probability of labels. Drift is injected by the user specifying labels and their desired probability. If any remaining classes in the dataset are not specified, they are sampled with uniform probability. For example, if \"red\" and \"orange\" are assigned probabilities .2 and .3, \"yellow\", \"green\", \"blue\", \"indigo\" and \"violet\" are sampled with probability .1 (the remaining .5 divided among 5 unspecified classes)."
]
},
{
Expand Down Expand Up @@ -784,7 +786,7 @@
"source": [
"### Label Dirichlet Injector\n",
"\n",
"This injector changes the probability of labels according to a dirichelt distribution. Drift is injected by the user specifying labels and their desired Dirichlet ratio. All classes must be assigned a specified dirichlet ratio."
"This injector changes the probability of labels according to a Dirichlet distribution. Drift is injected by the user specifying labels and their desired Dirichlet ratio for each class. The classes are then sampled according to the specified Dirichlet distribution."
]
},
{
Expand Down

0 comments on commit 50f0701

Please sign in to comment.