I'm building a tensorflow model to detect anomalies in an electricity smart meter data and I'm using UK-DALE Dataset. How can I introduce anomalies in the data so I can test the model?
1 Answer
$\begingroup$
$\endgroup$
Anomalies usually mean datapoints that are not making sense, so you can just insert random numbers between a given range.
Generating 10 random numbers:
import random
randomlist = []
for i in range(0,10):
n = random.randint(1,30)
randomlist.append(n)
print(randomlist)
Generate 10 random numbers as part of some timeseries:
np.random.seed(2019)
N = 10
rng = pd.date_range('2019-01-01', freq='MS', periods=N)
df = pd.DataFrame(np.random.rand(N, 1), columns= ['readings'], index=rng)