Java 类weka.core.ProtectedProperties 实例源码

项目:bestconf    文件:LHSSampler.java   
public static void main(String[] args){
    ArrayList<Attribute> atts = new ArrayList<Attribute>();

    /*Properties p1 = new Properties();
    p1.setProperty("range", "[0,1]");
    ProtectedProperties prop1 = new ProtectedProperties(p1);*/

    Properties p2 = new Properties();
    p2.setProperty("range", "[321,1E9]");
    ProtectedProperties prop2 = new ProtectedProperties(p2);

    ArrayList<String> attVals = new ArrayList<String>();
    for (int i = 0; i < 5; i++)
          attVals.add("val" + (i+1));

    //atts.add(new Attribute("att1", prop1));
    atts.add(new Attribute("att2", prop2));
    //atts.add(new Attribute("att3", attVals));
    //Instances data = LHSInitializer.getMultiDimContinuous(atts, 10, false);
    //Instances data = LHSInitializer.getMultiDim(atts, 10, false);
    LHSSampler sampler = new LHSSampler();
    Instances data = sampler.sampleMultiDimContinuous(atts, 1, false);

    System.out.println(data);
}
项目:bestconf    文件:LHSInitializer.java   
public static void main(String[] args){
    ArrayList<Attribute> atts = new ArrayList<Attribute>();

    /*Properties p1 = new Properties();
    p1.setProperty("range", "[0,1]");
    ProtectedProperties prop1 = new ProtectedProperties(p1);*/

    Properties p2 = new Properties();
    p2.setProperty("range", "[321,1E9]");
    ProtectedProperties prop2 = new ProtectedProperties(p2);

    ArrayList<String> attVals = new ArrayList<String>();
    for (int i = 0; i < 5; i++)
          attVals.add("val" + (i+1));

    //atts.add(new Attribute("att1", prop1));
    atts.add(new Attribute("att2", prop2));
    //atts.add(new Attribute("att3", attVals));
    //Instances data = LHSInitializer.getMultiDimContinuous(atts, 10, false);
    //Instances data = LHSInitializer.getMultiDim(atts, 10, false);
    Instances data = LHSInitializer.getMultiDimContinuous(atts, 1, false);

    System.out.println(data);
}
项目:BestConfig    文件:LHSSampler.java   
public static void main(String[] args){
    ArrayList<Attribute> atts = new ArrayList<Attribute>();

    /*Properties p1 = new Properties();
    p1.setProperty("range", "[0,1]");
    ProtectedProperties prop1 = new ProtectedProperties(p1);*/

    Properties p2 = new Properties();
    p2.setProperty("range", "[321,1E9]");
    ProtectedProperties prop2 = new ProtectedProperties(p2);

    ArrayList<String> attVals = new ArrayList<String>();
    for (int i = 0; i < 5; i++)
          attVals.add("val" + (i+1));

    //atts.add(new Attribute("att1", prop1));
    atts.add(new Attribute("att2", prop2));
    //atts.add(new Attribute("att3", attVals));
    //Instances data = LHSInitializer.getMultiDimContinuous(atts, 10, false);
    //Instances data = LHSInitializer.getMultiDim(atts, 10, false);
    LHSSampler sampler = new LHSSampler();
    Instances data = sampler.sampleMultiDimContinuous(atts, 1, false);

    System.out.println(data);
}
项目:BestConfig    文件:LHSInitializer.java   
public static void main(String[] args){
    ArrayList<Attribute> atts = new ArrayList<Attribute>();

    /*Properties p1 = new Properties();
    p1.setProperty("range", "[0,1]");
    ProtectedProperties prop1 = new ProtectedProperties(p1);*/

    Properties p2 = new Properties();
    p2.setProperty("range", "[321,1E9]");
    ProtectedProperties prop2 = new ProtectedProperties(p2);

    ArrayList<String> attVals = new ArrayList<String>();
    for (int i = 0; i < 5; i++)
          attVals.add("val" + (i+1));

    //atts.add(new Attribute("att1", prop1));
    atts.add(new Attribute("att2", prop2));
    //atts.add(new Attribute("att3", attVals));
    //Instances data = LHSInitializer.getMultiDimContinuous(atts, 10, false);
    //Instances data = LHSInitializer.getMultiDim(atts, 10, false);
    Instances data = LHSInitializer.getMultiDimContinuous(atts, 1, false);

    System.out.println(data);
}
项目:bestconf    文件:DDSSampler.java   
public static void main(String[] args){
    ArrayList<Attribute> atts = new ArrayList<Attribute>();

    Properties p1 = new Properties();
    p1.setProperty("range", "[0,1]");
    ProtectedProperties prop1 = new ProtectedProperties(p1);

    Properties p2 = new Properties();
    p2.setProperty("range", "[321,1E9]");
    ProtectedProperties prop2 = new ProtectedProperties(p2);

    Properties p3 = new Properties();
    p3.setProperty("range", "[1,30]");
    ProtectedProperties prop3 = new ProtectedProperties(p3);

    ArrayList<String> attVals = new ArrayList<String>();
    for (int i = 0; i < 5; i++)
          attVals.add("val" + (i+1));

    atts.add(new Attribute("att1", prop1));
    atts.add(new Attribute("att2", prop2));
    atts.add(new Attribute("att3", prop3));
    //atts.add(new Attribute("att4", attVals));
    //Instances data = LHSInitializer.getMultiDimContinuous(atts, 10, false);
    //Instances data = LHSInitializer.getMultiDim(atts, 10, false);
    DDSSampler sampler = new DDSSampler(3);

    sampler.setCurrentRound(0);
    Instances data = sampler.sampleMultiDimContinuous(atts, 2, false);
    System.out.println(data);

    sampler.setCurrentRound(01);
    data = sampler.sampleMultiDimContinuous(atts, 2, false);
    System.out.println(data);

    sampler.setCurrentRound(2);
    data = sampler.sampleMultiDimContinuous(atts, 2, false);
    System.out.println(data);
}
项目:BestConfig    文件:DDSSampler.java   
public static void main(String[] args){
    ArrayList<Attribute> atts = new ArrayList<Attribute>();

    Properties p1 = new Properties();
    p1.setProperty("range", "[0,1]");
    ProtectedProperties prop1 = new ProtectedProperties(p1);

    Properties p2 = new Properties();
    p2.setProperty("range", "[321,1E9]");
    ProtectedProperties prop2 = new ProtectedProperties(p2);

    Properties p3 = new Properties();
    p3.setProperty("range", "[1,30]");
    ProtectedProperties prop3 = new ProtectedProperties(p3);

    ArrayList<String> attVals = new ArrayList<String>();
    for (int i = 0; i < 5; i++)
          attVals.add("val" + (i+1));

    atts.add(new Attribute("att1", prop1));
    atts.add(new Attribute("att2", prop2));
    atts.add(new Attribute("att3", prop3));
    //atts.add(new Attribute("att4", attVals));
    //Instances data = LHSInitializer.getMultiDimContinuous(atts, 10, false);
    //Instances data = LHSInitializer.getMultiDim(atts, 10, false);
    DDSSampler sampler = new DDSSampler(3);

    sampler.setCurrentRound(0);
    Instances data = sampler.sampleMultiDimContinuous(atts, 2, false);
    System.out.println(data);

    sampler.setCurrentRound(01);
    data = sampler.sampleMultiDimContinuous(atts, 2, false);
    System.out.println(data);

    sampler.setCurrentRound(2);
    data = sampler.sampleMultiDimContinuous(atts, 2, false);
    System.out.println(data);
}
项目:bestconf    文件:ConfigSampler.java   
private static ArrayList<Attribute> scaleDownNeighbordists(Instances previousSet, Instance center){
    ArrayList<Attribute> localAtts = new ArrayList<Attribute>();
    int attNum = center.numAttributes();

    int pos = -1;
    if(previousSet.attribute(PerformanceAttName)!=null)
        pos = previousSet.attribute(PerformanceAttName).index();

    //traverse each dimension
    Enumeration<Instance> enu;
    double[] minDists = new double[2];
    double val;
    for(int i=0;i<attNum;i++){
        if(i==pos)
            continue;

        enu = previousSet.enumerateInstances();
        minDists[0] = 1-Double.MAX_VALUE;
        minDists[1] = Double.MAX_VALUE;

        while(enu.hasMoreElements()){
            Instance ins = enu.nextElement();
            if(!ins.equals(center)){
                val = ins.value(i)-center.value(i);
                if(val<0)
                    minDists[0] = Math.max((double)((int)((ins.value(i)-center.value(i))*1000))/1000.0, minDists[0]);
                else
                    minDists[1] = Math.min((double)((int)((ins.value(i)-center.value(i))*1000))/1000.0, minDists[1]);
            }
        }

        //now we set the range
        Properties p1 = new Properties();
        double upper = center.value(i)+minDists[1], lower=center.value(i)+minDists[0];

        TreeSet<Double> detourSet = new TreeSet<Double>();
        detourSet.add(upper);
        detourSet.add(lower);
        detourSet.add(previousSet.attribute(i).getUpperNumericBound());
        detourSet.add(previousSet.attribute(i).getLowerNumericBound());
        switch(detourSet.size()){
        case 1:
            upper=lower=detourSet.first();
            break;
        case 2:
            upper = detourSet.last();
            lower = detourSet.first();
            break;
        case 3:
            upper=lower=detourSet.higher(detourSet.first());
            break;
        default://case 4:
            upper=detourSet.lower(detourSet.last());
            lower=detourSet.higher(detourSet.first());
            break;
        }

        p1.setProperty("range", "["+String.valueOf(lower)+","+String.valueOf(upper)+"]");
        ProtectedProperties prop1 = new ProtectedProperties(p1);

        localAtts.add(new Attribute(previousSet.attribute(i).name(), prop1));
    }

    return localAtts;
}
项目:bestconf    文件:ConfigSampler.java   
private static ArrayList<Attribute> scaleDownMindists(Instances previousSet, Instance center){
    ArrayList<Attribute> localAtts = new ArrayList<Attribute>();
    int attNum = center.numAttributes();

    int pos = previousSet.attribute(PerformanceAttName).index();

    //traverse each dimension
    Enumeration<Instance> enu;
    double minDis;
    for(int i=0;i<attNum;i++){
        if(i==pos)
            continue;

        enu = previousSet.enumerateInstances();
        minDis = Double.MAX_VALUE;

        while(enu.hasMoreElements()){
            Instance ins = enu.nextElement();
            if(!ins.equals(center))
                minDis = Math.min((double)((int)(Math.abs(ins.value(i)-center.value(i))*1000))/1000.0, minDis);
        }

        //now we set the range
        Properties p1 = new Properties();
        double upper = center.value(i)+minDis, lower=center.value(i)-minDis;

        TreeSet<Double> detourSet = new TreeSet<Double>();
        detourSet.add(upper);
        detourSet.add(lower);
        detourSet.add(previousSet.attribute(i).getUpperNumericBound());
        detourSet.add(previousSet.attribute(i).getLowerNumericBound());
        switch(detourSet.size()){
        case 1:
            upper=lower=detourSet.first();
            break;
        case 2:
            upper = detourSet.last();
            lower = detourSet.first();
            break;
        case 3:
            upper=lower=detourSet.higher(detourSet.first());
            break;
        default://case 4:
            upper=detourSet.lower(detourSet.last());
            lower=detourSet.higher(detourSet.first());
            break;
        }

        p1.setProperty("range", "["+String.valueOf(lower)+","+String.valueOf(upper)+"]");
        ProtectedProperties prop1 = new ProtectedProperties(p1);

        localAtts.add(new Attribute(previousSet.attribute(i).name(), prop1));
    }

    return localAtts;
}
项目:bestconf    文件:BestConf.java   
public static ArrayList<Attribute> scaleDownDetour(Instances previousSet, Instance center){
    ArrayList<Attribute> localAtts = new ArrayList<Attribute>();
    int attNum = center.numAttributes();

    int pos = previousSet.attribute(PerformanceAttName).index();

    //traverse each dimension
    Enumeration<Instance> enu;
    double minDis;
    for(int i=0;i<attNum;i++){
        if(i==pos)
            continue;

        enu = previousSet.enumerateInstances();
        minDis = Double.MAX_VALUE;

        while(enu.hasMoreElements()){
            Instance ins = enu.nextElement();
            if(!ins.equals(center))
                minDis = Math.min((double)((int)(Math.abs(ins.value(i)-center.value(i))*100))/100.0, minDis);
        }

        //now we set the range
        Properties p1 = new Properties();
        double upper = center.value(i)+minDis, lower=center.value(i)-minDis;

        TreeSet<Double> detourSet = new TreeSet<Double>();
        detourSet.add(upper);
        detourSet.add(lower);
        detourSet.add(previousSet.attribute(i).getUpperNumericBound());
        detourSet.add(previousSet.attribute(i).getLowerNumericBound());
        switch(detourSet.size()){
        case 1:
            upper=lower=detourSet.first();
            break;
        case 2:
            upper = detourSet.last();
            lower = detourSet.first();
            break;
        case 3:
            upper=lower=detourSet.higher(detourSet.first());
            break;
        default://case 4:
            upper=detourSet.lower(detourSet.last());
            lower=detourSet.higher(detourSet.first());
            break;
        }

        p1.setProperty("range", "["+String.valueOf(lower)+","+String.valueOf(upper)+"]");
        ProtectedProperties prop1 = new ProtectedProperties(p1);

        localAtts.add(new Attribute(previousSet.attribute(i).name(), prop1));
    }

    return localAtts;
}
项目:BestConfig    文件:ConfigSampler.java   
private static ArrayList<Attribute> scaleDownNeighbordists(Instances previousSet, Instance center){
    ArrayList<Attribute> localAtts = new ArrayList<Attribute>();
    int attNum = center.numAttributes();

    int pos = -1;
    if(previousSet.attribute(PerformanceAttName)!=null)
        pos = previousSet.attribute(PerformanceAttName).index();

    //traverse each dimension
    Enumeration<Instance> enu;
    double[] minDists = new double[2];
    double val;
    for(int i=0;i<attNum;i++){
        if(i==pos)
            continue;

        enu = previousSet.enumerateInstances();
        minDists[0] = 1-Double.MAX_VALUE;
        minDists[1] = Double.MAX_VALUE;

        while(enu.hasMoreElements()){
            Instance ins = enu.nextElement();
            if(!ins.equals(center)){
                val = ins.value(i)-center.value(i);
                if(val<0)
                    minDists[0] = Math.max((double)((int)((ins.value(i)-center.value(i))*1000))/1000.0, minDists[0]);
                else
                    minDists[1] = Math.min((double)((int)((ins.value(i)-center.value(i))*1000))/1000.0, minDists[1]);
            }
        }

        //now we set the range
        Properties p1 = new Properties();
        double upper = center.value(i)+minDists[1], lower=center.value(i)+minDists[0];

        TreeSet<Double> detourSet = new TreeSet<Double>();
        detourSet.add(upper);
        detourSet.add(lower);
        detourSet.add(previousSet.attribute(i).getUpperNumericBound());
        detourSet.add(previousSet.attribute(i).getLowerNumericBound());
        switch(detourSet.size()){
        case 1:
            upper=lower=detourSet.first();
            break;
        case 2:
            upper = detourSet.last();
            lower = detourSet.first();
            break;
        case 3:
            upper=lower=detourSet.higher(detourSet.first());
            break;
        default://case 4:
            upper=detourSet.lower(detourSet.last());
            lower=detourSet.higher(detourSet.first());
            break;
        }

        p1.setProperty("range", "["+String.valueOf(lower)+","+String.valueOf(upper)+"]");
        ProtectedProperties prop1 = new ProtectedProperties(p1);

        localAtts.add(new Attribute(previousSet.attribute(i).name(), prop1));
    }

    return localAtts;
}
项目:BestConfig    文件:ConfigSampler.java   
private static ArrayList<Attribute> scaleDownMindists(Instances previousSet, Instance center){
    ArrayList<Attribute> localAtts = new ArrayList<Attribute>();
    int attNum = center.numAttributes();

    int pos = previousSet.attribute(PerformanceAttName).index();

    //traverse each dimension
    Enumeration<Instance> enu;
    double minDis;
    for(int i=0;i<attNum;i++){
        if(i==pos)
            continue;

        enu = previousSet.enumerateInstances();
        minDis = Double.MAX_VALUE;

        while(enu.hasMoreElements()){
            Instance ins = enu.nextElement();
            if(!ins.equals(center))
                minDis = Math.min((double)((int)(Math.abs(ins.value(i)-center.value(i))*1000))/1000.0, minDis);
        }

        //now we set the range
        Properties p1 = new Properties();
        double upper = center.value(i)+minDis, lower=center.value(i)-minDis;

        TreeSet<Double> detourSet = new TreeSet<Double>();
        detourSet.add(upper);
        detourSet.add(lower);
        detourSet.add(previousSet.attribute(i).getUpperNumericBound());
        detourSet.add(previousSet.attribute(i).getLowerNumericBound());
        switch(detourSet.size()){
        case 1:
            upper=lower=detourSet.first();
            break;
        case 2:
            upper = detourSet.last();
            lower = detourSet.first();
            break;
        case 3:
            upper=lower=detourSet.higher(detourSet.first());
            break;
        default://case 4:
            upper=detourSet.lower(detourSet.last());
            lower=detourSet.higher(detourSet.first());
            break;
        }

        p1.setProperty("range", "["+String.valueOf(lower)+","+String.valueOf(upper)+"]");
        ProtectedProperties prop1 = new ProtectedProperties(p1);

        localAtts.add(new Attribute(previousSet.attribute(i).name(), prop1));
    }

    return localAtts;
}
项目:BestConfig    文件:BestConf.java   
public static ArrayList<Attribute> scaleDownDetour(Instances previousSet, Instance center){
    ArrayList<Attribute> localAtts = new ArrayList<Attribute>();
    int attNum = center.numAttributes();

    int pos = previousSet.attribute(PerformanceAttName).index();

    //traverse each dimension
    Enumeration<Instance> enu;
    double minDis;
    for(int i=0;i<attNum;i++){
        if(i==pos)
            continue;

        enu = previousSet.enumerateInstances();
        minDis = Double.MAX_VALUE;

        while(enu.hasMoreElements()){
            Instance ins = enu.nextElement();
            if(!ins.equals(center))
                minDis = Math.min((double)((int)(Math.abs(ins.value(i)-center.value(i))*100))/100.0, minDis);
        }

        //now we set the range
        Properties p1 = new Properties();
        double upper = center.value(i)+minDis, lower=center.value(i)-minDis;

        TreeSet<Double> detourSet = new TreeSet<Double>();
        detourSet.add(upper);
        detourSet.add(lower);
        detourSet.add(previousSet.attribute(i).getUpperNumericBound());
        detourSet.add(previousSet.attribute(i).getLowerNumericBound());
        switch(detourSet.size()){
        case 1:
            upper=lower=detourSet.first();
            break;
        case 2:
            upper = detourSet.last();
            lower = detourSet.first();
            break;
        case 3:
            upper=lower=detourSet.higher(detourSet.first());
            break;
        default://case 4:
            upper=detourSet.lower(detourSet.last());
            lower=detourSet.higher(detourSet.first());
            break;
        }

        p1.setProperty("range", "["+String.valueOf(lower)+","+String.valueOf(upper)+"]");
        ProtectedProperties prop1 = new ProtectedProperties(p1);

        localAtts.add(new Attribute(previousSet.attribute(i).name(), prop1));
    }

    return localAtts;
}