public final class FastRfUtils extends Object
Modifier and Type | Method and Description |
---|---|
static void |
normalize(double[] doubles)
Normalizes the doubles in the array by their sum.
|
static int[] |
randomPermutation(int numElems,
Random rng)
Produces a random permutation using Knuth shuffle.
|
static Instances |
readInstances(String location)
Load a dataset into memory.
|
static Instances |
scramble(Instances src,
Instances dst,
int attIndex,
int[] perm)
Produces a random permutation of the values of an attribute in a dataset using Knuth shuffle.
|
static int[] |
sort(float[] array)
Sorts a given array of floats in ascending order and returns an
array of integers with the positions of the elements of the
original array in the sorted array.
|
public static int[] sort(float[] array)
array
- this array is not changed by the method!public static void normalize(double[] doubles)
If supplied an array full of zeroes, does not modify the array.
doubles
- the array of doubleIllegalArgumentException
- if sum is NaNpublic static int[] randomPermutation(int numElems, Random rng)
numElems
- the size of the permutationrng
- the random number generatorpublic static Instances scramble(Instances src, Instances dst, int attIndex, int[] perm)
Copies back the current values of the previously scrambled attribute and uses the given permutation to scramble the values of the new attribute all by copying from the original dataset.
src
- the source datasetdst
- the scrambled datasetattIndex
- the attribute indexperm
- the random permutationCopyright © 2015–2021 Fiji. All rights reserved.