Random.java [src/java/m/ann/training/scale] Revision: default  Date:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package m.ann.training.scale;

import java.util.Collections;
import java.util.List;
import org.bson.Document;

/**
 *
 * @author sidereus
 */
public class Random extends ScalingMechanism {

    @Override
    public String getStrategy() {
        return "Random";
    }

    @Override
    public DataSetIndices compute(Iterable<Document> d, double trainingPerc) {
        int dataLength = getDataLength(d);
        int trainingLength = getTrainingLength(trainingPerc, dataLength);
        List<Integer> range = getRange(dataLength);
        Collections.shuffle(range);

        return new DataSetIndices(range.subList(0, trainingLength), range.subList(trainingLength, dataLength));
    }

}