@@ -0,0 +1,1945 @@
+package io.sigpipe.sing.adapters;%0A%0Aimport java.nio.charset.Charset;%0Aimport java.nio.file.Files;%0Aimport java.nio.file.Paths;%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0Aimport java.util.stream.Collectors;%0A%0Aimport io.sigpipe.sing.dataset.AutoQuantizer;%0Aimport io.sigpipe.sing.dataset.Quantizer;%0Aimport io.sigpipe.sing.dataset.feature.Feature;%0Aimport io.sigpipe.sing.dataset.feature.FeatureType;%0Aimport io.sigpipe.sing.stat.SquaredError;%0A%0Apublic class DiseaseTest %7B%0A%0A    public static void main(String%5B%5D args) throws Exception %7B%0A        List%3CFeature%3E features = Files.lines(%0A                Paths.get(args%5B0%5D), Charset.defaultCharset())%0A            .map(line -%3E Float.parseFloat(line))%0A            .map(fl -%3E new Feature(%22disease_duration%22, fl))%0A            .collect(Collectors.toList());%0A%0A        Quantizer q = null;%0A        int ticks = 10;%0A        double err = Double.MAX_VALUE;%0A        while (err %3E 0.025) %7B%0A            q = AutoQuantizer.fromList(features, ticks);%0A            List%3CFeature%3E quantized = new ArrayList%3C%3E();%0A            for (Feature f : features) %7B%0A                /* Find the midpoint */%0A                Feature initial = q.quantize(f.convertTo(FeatureType.DOUBLE));%0A                Feature next = q.nextTick(initial);%0A                if (next == null) %7B%0A                    next = initial;%0A                %7D%0A                Feature difference = next.subtract(initial);%0A                Feature midpoint = difference.divide(new Feature(2.0f));%0A                Feature prediction = initial.add(midpoint);%0A%0A                quantized.add(prediction);%0A            %7D%0A%0A            SquaredError se = new SquaredError(features, quantized);%0A            System.out.println(features.get(0).getName()%0A                    + %22    %22 + q.numTicks() + %22    %22 + se.RMSE() + %22    %22%0A                    + se.NRMSE() + %22    %22 + se.CVRMSE());%0A            err = se.NRMSE();%0A            ticks += 1;%0A        %7D%0A        System.out.println(q);%0A    %7D%0A%7D%0A

Add disease duration test