I have my application which need to get associations via the Apriori Algorithm. In order to achieve results I use Weka dependency. Though I want to get associations it prints memory locations. I have attached the output as well. Thanks.
Here is my code:
public class App
{
static Logger log = Logger.getLogger(App.class.getName());
public static BufferedReader readDataFile(String filename) {
BufferedReader inputReader = null;
try {
inputReader = new BufferedReader(new FileReader(filename));
} catch (FileNotFoundException ex) {
}
return inputReader;
}
public static void main( String[] args ) throws Exception {
//Define ArrayList to Add Clustered Information
ArrayList<FastVector[]> associationInfoArrayList = new ArrayList<FastVector[]>();
Apriori apriori = new Apriori();
apriori.setNumRules(15);
BufferedReader datafile = readDataFile("/media/jingi_ingi/IR1_CPRA_X6/Documents/ss.arff");
Instances data = new Instances(datafile);
// Instances instances = new Instances(datafile);
apriori.buildAssociations(data);
log.debug("Testing Apriori Algo Results Started ....");
log.debug("-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-");
log.debug("Number of Associations : " + apriori.getNumRules());
log.debug("Adding Association Information to ArrayList ..");
Object objectArrayOfAssociations[] = new Object[apriori.getNumRules()];
log.debug(apriori.getAllTheRules().toString());
for(int i=0; i<apriori.getNumRules(); i++) {
objectArrayOfAssociations[i] = apriori.getAllTheRules();
log.debug("Associations Discovered : " + objectArrayOfAssociations[i].toString());
}
}
}
Output of the Application:
2015-04-05 20:16:42 DEBUG App:48 - Associations Discovered : [Lweka.core.FastVector;@19a96bae
2015-04-05 20:16:42 DEBUG App:48 - Associations Discovered : [Lweka.core.FastVector;@19a96bae
2015-04-05 20:16:42 DEBUG App:48 - Associations Discovered : [Lweka.core.FastVector;@19a96bae
2015-04-05 20:16:42 DEBUG App:48 - Associations Discovered : [Lweka.core.FastVector;@19a96bae