C50 and machine learning

Source: Internet
Author: User

An existing data set, containing experts on whether contact lenses can be used for diagnostic records (from "Data Mining"), try to use r language to implement rules extraction.

Structure

> spectacle = Factor (Rep (Rep ("Myope", 4), Rep ("Hypermetrop", 3)), 3) > Age = Factor (C (Rep ("Young", 8), Rep (" Pre-presbyopic ", 8), Rep (" Presbyopic ", 8))) > spectacle = Factor (Rep (Rep (" Myope ", 4), Rep (" Hypermetrop ", 4)), 3)) > Astimatism = Factor (Rep (C ("No", "no", "yes", "yes"), 6)) > tear = Factor (Rep (c ("reduced", "normal")) > recommended = Factor (C ("None", "soft", "none", "hard", "none", "soft", "none", "hard", "none",                       "soft", "none", "hard", "None", "soft", "none", "none", "none", "none",                        "None", "hard", "none", "soft", "none", "none")) > DF <- Data.frame (age,spectacle,astimatism,tear,recommended)

Rule generation

> Model <-rpart (Formula = recommended ~.,data = DF2) > Summary (model) Call:rpart (formula = Recommended ~., data =      DF2) n= CP nsplit rel error xerror xstd1 0.2222222 0 1.0000000 1.000000 0.26352312 0.0100000   1 0.7777778 1.333333 0.2721655Variable importancetear Node number 1:24 observations, complexity param=0.2222222 Predicted Class=none expected loss=0.375 P (node) =1 class Counts:4 5 probabilities:0.167 0.625 0. 208 left son=2 (OBS) Right son=3 (OBS) Primary splits:tear splits as RL, improve=5.0833330, (0 miss ing) astimatism splits as RL, improve=1.7500000, (0 missing) age splits as RRL, improve=0.2916667, (0 Missing) spectacle splits as RL, improve=0.2500000, (0 missing) Node number 2:12 observations predicted Class=non E expected loss=0 P (node) =0.5 class counts:0 0 probabilities:0.000 1.000 0.000 node number 3:12 o Bservations predicted CLass=soft expected loss=0.5833333 P (node) =0.5 class Counts:4 3 5 probabilities:0.333 0.250 0.417  

Visualization of

> par (XPD = TRUE) > plot (model) > Text (model)

Statistical summarization of algorithm C5.0

Call:c5.0.formula (formula = Recommended ~., data = DF2) C5.0 [Release 2.07 GPL Edition]  Mon Mar 14:47:09------ -------------------------Class specified by attribute ' outcome ' Read cases (5 attributes) from Undefined.datadecision t Ree:tear = Reduced:none (tear) = Normal::...astimatism = No:soft (6/1)    astimatism = Yes:hard (6/2) Evaluation on t Raining data (cases):    decision Tree     ----------------    Size      Errors       3    3 (12.5%)   < <   (a)   (b)   (c)    <-classified as  ----  ----  ----     4                (a): Class hard     2     1    (b): Class none                 5    (c): Class Softattribute Usage:100.00%tear 50% astimatismtime:0.0 secs

It was found that the secretion of lacrimal glands was increased after the doctor's decision was worn.

C50 and machine learning

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.