• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Datamining r 3rd
 

Datamining r 3rd

on

  • 605 views

 

Statistics

Views

Total Views
605
Views on SlideShare
547
Embed Views
58

Actions

Likes
0
Downloads
3
Comments
0

2 Embeds 58

http://togodb.sel.is.ocha.ac.jp 42
http://togodb.seselab.org 16

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Datamining r 3rd Datamining r 3rd Presentation Transcript

    • R: sesejun@is.ocha.ac.jp 2010/11/04
    • > options(repos=c(CRAN="http://cran.md.tsukuba.ac.jp/"))# CRAN> install.packages(e1071)> library("e1071")> contacts.train<-read.table("contacts.csv", header=T, sep=",")> contacts.test<-read.table("contacts_test.csv", header=T, sep=",")
    • > contacts.prob<-naiveBayes(contacts.train[,-1],contacts.train[,1])> predict(contacts.prob,contacts.test[,-1])[1] N PLevels: N P> table(predict(contacts.prob,contacts.test[,-1]),contacts.test[,1]) N P N 1 0 P 0 1> predict(contacts.prob,contacts.train[,-1]) [1] P P P P P P N P N PLevels: N P> table(predict(contacts.prob,contacts.train[,-1]),contacts.train[,1]) N P N 2 0 P 4 4
    • > iris.train<-read.table("iris_train.csv", header=T, sep=",")> iris.test<-read.table("iris_test.csv", header=T, sep=",")> iris.prob<-naiveBayes(iris.train[,-5],iris.train[,5])> iris.probNaive Bayes Classifier for Discrete PredictorsCall:naiveBayes.default(x = iris.train[, -5], y = iris.train[, 5])A-priori probabilities:iris.train[, 5] Iris-setosa Iris-versicolor Iris-virginica 0.3583333 0.3416667 0.3000000Conditional probabilities: Sepal.lengthiris.train[, 5] [,1] [,2] Iris-setosa 5.000000 0.3664502 Iris-versicolor 5.960976 0.4705731 Iris-virginica 6.558333 0.6741662...
    • > predict(iris.prob,iris.test[,-5]) [1] Iris-setosa Iris-setosa Iris-setosa [4] Iris-setosa Iris-setosa Iris-setosa [7] Iris-setosa Iris-setosa Iris-setosa [10] Iris-setosa Iris-setosa Iris-setosa ...> table(predict(iris.prob,iris.test[,-5]), iris.test[,5]) Iris-setosa Iris-versicolor Iris-virginica Iris-setosa 43 0 0 Iris-versicolor 0 39 3 Iris-virginica 0 2 33