Saturday, 10 August 2013

Why has changed both sides of equation in java?

Why has changed both sides of equation in java?

I have a strange problem that confused me completely.
I am using WEKA for my project, and I want to change class values of my
dataset to test somethings; so I preserve my dataset into another value
whose name is d, and using setClassValue method for changing class values.
Finally, I print classValues for each instance in d and dataset variables.
Instances d=dataset;
for (int i = 0; i <dataset.size(); i++) {
dataset.get(i).setClassValue(10);
System.out.println(dataset.get(i).classValue()+ "\t"
+d.get(i).classValue() );
}
Result is not believable, both d and dataset class values were changed.
Why did this happen? How can I change class values of a dataset with
considering that I should preserve my original dataset?

No comments:

Post a Comment