Training anomaly detection fails

I have uploaded a CSV data. However, I am trying to train my model its failing with the following error:

Creating job… OK (ID: 913378)

Copying features from processing blocks…
Copying features from DSP block…
Copying features from DSP block OK
Copying features from processing blocks OK

Training model
Job started
scaler scale [1.48110006e+00 3.74299998e+00 4.30999763e-01 1.32083512e+00
1.46117330e+00 4.06674475e-01 4.81175189e-02 9.66699954e-01
4.60000006e-01 1.49700000e+00 1.03141760e+00 3.91388033e-01
7.34668212e-02 2.61071917e-02 3.72599968e-01 4.37000006e-01
2.52000095e-01 2.99538970e-01 3.17583681e-02 3.47584045e-02
1.61064271e-02 1.92142025e+01 8.64000028e+00 2.93630004e+01
2.06302188e+01 8.04713146e+00 5.26187565e-02 3.10854912e-02
6.25231773e+01 7.33550035e+01 4.22860106e+01 5.02607119e+01
5.33549495e+00 3.49020810e-02 1.62054302e-02 1.73888608e+02
8.27645026e+01 2.69297480e+02 1.85524278e+02 7.03899296e+01
7.35321631e-02 2.60436532e-02] mean [ 1.77010002e+01 1.50070000e+01 1.92290001e+01 1.78641510e+01
1.79399991e+00 -4.44621112e-01 -1.29245222e+00 2.12329996e+00
4.60000008e-01 3.49099994e+00 2.45078903e+00 1.21412256e+00
-4.16367695e-01 -1.52677643e+00 2.73150003e+00 4.37000006e-01
4.75999999e+00 3.21877682e+00 1.68799180e+00 -3.49510863e-01
-1.53089923e+00 4.05012016e+01 8.64000034e+00 6.64699993e+01
4.67936392e+01 2.32585821e+01 -4.14827749e-01 -1.53487587e+00
4.58315872e+02 7.33550034e+01 7.98734985e+02 5.40069611e+02
2.83214127e+02 -3.49353179e-01 -1.53089333e+00 3.81903503e+02
8.27645035e+01 6.27882492e+02 4.40799637e+02 2.18360558e+02
-4.16290730e-01 -1.52680314e+00] var [2.19365740e+00 1.40100489e+01 1.85760796e-01 1.74460542e+00
2.13502741e+00 1.65384129e-01 2.31529563e-03 9.34508801e-01
2.11600006e-01 2.24100900e+00 1.06382227e+00 1.53184593e-01
5.39737381e-03 6.81585458e-04 1.38830736e-01 1.90969005e-01
6.35040477e-02 8.97235945e-02 1.00859394e-03 1.20814668e-03
2.59416993e-04 3.69185577e+02 7.46496048e+01 8.62185791e+02
4.25605927e+02 6.47563248e+01 2.76873354e-03 9.66307765e-04
3.90914771e+03 5.38095654e+03 1.78810669e+03 2.52613916e+03
2.84675064e+01 1.21815526e-03 2.62615969e-04 3.02372480e+04
6.84996289e+03 7.25211328e+04 3.44192578e+04 4.95474219e+03
5.40697901e-03 6.78271870e-04]
Traceback (most recent call last):
File “/home/train.py”, line 104, in
trained_clusters = calculate_cluster_and_radius(X_train)
File “/home/train.py”, line 70, in calculate_cluster_and_radius
kmeans.fit(X_train)
File “/usr/local/lib/python3.6/dist-packages/sklearn/cluster/k_means_.py”, line 969, in fit
return_n_iter=True)
File “/usr/local/lib/python3.6/dist-packages/sklearn/cluster/k_means_.py”, line 313, in k_means
_num_samples(X), n_clusters))
ValueError: n_samples=1 should be >= n_clusters=32

Application exited with code 1 (Error)

Job failed (see above)

Hello @Richo,

I see in your project that you have only 2 data samples of one second each. However, you set the number of clusters to 32.

Can you try to add more data samples? The number of clusters should be inferior to the number of data samples: ValueError: n_samples=1 should be >= n_clusters=32

Regards,

Louis

Thank you Louis.

I have changed the number of clusters to 1.

1 Like