MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / PowVariogram

Class PowVariogram

JSAT/src/jsat/regression/OrdinaryKriging.java:327–379  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

325 }
326
327 public static class PowVariogram implements Variogram
328 {
329 private double alpha;
330 private double beta;
331
332 public PowVariogram()
333 {
334 this(1.5);
335 }
336
337 public PowVariogram(double beta)
338 {
339 this.beta = beta;
340 }
341
342 @Override
343 public void train(RegressionDataSet dataSet, double nugget)
344 {
345 int npt=dataSet.getSampleSize();
346 double num=0,denom=0, nugSqrd = nugget*nugget;
347
348 for (int i = 0; i < npt; i++)
349 {
350 Vec xi = dataSet.getDataPoint(i).getNumericalValues();
351 double yi = dataSet.getTargetValue(i);
352 for (int j = i + 1; j < npt; j++)
353 {
354 Vec xj = dataSet.getDataPoint(j).getNumericalValues();
355 double yj = dataSet.getTargetValue(j);
356 double rb = pow(xi.pNormDist(2, xj), beta);
357
358 num += rb* (0.5* pow(yi-yj, 2)-nugSqrd);
359 denom += rb*rb;
360 }
361 }
362 alpha = num / denom;
363 }
364
365 @Override
366 public double val(double r)
367 {
368 return alpha*pow(r, beta);
369 }
370
371 @Override
372 public Variogram clone()
373 {
374 PowVariogram clone = new PowVariogram(beta);
375 clone.alpha = this.alpha;
376
377 return clone;
378 }
379 }
380
381}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected