This is a good tool for R to play machine learning.
Install the rattle() package
> install.packages("rattle") > library(rattle) Rattle: A free graphical interface for data science with R. XXXX 5.3.0 Copyright (c) 2006-2018 Togaware Pty Ltd. //Type 'rattle()' to flick, wiggle, and tumble your data.
Rattler, you're too naughty
Run rattle()
Install RGtk2 package
> rattle() Error in rattle() : The RGtk2 package is not available but is required. Please install the package using, for example: install.packages("RGtk2") > install.packages(RGtk2) Error in install.packages : object 'RGtk2' not found > install.packages("RGtk2") trying URL 'https://mirrors.tongji.edu.cn/CRAN/bin/windows/contrib/3.6/RGtk2_2.20.36.zip' Content type 'application/zip' length 16558916 bytes (15.8 MB) downloaded 15.8 MB package 'RGtk2' successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\chang\AppData\Local\Temp\RtmpGibdaw\downloaded_packages
Install GTK+
Restart rattle()
> rattle() Loading required package: RGtk2 Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'E:/R-3.6.2/library/RGtk2/libs/x64/RGtk2.dll': LoadLibrary failure: The specified module could not be found.
I don't have a GTK in my machine, but don't worry. Rattle found this problem and asked me directly whether to install GTK+
To be honest, R package management system is really easy. If you need anything, just install it now.
trying URL 'http://ftp.gnome.org/pub/gnome/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip' Error: package or namespace load failed for 'RGtk2': .onLoad failed in loadNamespace() for 'RGtk2', details: call: download.file(dep_url, path, mode = "wb") error: cannot open URL 'http://ftp.gnome.org/pub/gnome/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip' Error in inDL(x, as.logical(local), as.logical(now), ...) : unable to load shared object 'E:/R-3.6.2/library/RGtk2/libs/x64/RGtk2.dll': LoadLibrary failure: The specified module could not be found. In addition: Warning messages: 1: Failed to load RGtk2 dynamic library, attempting to install it. 2: In download.file(dep_url, path, mode = "wb") : InternetOpenUrl failed: 'The server returned an invalid or unrecognized response' trying URL 'http://ftp.gnome.org/pub/gnome/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip' Content type 'application/zip' length 25830230 bytes (24.6 MB)
Alas, the server relationship with such foreigners is still not very good. I myself http://ftp.gnome.org/pub/gnome/binaries/win64/gtk+/2.22/gtk+-bundle_2.22.1-20101229_win64.zip Download the installation package and extract it into the E:\R-3.6.2\library\RGtk2\gtk\x64 folder in the error message.
In addition: Warning messages: 1: Failed to load RGtk2 dynamic library, attempting to install it. 2: In download.file(dep_url, path, mode = "wb") : downloaded length 24694784 != reported length 25830230 3: In dir.create(gtk_path, recursive = TRUE) : 'E:\R-3.6.2\library\RGtk2\gtk\x64' already exists 4: In unzip(path, exdir = gtk_path) : error 1 in extracting from zip file 5: In dir.create(config_path, recursive = TRUE) : 'E:\R-3.6.2\library\RGtk2\gtk\x64\etc\gtk-2.0' already exists
Start rattle
> rattle() Loading required package: RGtk2
Successful installation
Data mining with rattle
Load case data Indian diabetes data
> diabetes <- read.table(file="pima-indians-diabetes.data", sep="\t", header=FALSE) > names(diabetes) <-c("npregant","plasma","bp","triceps","insulin","bmi","pedigree","age","class") > diabetes$class <- factor(diabetes$class,levels = c(0,1),labels = c("normal","diabetic"))
Start rattle
> library(rattle) > rattle()
- Data page
- Select data source: R Dataset
- Data Name select diameter data set
- Check Partition, the proportion of training set, verification set and test set is 70%, 15% and 15% by default, random seed 42
- Execution button
Result
Changing the Partition, the ratio of training set, verification set and test set is 70%, 30% and 0% by default, random seed 42. Execution button
- Point Model page
- Type selection Tree decision Tree
- Select Conditional
- Execution button
give the result as follows
No result, because the wrong report
Install the multcomp package
The system reports an error, but it says that there is less package of multcomp
Error: package or namespace load failed for 'party' in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called 'multcomp'
I didn't find it difficult to install it directly
> install.packages("multcomp") There is a binary version available but the source version is later: binary source needs_compilation multcomp 1.4-11 1.4-12 FALSE installing the source package 'multcomp' trying URL 'https://mirrors.tongji.edu.cn/CRAN/src/contrib/multcomp_1.4-12.tar.gz' Warning in install.packages : cannot open URL 'https://mirrors.tongji.edu.cn/CRAN/src/contrib/multcomp_1.4-12.tar.gz': HTTP status was '404 Not Found' Error in download.file(url, destfile, method, mode = "wb", ...) : cannot open URL 'https://mirrors.tongji.edu.cn/CRAN/src/contrib/multcomp_1.4-12.tar.gz' Warning in install.packages : download of package 'multcomp' failed
There is no such bag in the image of Tongji University
Enter from RGui, install directly, and select Lanzhou Ramen image. Wait a minute. It's done.
> install.packages("multcomp") ---Please use CRAN's mirror at this connection stage--- Try opening URL 'https://mirror.lzu.edu.cn/crane/bin/windows/contrib/3.6/multcomp_.4-12. Zip' Content type 'application/zip' length 736891 bytes (719 KB) downloaded 719 KB Package 'multcomp' opened successfully, MD5 and check passed The downloaded binary package is located in C: In \ users \ change \ appdata \ local \ temp \ rtmpoufyrk \ downloaded \ packages
Decision tree conditional inference tree
Adjust the parameters and run the variant conditional inference tree of the decision tree again
Smooth operation
It turned out pretty good
Summary of the Conditional Tree model for XXXX (built using 'ctree'): Conditional inference tree with 6 terminal nodes Response: class Inputs: npregant, plasma, bp, triceps, insulin, bmi, pedigree, age Number of observations: 537 1) plasma <= 127; criterion = 1, statistic = 122.668 2) age <= 28; criterion = 1, statistic = 19.178 3) pedigree <= 0.493; criterion = 0.984, statistic = 9.494 4)* weights = 128 3) pedigree > 0.493 5)* weights = 60 2) age > 28 6)* weights = 148 1) plasma > 127 7) plasma <= 165; criterion = 1, statistic = 20.664 8) bmi <= 29.9; criterion = 0.999, statistic = 14.334 9)* weights = 55 8) bmi > 29.9 10)* weights = 91 7) plasma > 165 11)* weights = 55 Time taken: 0.03 secs Rattle timestamp: 2020-02-02 17:20:50 chang ======================================================================
Click the draw button
It's not directly drawn, but it's not ugly
The next step is to take a look at the evaluation page
>Thank you for reading. Welcome to pay attention and leave a message >Quantitative investment and foreign exchange of futures, and the level of fund insurance