public void train(List<Sample> samples) {
   BLEBeacon.setBLEBeaconIdsToSamples(bleBeacons, samples);
   List<List<Sample>> samplesList = Sample.samplesToConsecutiveSamplesList(samples);
   if (doHyperParameterOptimize) {
     doHyperParameterOptimize = false;
     trainWithHyperParameters(samplesList);
   }
   List<Sample> samplesAvaragedTrain = Sample.meanTrimList(samplesList, minRssi);
   this.trainByAveragedSamples(samplesAvaragedTrain);
 }
  protected void trainByAveragedSamples(List<Sample> samples) {
    int nBeacons = bleBeacons.size();
    BLEBeacon.setBLEBeaconIdsToSamples(bleBeacons, samples);
    setupGPLDPL();
    this.samples = samples;
    double[][] X = ModelAdaptUtils.samplesToLocationsMat(samples);
    double[][] Y = ModelAdaptUtils.samplesToBeaconsListMat(samples, minRssi, nBeacons);
    double[][] bLocs = ModelAdaptUtils.BLEBeaconsToMat(bleBeacons, nBeacons);
    gpLDPL.setSourceLocs(bLocs);

    int[] actBecList = new int[nBeacons];
    for (int i = 0; i < nBeacons; i++) actBecList[i] = i;
    gpLDPL.setActiveBeaconList(actBecList);

    gpLDPL.fit(X, Y);
  }