public static INDArray min(INDArray compute, int dimension) { return compute.min(dimension); }
INDArray minAlong0 = originalArray.min(0); INDArray maxAlong0 = originalArray.max(0); INDArray sumAlong0 = originalArray.sum(0);
public static INDArray min(INDArray compute) { return compute.min(Integer.MAX_VALUE); }
/** * @param mean row vector of means * @param std row vector of standard deviations */ public DistributionStats(@NonNull INDArray mean, @NonNull INDArray std) { Transforms.max(std, Nd4j.EPS_THRESHOLD, false); if (std.min(1) == Nd4j.scalar(Nd4j.EPS_THRESHOLD)) { logger.info("API_INFO: Std deviation found to be zero. Transform will round up to epsilon to avoid nans."); } this.mean = mean; this.std = std; }
public void fit(DataSet dataSet) { mean = dataSet.getFeatureMatrix().mean(0); std = dataSet.getFeatureMatrix().std(0); std.addi(Nd4j.scalar(Nd4j.EPS_THRESHOLD)); if (std.min(1) == Nd4j.scalar(Nd4j.EPS_THRESHOLD)) logger.info("API_INFO: Std deviation found to be zero. Transform will round upto epsilon to avoid nans."); }
INDArray batchMin = data.min(0); INDArray batchMax = data.max(0); if (!Arrays.equals(batchMin.shape(), batchMax.shape()))
/** * Scales the ndarray columns * to the given min/max values * * @param min the minimum number * @param max the max number */ public static void scaleMinMax(double min, double max, INDArray toScale) { //X_std = (X - X.min(axis=0)) / (X.max(axis=0) - X.min(axis=0)) X_scaled = X_std * (max - min) + min INDArray min2 = toScale.min(0); INDArray max2 = toScale.max(0); INDArray std = toScale.subRowVector(min2).diviRowVector(max2.sub(min2)); INDArray scaled = std.mul(max - min).addi(min); toScale.assign(scaled); }
std = Transforms.sqrt(std); std.addi(Nd4j.scalar(Nd4j.EPS_THRESHOLD)); if (std.min(1) == Nd4j.scalar(Nd4j.EPS_THRESHOLD)) logger.info("API_INFO: Std deviation found to be zero. Transform will round upto epsilon to avoid nans."); iterator.reset();
public static INDArray min(INDArray compute, int dimension) { return compute.min(dimension); }
public static INDArray min(INDArray compute) { return compute.min(Integer.MAX_VALUE); }
/** * @param mean row vector of means * @param std row vector of standard deviations */ public DistributionStats(@NonNull INDArray mean, @NonNull INDArray std) { Transforms.max(std, Nd4j.EPS_THRESHOLD, false); if (std.min(1) == Nd4j.scalar(Nd4j.EPS_THRESHOLD)) { logger.info("API_INFO: Std deviation found to be zero. Transform will round up to epsilon to avoid nans."); } this.mean = mean; this.std = std; }
/**Plot the training data. Assume 2d input, classification output * @param features Training data features * @param labels Training data labels (one-hot representation) * @param backgroundIn sets of x,y points in input space, plotted in the background * @param backgroundOut results of network evaluation at points in x,y points in space * @param nDivisions Number of points (per axis, for the backgroundIn/backgroundOut arrays) */ public static void plotTrainingData(INDArray features, INDArray labels, INDArray backgroundIn, INDArray backgroundOut, int nDivisions){ double[] mins = backgroundIn.min(0).data().asDouble(); double[] maxs = backgroundIn.max(0).data().asDouble(); XYZDataset backgroundData = createBackgroundData(backgroundIn, backgroundOut); JPanel panel = new ChartPanel(createChart(backgroundData, mins, maxs, nDivisions, createDataSetTrain(features, labels))); JFrame f = new JFrame(); f.add(panel); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.pack(); f.setTitle("Training Data"); f.setVisible(true); }
/**Plot the training data. Assume 2d input, classification output * @param features Training data features * @param labels Training data labels (one-hot representation) * @param predicted Network predictions, for the test points * @param backgroundIn sets of x,y points in input space, plotted in the background * @param backgroundOut results of network evaluation at points in x,y points in space * @param nDivisions Number of points (per axis, for the backgroundIn/backgroundOut arrays) */ public static void plotTestData(INDArray features, INDArray labels, INDArray predicted, INDArray backgroundIn, INDArray backgroundOut, int nDivisions){ double[] mins = backgroundIn.min(0).data().asDouble(); double[] maxs = backgroundIn.max(0).data().asDouble(); XYZDataset backgroundData = createBackgroundData(backgroundIn, backgroundOut); JPanel panel = new ChartPanel(createChart(backgroundData, mins, maxs, nDivisions, createDataSetTest(features, labels, predicted))); JFrame f = new JFrame(); f.add(panel); f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); f.pack(); f.setTitle("Test Data"); f.setVisible(true); }
public static SummaryStatistics summaryStats(INDArray d) { return new SummaryStatistics(d.mean(Integer.MAX_VALUE), d.sum(Integer.MAX_VALUE), d.min(Integer.MAX_VALUE), d.max(Integer.MAX_VALUE)); }
public static String summaryStatsString(INDArray d) { return new SummaryStatistics(d.mean(Integer.MAX_VALUE), d.sum(Integer.MAX_VALUE), d.min(Integer.MAX_VALUE), d.max(Integer.MAX_VALUE)).toString(); }
public void fit(DataSet dataSet) { mean = dataSet.getFeatureMatrix().mean(0); std = dataSet.getFeatureMatrix().std(0); std.addi(Nd4j.scalar(Nd4j.EPS_THRESHOLD)); if (std.min(1) == Nd4j.scalar(Nd4j.EPS_THRESHOLD)) logger.info("API_INFO: Std deviation found to be zero. Transform will round upto epsilon to avoid nans."); }
INDArray batchMin = data.min(0); INDArray batchMax = data.max(0); if (!Arrays.equals(batchMin.shape(), batchMax.shape()))
/** * Scales the ndarray columns * to the given min/max values * * @param min the minimum number * @param max the max number */ public static void scaleMinMax(double min, double max, INDArray toScale) { //X_std = (X - X.min(axis=0)) / (X.max(axis=0) - X.min(axis=0)) X_scaled = X_std * (max - min) + min INDArray min2 = toScale.min(0); INDArray max2 = toScale.max(0); INDArray std = toScale.subRowVector(min2).diviRowVector(max2.sub(min2)); INDArray scaled = std.mul(max - min).addi(min); toScale.assign(scaled); }
/** * Pass in a matrix * @param data */ public QuadTree(INDArray data) { INDArray meanY = data.mean(0); INDArray minY = data.min(0); INDArray maxY = data.max(0); init(data, meanY.getDouble(0), meanY.getDouble(1), max(maxY.getDouble(0) - meanY.getDouble(0), meanY.getDouble(0) - minY.getDouble(0)) + Nd4j.EPS_THRESHOLD, max(maxY.getDouble(1) - meanY.getDouble(1), meanY.getDouble(1) - minY.getDouble(1)) + Nd4j.EPS_THRESHOLD); fill(); }
public SpTree(INDArray data, Set<INDArray> indices, String similarityFunction) { this.indices = indices; this.N = data.rows(); this.D = data.columns(); this.similarityFunction = similarityFunction; INDArray meanY = data.mean(0); INDArray minY = data.min(0); INDArray maxY = data.max(0); INDArray width = Nd4j.create(meanY.shape()); for (int i = 0; i < width.length(); i++) { width.putScalar(i, FastMath.max(maxY.getDouble(i) - meanY.getDouble(i), meanY.getDouble(i) - minY.getDouble(i) + Nd4j.EPS_THRESHOLD)); } init(null, data, meanY, width, indices, similarityFunction); fill(N); }