public class Logprocess {
/**
* Get Feature data
*/
Public Matrix Getdatamat () {
try {
arraylist<double[]> list = new arraylist<double[]> ();
String pathname = "C:\\testset.txt";
File filename = new file (pathname);
InputStreamReader reader = new InputStreamReader (
New FileInputStream (filename));
BufferedReader br = new BufferedReader (reader);
/**
* Get Tag data
*/
Public Matrix Getlabelmat () {
try {
arraylist<int[]> list = new arraylist<int[]> ();
String pathname = "C:\\testset.txt";
File filename = new file (pathname);
InputStreamReader reader = new InputStreamReader (
New FileInputStream (filename));
BufferedReader br = new BufferedReader (reader);
String line = "";
line = Br.readline ();
while (line!= null) {
String [] Tmp=line.split ("T");
int [] value=new int[1];
Value[0]=integer.parseint (tmp[2]);
List.add (value);
line = Br.readline (); Read one row of data at a time
}
Convert a label to a two-dimensional array
iterator<int[]> labelit = List.iterator ();
Double [] label = new Double[list.size ()][1];
int j=0;
while (Labelit.hasnext ()) {
Label[j][0]=labelit.next () [0];
j + +;
}
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.