- 전체
- JAVA 일반
- JAVA 수학
- JAVA 그래픽
- JAVA 자료구조
- JAVA 인공지능
- JAVA 인터넷
- Java Framework
- Java GUI (AWT,SWING,SWT,JFACE)
- SWT and RCP (web RAP/RWT)[eclipse], EMF
JAVA 인공지능 weka and java eclipse example : A Simple Machine Learning Example in Java
2020.01.31 21:23
weka and java eclipse example : A Simple Machine Learning Example in Java
A Simple Machine Learning Example in Java
This is a "Hello World" example of machine learning in Java. It simply give you a taste of machine learning in Java.
Environment
Java 1.6+ and Eclipse
Step 1: Download Weka libraryDownload page: http://www.cs.waikato.ac.nz/ml/weka/snapshots/weka_snapshots.html
Download stable.XX.zip, unzip the file, add weka.jar to your library path of Java project in Eclipse.
Step 2: Prepare Data
Create a txt file "weather.txt" by following the following format:
@relation weather
@attribute outlook {sunny, overcast, rainy}
@attribute temperature numeric
@attribute humidity numeric
@attribute windy {TRUE, FALSE}
@attribute play {yes, no}
@data
sunny,85,85,FALSE,no
sunny,80,90,TRUE,no
overcast,83,86,FALSE,yes
rainy,70,96,FALSE,yes
rainy,68,80,FALSE,yes
rainy,65,70,TRUE,no
overcast,64,65,TRUE,yes
sunny,72,95,FALSE,no
sunny,69,70,FALSE,yes
rainy,75,80,FALSE,yes
sunny,75,70,TRUE,yes
overcast,72,90,TRUE,yes
overcast,81,75,FALSE,yes
rainy,71,91,TRUE,no
This dataset is from weka download package. It is located at "/data/weather.numeric.arff". The file extension name is "arff", but we can simply use "txt".
Step 3: Training and Testing by Using Weka
This code example use a set of classifiers provided by Weka. It trains model on the given dataset and test by using 10-split cross validation. I will explain each classifier later as it is a more complicated topic.
The package view of your project should look like the following:

References:
1. http://www.cs.umb.edu/~ding/history/480_697_spring_2013/homework/WekaJavaAPITutorial.pdf
2. http://www.cs.ru.nl/P.Lucas/teaching/DM/weka.pdf
[출처] https://www.programcreek.com/2013/01/a-simple-machine-learning-example-in-java/
광고 클릭에서 발생하는 수익금은 모두 웹사이트 서버의 유지 및 관리, 그리고 기술 콘텐츠 향상을 위해 쓰여집니다.
댓글 0
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
|---|---|---|---|---|
| 6 |
java4autocad Java for Autocad
| 졸리운_곰 | 2017.04.26 | 387 |
| 5 | Java3D and Eclipse | 졸리운_곰 | 2015.08.12 | 317 |
| 4 |
Draw2d Intro
| 졸리운_곰 | 2015.07.29 | 514 |
| 3 |
FreeLayout: A New Java Layout
| 졸리운_곰 | 2015.05.14 | 315 |
| 2 |
XML file to Treeviewer
| 졸리운_곰 | 2015.03.19 | 399 |
| 1 |
Java GUI(AWT) 프로그래밍
| 졸리운_곰 | 2015.03.09 | 938 |

