docs: public static void trainIfNeeded(DistanceMetric dm, DataSet dataset, boolean parallel)
      {
          if(!(dm instanceof TrainableDistanceMetric))
              return;
          TrainableDistanceMetric tdm = (TrainableDistanceMetric) dm;
          if(!tdm.needsTraining())
              return;
          if(dataset instanceof RegressionDataSet)
              tdm.train((RegressionDataSet) dataset, parallel);
          else if(dataset instanceof ClassificationDataSet)
              tdm.train((ClassificationDataSet) dataset, parallel);
          else
              tdm.train(dataset, parallel);
      }