指定输入数据和输出数据的路径

时间:2017-01-31 08:46:06

标签: java

我是java的新手,我必须使用下面的代码,但代码确实有效,因为我必须指定输入数据和输出数据的路径。代码是从互联网上获得的。请帮帮我

class Svm_scale 
{


    private BufferedReader rewind(BufferedReader fp, String filename) throws IOException
    {
        fp.close();
        return new BufferedReader(new FileReader(filename));
    }

    private void output_target(double value)
    {
        LnCount++;
        if(y_scaling)
        {
            if(value == y_min)
                value = y_lower;
            else if(value == y_max)
                value = y_upper;
            else
                value = y_lower + (y_upper-y_lower) *
                (value-y_min) / (y_max-y_min);
        }
formatterscaled.format(value+" ");
     System.out.println(" Line Number "+LnCount + " ");
    }

    private void output(int index, double value)
    {
        count++;
        double Threshold1=0,Threshold2=0;


        Threshold1= Avg[index]+(STDV[index]/2);
        Threshold2= Avg[index]-(STDV[index]/2);


        if(value > Threshold1 )
          value = 2;
        else if(value < Threshold2 )
        value = -2;
        else
        value = 0;


           formatterscaled.format( formatter.format(value) + ",");



       //    System.out.println(" Counter "+count);
     //   }
    }

1 个答案:

答案 0 :(得分:-1)

String save_filename =Save1; // = null?
String restore_filename =null;
String scale_data_filename =Disc; // set this to the path where the output should be stored, e.g. = "C:\\temp\\scaled";
String data_filename =Libsvm; // set this to the path where the input can be get, e.g. = "C:\\temp\\inputdata"

这些是您需要调整的String,以便程序可以读写。 Save1DiscLibsvm不在您的代码中,因此只能猜到它们来自哪里。

data_filenamescale_data_filename是必需的。 save_filename似乎是可选的,可以设置为null