1. A computer implemented method to detect an anomaly based on measurement data, the method comprising the steps of: inputting measurement data having an anomalous or normal label and measurement data having no label as samples; determining a similarity matrix indicating the relationship between the samples based on the samples; defining a penalty based on the similarity matrix and calculating parameters in accordance with an updating equation having a term reducing the penalty; and calculating a degree of anomaly based on the calculated parameters.