Java examples for Machine Learning AI:weka
use weka Association Rules
/*/*from ww w .j ava2 s . c om*/ * How to use WEKA API in Java * Copyright (C) 2014 * @author Dr Noureddin M. Sadawi (noureddin.sadawi@gmail.com) * * This program is free software: you can redistribute it and/or modify * it as you wish ... * I ask you only, as a professional courtesy, to cite my name, web page * and my YouTube Channel! * */ package weka.api; //import required classes import weka.associations.Apriori; import weka.core.Instances; import weka.core.converters.ConverterUtils.DataSource; public class AssocRules { public static void main(String args[]) throws Exception { //load dataset String dataset = "/home/likewise-open/ACADEMIC/csstnns/Desktop/weather.nominal.arff"; DataSource source = new DataSource(dataset); //get instances object Instances data = source.getDataSet(); //the Apriori algorithm Apriori model = new Apriori(); //build model model.buildAssociations(data); //print out the extracted rules System.out.println(model); } }