code: @Override
      protected void _fit(Dataframe trainingData) {
          ModelParameters modelParameters = knowledgeBase.getModelParameters();
          
          //calculate similarity matrix
          Map<List<Object>, Double> similarities = modelParameters.getSimilarities();
          for(Record r1 : trainingData) {
              Object y1 = r1.getY();
              for(Record r2: trainingData) {
                  Object y2 = r2.getY();
                  
                  List<Object> tkp = Arrays.asList(y1, y2);
                  if(similarities.containsKey(tkp)) {
                      continue;
                  }
                  
                  double similarity = calculateSimilarity(r1, r2);
                  
                  similarities.put(tkp, similarity);
                  similarities.put(Arrays.asList(y2, y1), similarity); //add also for the reverse key because similarity is symmetric
              }
          }
      }
docs: {@inheritDoc}