This is a great tool for machine learning with R.
Install the shadow () 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 rattle, shake, or roll your data.Copy the code
You are too naughty 😁
Run the shadow ()
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_packagesCopy the code
Install GTK +
Start the rattle() again
> 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: can't find the specified module.Copy the code
I don’t have GTK installed on my machine, but don’t bother. Rattle spotted the problem and asked me directly if I had GTK+ installed
To tell the truth, R package management system is really easy. What do you need? Just make it up when you need it.
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: Always open the 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: can't find the specified module. 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: 'Server returned 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)Copy the code
Alas, the server relation with this kind of foreigner is not quite good as before. I download the installation package from http://ftp.gnome.org/pub/gnome/binaries/win64/gtk+/2.22/gtk+-bundle2.22.1-20101229win64.zip, Unzip the error message in E:R-3.6.2libraryRGtk2gtkx64 folder.
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 existsCopy the code
Start the shadow
> rattle()
Loading required package: RGtk2Copy the code
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"))Copy the code
Start the shadow
> library(rattle)
> rattle()Copy the code
- The Data page
- Select the data source: R Dataset
- Data Name select Diabetes dataset
- Check Partition, the proportion of training set, verification set and test set is 70%, 15% and 15% as default, random seed 42
- Execute button
The results of
Change Partition, training set, validation set and test set proportion according to default 70%, 30% and 0%, random seed 42. Execute button
- Point Model page
- Type Tree Decision Tree
- Selected Conditional
- Execute button
The results are as follows
No result because an error was reported…
Install multcomp package
The system reported an error saying that multcomp was missing
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'Copy the code
I didn’t think it was hard, so I just installed it
> 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 the packages: Always open the 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", ...) Warning: always open the URL 'https://mirrors.tongji.edu.cn/CRAN/src/contrib/multcomp_1.4-12.tar.gz' in the packages: Download of Package 'Multcomp' failedCopy the code
Surprisingly, tongji University does not have this package in its mirror image…
Enter from RGui, install directly, choose Lanzhou ramen mirror. Hold on. Done.
> install. Packages ("multcomp") -- use CRAN mirrors during this connection phase -- Try to open the URL 'https://mirror.lzu.edu.cn/CRAN/bin/windows/contrib/3.6/multcomp_1.4-12.zip' Content type 'application/zip' length 736891 bytes (719 KB) The 719 KB program package 'Multcomp' downloaded has been opened successfully. MD5 and check are also available via downloaded binary packages in C:\Users\chang\AppData\Local\Temp\RtmpOUfyRk\downloaded_packagesCopy the code
Decision tree – Conditional inference tree
Adjust the parameters and run the variant conditional inference tree of the decision tree again
Run smoothly
It worked out pretty well
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 shadow timestamp: 2020-02-02 17:20:50 chang ======================================================================Copy the code
Dot plot button
It’s not as pretty as a direct drawing, but it’s not ugly either
The next step is to look at the reviews page
Thanks for reading, welcome to follow and leave a comment
Quantitative investment and futures of foreign exchange, fund insurance level is also taken out