0% found this document useful (0 votes)
68 views7 pages

Lab 3

This document provides instructions for installing and running a weather forecasting expert system using the WEKA machine learning toolkit in Java. It includes steps to: 1. Install Java JDK, Eclipse, WEKA, and download sample source code for a weather forecasting program. 2. Configure the WEKA jar files in Eclipse and run the sample program. 3. Observe the program loading a weather dataset and using various classifiers like J48, decision lists, and decision tables to make predictions and calculate accuracies. 4. For a lab challenge, students are asked to create another expert system using different datasets and classifiers like KNN and neural networks, and report the results.

Uploaded by

M D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views7 pages

Lab 3

This document provides instructions for installing and running a weather forecasting expert system using the WEKA machine learning toolkit in Java. It includes steps to: 1. Install Java JDK, Eclipse, WEKA, and download sample source code for a weather forecasting program. 2. Configure the WEKA jar files in Eclipse and run the sample program. 3. Observe the program loading a weather dataset and using various classifiers like J48, decision lists, and decision tables to make predictions and calculate accuracies. 4. For a lab challenge, students are asked to create another expert system using different datasets and classifiers like KNN and neural networks, and report the results.

Uploaded by

M D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

TC2013 Introduction to Artificial Intelligence

Lab 3: WEKA Java Implementation

At the end of this lesson, the student able to,


Course Learning Outcome (CLO 2)
- Membandingkan kaedah-kaedah kecerdasan buatan untuk penyelesaian konflik.
-To compare artificial intelligence techniques in resolving conflict.

Lab 3 (15 Marks)

INSTALLATION INSTRUCTIONS
[VIDEO Tutorial]:

1. Configuration and installation


a. . Java JDK- latest version https://www.oracle.com/java/technologies/javase-jdk13-
downloads.html

b. . Java eclispe https://www.eclipse.org/downloads/packages/installer

c. Weka Java https://sourceforge.net/projects/weka/files/weka-3-8/3.8.4/

d. Download Weather Forecast source code from here


https://www.programcreek.com/2013/01/a-simple-machine-learning-example-in-java/

OR download WeatherForecast.zip that available at UKMFolio.

1
2. Configuration of the jar files dalam Eclispe and run the WeatherForecast.java. Please
follow below step by step:

Step 1: Click Start> Eclipse>Run as administrator.

Step 2: Unzip the WeatherForecast.zip into your own workspace for example
C:\Users\Acer\eclipse-workspace

Step 3: In the eclipse, Click Open project> Import Source> Select Directory>
C:\Users\Acer\eclipse-workspace\WeatherForecast and Click Folder WeatherForecast
> Finish.

2
Step 4.1: Click on WeatherForecast > Double click pom.xml and observe the weka
3.8.0 stable [https://mvnrepository.com/artifact/nz.ac.waikato.cms.weka/weka-stable]
statement as below in the pom.xml file

*Please take note that updating dependencies or library of most stable 3.8.0 weka jar can
be refered as the following:
[ https://mvnrepository.com/artifact/nz.ac.waikato.cms.weka/weka-stable/3.8.4]
Maven is pom.xml is a technology that can update and resolve dependencies/library
easily in Java programming.

Hence weka 3.8.0 weka jar files will be synchronized using Maven project & update
maven

<!-- https://mvnrepository.com/artifact/nz.ac.waikato.cms.weka/weka-stable -->


<dependency>
<groupId>nz.ac.waikato.cms.weka</groupId>
<artifactId>weka-stable</artifactId>
<version>3.8.0</version>
</dependency>

Step 4.2: Click Left Click>pom.xml

Step 4.3 Click Maven>Update Project

Step 4.4: In the Maven Update Project Dialog Box > Click WeatherForecast> OK

Step 4.5: Click at the right bottom button ->

3
Step 4.6: Observe the download sources and Javadoc.

Step 4.2
Step 4.1

Step 4.4 Step 4.6

Step 4.3
Step 4.5

3. Please run the WeatherForeast System Example at


C:\Users\Acer\eclipseworkspace\WeatherForecast\src\mywekaapps\WeatherForecast2.j
ava
Step 5.1:Click and observe your weather.arff dataset consisting of four inputs
[outlooksunny, overcast, rainy], [temperature], [humidity], [windy-true or false] and one
output [play-yes,no].

4
Step 5.2: Please Click on WeatherForecast2.java and click on button at the top right
conner . Please observe all important functions namely readdataFile, classify, calculate
accuracy, crossvalidation and main as the following:

Step 5 .3 : Click on run button> Run As > Java Application

5
Step 6: Observe the model and prediction output the prediction of J48 (b) Part Decision
List (c) Decision Table and (d) Decision Stump as the following:

Model
Accuracy

Accuracy

Accuracy
Accuracy

(a)
J48 (b) Part Decision List (c) Decision Table and (d) Decision Stump model and prediction
outputs and accuracies respectively.

YOUR LAB CHALLENGE


4. Based on above WeatherForecast expert system, please create another expert sytem by
answering below questions:

(a) Please change the weather.arff dataset using two other datasets in the weka 3-8-4-
azulzulu-windows> data and used other two type of machine learning/classifier methods
such as KNN dan Neural Network classifiers.

6
(b) Upload your sourcecode and the screenshot of model file and output results for the new
datasets.
(10 marks)

(c) Please show the table of accuracy (% percentage) showing the differences of performance
as the table below:

Dataset J48 KNN ANN SVM Any*

Dataset1
Dataset 2

(5 marks)

Any inconvenience arises, do contact me directly.

Prepared by
AP Dr Siti Norul Huda Sh. Abdullah.
Dr Kerk Yi Wen.
TC2013 Instructor

You might also like