Skip to content
selvinsource edited this page Jul 20, 2014 · 15 revisions

This tutorial shows how to connect Weka to a MongoDB database and compare the results of mongodb-datamining-shell to the Weka Explorer. Make sure you have installed mongodb-datamining-shell therefore having a mongodb database called mongodbdm and the collections weatherData and iris.

Connect Weka to MongoDB

  • Download UnityJDBC Driver for MongoDB
  • Copy both mongodb_unityjdbc.jar and mongo-java-driver.jar (found in the UnityJDBC package) to the Weka classpath (see connect Weka to a database via JDBC for more details)
  • Use DatabaseUtils.props.mongodb MongoDB properties file (remember to rename it to DatabaseUtils.props)
  • From the Weka Explorer, click on Open DB... then Connect
  • In the Query section type: select outlook, temperature, humidity, windy, play from weatherData
  • Click Execute

screenshot

Classification

compareToWekaClassify

mongo mongodbdm --eval "var inputCollectionName = \"weatherData\", target = \"play\"" 

Clustering

compareToWekaCluster

mongo mongodbdm --eval "var inputCollectionName = \"iris\", k = 3" datamining/clustering/kmeans.js
Clone this wiki locally