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

Method setUpVecs

JSAT/src/jsat/classifiers/linear/SMIDAS.java:285–320  ·  view source on GitHub ↗
(DataSet dataSet)

Source from the content-addressed store, hash-verified

283 }
284
285 private Vec[] setUpVecs(DataSet dataSet)
286 {
287 obvMin = new double[dataSet.getNumNumericalVars()];
288 Arrays.fill(obvMin, Double.POSITIVE_INFINITY);
289 obvMax = new double[dataSet.getNumNumericalVars()];
290 Arrays.fill(obvMax, Double.NEGATIVE_INFINITY);
291 Vec[] x = new Vec[dataSet.getSampleSize()];
292 for(int i = 0; i < dataSet.getSampleSize(); i++)
293 {
294 x[i] = dataSet.getDataPoint(i).getNumericalValues();
295
296 for(IndexValue iv : x[i])
297 {
298 int j = iv.getIndex();
299 double v = iv.getValue();
300 obvMin[j] = Math.min(obvMin[j], v);
301 obvMax[j] = Math.max(obvMax[j], v);
302 }
303 }
304
305 if(x[0].isSparse())//Assume implicit min zeros from sparsity
306 for(int i = 0; i < obvMin.length; i++)
307 obvMin[i] = Math.min(obvMin[i], 0);
308
309 if(!reScale)
310 {
311 for(double min : obvMin)
312 if(min < -1)
313 throw new FailedToFitException("Values must be in the range [-1,1], " + min + " violation encountered");
314 for(double max : obvMax)
315 if(max > 1)
316 throw new FailedToFitException("Values must be in the range [-1,1], " + max + " violation encountered");
317
318 }
319 return x;
320 }
321
322}

Callers 2

trainCMethod · 0.95
trainMethod · 0.95

Calls 9

getNumNumericalVarsMethod · 0.80
getNumericalValuesMethod · 0.80
getSampleSizeMethod · 0.45
getDataPointMethod · 0.45
getIndexMethod · 0.45
getValueMethod · 0.45
minMethod · 0.45
maxMethod · 0.45
isSparseMethod · 0.45

Tested by

no test coverage detected