Package‘FSelector’
August29,2013
Type Package
Title Selecting attributes
Version0.19
Date2013-02-28
Author Piotr Romanski
Maintainer Lars Kotthoff<larsko@4c.ucc.ie>
Description This package provides functions for selecting attributes
from a given dataset.Attribute subset selection is the process
of identifying and removing as much of the irrelevant and redundant information as possible. License GPL-2
Imports randomForest,RWeka,digest
Suggests mlbench,rpart
LazyLoad yes
NeedsCompilation no
Repository CRAN
Date/Publication2013-02-2814:10:21
R topics documented:
FSelector-package (2)
as.simple.formula (3)
best.first.search (3)
cfs (5)
chi.squared (6)
consistency (7)
correlation (8)
cutoff (9)
1
2FSelector-package entropy.based (10)
exhaustive.search (11)
greedy.search (12)
hill.climbing.search (14)
oneR (15)
random.forest.importance (16)
relief (17)
Index19 FSelector-package Package for selecting attributes
Description
Package containing functions for selecting attributes from a given dataset and a destination attribute. Details
Package:FSelector
Type:Package
Version:0.19
Date:2013-02-28
License:GPL
LazyLoad:yes
This package contains:
•-Algorithms forfiltering attributes:cfs,chi.squared,information.gain,gain.ratio,symmetri-
cal.lation,oneR,relief,consistency,random.forest.importance •-Algorithms for wrapping classifiers and search attribute subset space:best.first.search,back-
ward.search,forward.search,hill.climbing.search
•-Algorithm for choosing a subset of attributes based on attributes’weights:cutoff.k,cut-
off.k.percent,cutoff.biggest.diff
•-Algorithm for creating formulas:as.simple.formula
Author(s)
Piotr Romanski
Maintainer:Lars Kotthoff<larsko@4c.ucc.ie>
as.simple.formula3 as.simple.formula Converting to formulas
Description
Converts character vector of atrributes’names and destination attribute’s name to a simple formula. Usage
as.simple.formula(attributes,class)
Arguments
attributes character vector of attributes’names
class name of destination attribute
Value
A simple formula like"class~attr1+attr2"
Author(s)
Piotr Romanski
Examples
data(iris)
result<-cfs(Species~.,iris)
f<-as.simple.formula(result,"Species")
best.first.search Best-first search
Description
The algorithm for searching atrribute subset space.
Usage
best.first.search(attributes,eval.fun,max.backtracks=5)
Arguments
attributes a character vector of all attributes to search in
eval.fun a function taking asfirst parameter a character vector of all attributes and return-ing a numeric indicating how important a given subset is
max.backtracks an integer indicating a maximum allowed number of backtracks,default is5
4best.first.search Details
The algorithm is similar to forward.search besides the fact that is chooses the best node from all already evaluated ones and evaluates it.The selection of the best node is repeated approximately max.brackets times in case no better node found.
Value
A character vector of selected attributes.
Author(s)
Piotr Romanski
See Also
forward.search,backward.search,hill.climbing.search,exhaustive.search
Examples
library(rpart)
data(iris)
evaluator<-function(subset){
#k-fold cross validation
k<-5
splits<-runif(nrow(iris))
results=sapply(1:k,function(i){
test.idx<-(splits>=(i-1)/k)&(splits<i/k)
train.idx<-!test.idx
test<-iris[test.idx,,drop=FALSE]
train<-iris[train.idx,,drop=FALSE]
tree<-rpart(as.simple.formula(subset,"Species"),train)
error.rate=sum(test$Species!=predict(tree,test,type="c"))/nrow(test)
return(1-error.rate)
nodeselector})
print(subset)
print(mean(results))
return(mean(results))
}
subset<-best.first.search(names(iris)[-5],evaluator)
f<-as.simple.formula(subset,"Species")
print(f)
cfs5 cfs CFSfilter
Description
The algorithmfinds attribute subset using correlation and entropy measures for continous and dis-crete data.
Usage
cfs(formula,data)
Arguments
formula a symbolic description of a model
data data to process
Details
The alorithm makes use of best.first.search for searching the attribute subset space.
Value
a character vector containing chosen attributes
Author(s)
Piotr Romanski
See Also
best.first.search
Examples
data(iris)
subset<-cfs(Species~.,iris)
f<-as.simple.formula(subset,"Species")
print(f)
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论