<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Contact lenses - input page <%@ page import="weka.core.*" %> <%@ page import=" weka.classifiers.trees.*" %> <%@ page import="java.io.*" %> <%@ page import="java.util.*" %> <% //1. load arff training set from arff file String fileName=getServletContext().getRealPath("contact-lenses.arff"); File f=new File(fileName); InputStream in = new FileInputStream(f); InputStreamReader isreader=new InputStreamReader(in); Instances data = new Instances(isreader); isreader.close(); // setting class attribute data.setClassIndex(data.numAttributes() - 1); %>

Enter attribute values to find the best lenses type:

<% //3. loop through attributes and put options in the form Enumeration attributes=data.enumerateAttributes(); while(attributes.hasMoreElements()) { Attribute currAttribute=(Attribute)attributes.nextElement(); %> <%= currAttribute.name() %>
<%} %> <%= data.classAttribute().name() %>