package io.sigpipe.sing.dataset;

public class AutoQuantizer {

    private static final String[] FEATURE_NAMES = {
        "temperature_surface",
        "temperature_tropopause",
        "relative_humidity_zerodegc_isotherm",
        "total_precipitation_surface_3_hour_accumulation",
        "snow_depth_surface",
        "snow_cover_surface",
        "pressure_tropopause",
        "precipitable_water_entire_atmosphere",
        "visibility_surface",
        "upward_short_wave_rad_flux_surface",
        "surface_wind_gust_surface",
        "total_cloud_cover_entire_atmosphere",
        "upward_long_wave_rad_flux_surface",
        "vegitation_type_as_in_sib_surface",
        "albedo_surface",
        "lightning_surface",
        "convective_inhibition_surface",
        "pressure_surface",
        "transpiration_stress-onset_soil_moisture_surface",
        "soil_porosity_surface",
        "vegetation_surface",
        "downward_long_wave_rad_flux_surface",
        "planetary_boundary_layer_height_surface",
        "ice_cover_ice1_no_ice0_surface",
        "categorical_snow_yes1_no0_surface",
    };
    public static double RMSE(List<Feature> actual, List<Feature> predicted) {
        RunningStatistics rs = new RunningStatistics();
        //TODO check to make sure dimensions are equal
        for (int i = 0; i < actual.size(); ++i) {

            Feature a = actual.get(i);
            Feature b = predicted.get(i);
            Feature err = a.subtract(b);
            double p = Math.pow(err.getDouble(), 2.0);
            rs.put(p);
        }
        return Math.sqrt(rs.mean());
    }
}

@@ -1108,16 +1108,932 @@
 %0A    %7D;%0A
+    public static void main(String%5B%5D args)%0A    throws Exception %7B%0A        PerformanceTimer read = new PerformanceTimer(%22read%22);%0A        read.start();%0A        //for (String fileName : args) %7B%0A            FileInputStream fIn = new FileInputStream(args%5B0%5D);%0A            BufferedInputStream bIn = new BufferedInputStream(fIn);%0A            SerializationInputStream in = new SerializationInputStream(bIn);%0A%0A            List%3CFeature%3E features = new ArrayList%3C%3E();%0A            int num = in.readInt();%0A            for (int i = 0; i %3C num; ++i) %7B%0A                /* Ignore lat, lon: */%0A                in.readFloat();%0A                in.readFloat();%0A%0A                byte%5B%5D payload = in.readField();%0A                Metadata m = Serializer.deserialize(Metadata.class, payload);%0A                Feature f = m.getAttribute(FEATURE_NAMES%5B0%5D);%0A                features.add(f);%0A            %7D%0A        //%7D%0A        read.stop();%0A    %7D%0A
     publ

Read in metadata blob