Introduction to the R Language - Functions
The scoping rules for R are the main feature that make it di erent from the original S language The scoping rules determine how a value is associated with a free variable in a function R uses lexical scoping or static scoping A common alternative is dynamic scoping Related to the scoping rules is how R uses the search list to bind a value to
list of some useful R functions - Columbia University
integrate() - adaptive quadrature over a nite or in nite interval 4 Plotting plot() - generic R object plotting par() - set or query graphical parameters
Solutions to Sample Questions 1 R n
3 Suppose that f: R R is a continuous function such that lim x1 f(x) = 0; lim x1 f(x) = 0: (a) Give a precise statement of what these limits mean (b) Prove that fis bounded on R and attains either a maximum or minimum value (c) Give examples to show that fmay: (i) attain its maximum but not its in mum; (ii) attain both its maximum and
Use R to Compute Numerical Integrals
Use R to Compute Numerical Integrals In short, you may use R to nd out a numerical answer to an n-fold integral I To integrate a one-dimensional integral over a nite or in nite interval, use R function integrate For example, nd out ∫ 1 0 1 (x+1) p x dx >## define the integrated function >integrand
Chapter 10 Functions
Example 100 Consider again the function f: R R, f(x) = 4x 1 We want to know whether each element of R has a preimage Yes, it has, let us see why: we want to show that there exists xsuch that f(x) = 4x 1 = y Given y, we have the relation x= (y+ 1)=4 thus this xis indeed sent to y by f Example 101 Consider again the function g: R R, g(x
Package ‘pracma’ - The Comprehensive R Archive Network
Package ‘pracma’ January 23, 2021 Type Package Version 2 3 3 Date 2021-01-22 Title Practical Numerical Math Functions Depends R (>= 3 1 0) Imports graphics, grDevices, stats, utils
Package ‘RWeka’ - The Comprehensive R Archive Network
Title R/Weka Interface Description An R interface to Weka (Version 3 9 3) Weka is a collection of machine learning algorithms for data mining tasks written in Java, containing tools for data pre-processing, classification, regression, clustering, association rules, and visualization Package 'RWeka' contains the interface code, the
Exercices corrigés EXERCICE 2
1- Donner l’expression de la tension v en fonction de E; R0 et R 2- Montrer qu’à l’équilibre du pont ( lorsque v = 0 V ), on a : R = R0 3- En utilisant le tableau caractérisant le capteur résistif, exprimer R en fonction de P Déterminer alors la valeur des résistances réglables R0
Math 1313 Section 15 Linear Cost, Revenue and Profit
The revenue function , R(x), is the total revenue realized from the sale of x units of the product The profit function , P(x), is the total profit realized from the manufacturing and sale of the x units of product Formulas: Suppose a firm has fixed cost of F dollars, production cost of c dollars per unit and selling
[PDF] which dans r
[PDF] opérateur logique r
[PDF] fonction subset r
[PDF] r compter le nombre d'occurence
[PDF] read.table sous r
[PDF] fonction apply r
[PDF] croquis france potentialités et contraintes
[PDF] néon configuration électronique
[PDF] ion carbone formule
[PDF] le territoire français des milieux aménagés des milieux ? ménager
[PDF] ion sulfite
[PDF] exercice enthalpie libre et potentiel chimique
[PDF] palme funeraire
[PDF] ion sodium nombre de charges positives du noyau
Package 'RWeka"
March 7, 2023
Version0.4-46
TitleR/Weka Interface
DescriptionAn R interface to Weka (Version 3.9.3). Weka is a collection of machine learning algorithms for data mining tasks written in Java, containing tools for data pre-processing, classification, regression, clustering, association rules, and visualization. Package "RWeka" contains the interface code, the Weka jar is in a separate package "RWekajars". For more information on Weka seeDependsR (>= 2.6.0)
ImportsRWekajars (>= 3.9.3-1), rJava (>= 0.6-3), graphics, stats, utils, gridSuggestspartykit (>= 0.8.0), mlbench, e1071
SystemRequirementsJava (>= 8)
LicenseGPL-2
NeedsCompilationno
AuthorKurt Hornik [aut, cre] (Christian Buchta [ctb],
Torsten Hothorn [ctb],
Alexandros Karatzoglou [ctb],
David Meyer [ctb],
Achim Zeileis [ctb] (MaintainerKurt Hornik
RepositoryCRAN
Date/Publication2023-03-07 14:18:59 UTC
Rtopics documented:
dot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 evaluate_Weka_classifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 predict_Weka_classifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 predict_Weka_clusterer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1 2dot read.arff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Weka_associators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Weka_attribute_evaluators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Weka_classifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Weka_classifier_functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Weka_classifier_lazy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Weka_classifier_meta . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Weka_classifier_rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Weka_classifier_trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Weka_clusterers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21Weka_control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Weka_converters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Weka_filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Weka_interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Weka_stemmers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Weka_tokenizers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
WOW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
WPM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
write.arff . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Index33dotCreate DOT RepresentationsDescription
Write a DOT language representation of an object for processing via Graphviz. Usage write_to_dot(x, con = stdout(), ...) ## S3 method for class?Weka_classifier? write_to_dot(x, con = stdout(), ...)Arguments
xanRobject. conaconnection for writing the representation to. ...additional arguments to be passed from or to methods. evaluate_Weka_classifier3Details
Graphviz (https://www.graphviz.org) is open source graph visualization software providing several main graph layout programs, of whichdotmakes "hierarchical" or layered drawings of directed graphs, and hence is typically most suitable for visualizing classification trees. Usingdot, therepresentationinfile'foo.dot"canbetransformedtoPostScriptorotherdisplayable graphical formats using (a variant of)dot -Tps foo.dot >foo.ps. Some Weka classifiers (e.g., tree learners such as J48 and M5P) implement a "Drawable" interface providing DOT representations of the fitted models. For such classifiers, thewrite_to_dotmethod writes the representation to the specified connection.evaluate_Weka_classifier Model Statistics for R/Weka ClassifiersDescription Compute model performance statistics for a fitted Weka classifier. Usage evaluate_Weka_classifier(object, newdata = NULL, cost = NULL, numFolds = 0, complexity = FALSE, class = FALSE, seed = NULL, ...)Arguments
objectaWeka_classifierobject. newdataan optional data frame in which to look for variables with which to evaluate. If omitted orNULL, the training instances are used. costa square matrix of (mis)classification costs. numFoldsthe number of folds to use in cross-validation. complexityoption to include entropy-based statistics. classoption to include class statistics. seedoptional seed for cross-validation. ...further arguments passed to other methods (see details).Details
The function computes and extracts a non-redundant set of performance statistics that is suitable for
model interpretation. By default the statistics are computed on the training data. the cost matrix so that the cost of a correct classification is zero. Note that if the class variable is numeric only a subset of the statistics are available. Arguments complexityandclassare then not applicable and therefore ignored.4predict_Weka_classifier
Value An object of classWeka_classifier_evaluation, a list of the following components: stringcharacter, concatenation of the string representations of the performance statis- tics. detailsvector, base statistics, e.g., the percentage of instances correctly classified, etc. detailsComplexity vector, entropy-based statistics (if selected). detailsClassmatrix, class statistics, e.g., the true positive rate, etc., for each level of the response variable (if selected). confusionMatrix table, cross-classification of true and predicted classes.References
I. H. Witten and E. Frank (2005).Data Mining: Practical Machine Learning Tools and Techniques.2nd Edition, Morgan Kaufmann, San Francisco.
Examples
## Use some example data. w <- read.arff(system.file("arff","weather.nominal.arff", package = "RWeka")) ## Identify a decision tree. m <- J48(play~., data = w) m ## Use 10 fold cross-validation. e <- evaluate_Weka_classifier(m, cost = matrix(c(0,2,1,0), ncol = 2), numFolds = 10, complexity = TRUE, seed = 123, class = TRUE) e summary(e) e$detailspredict_Weka_classifier Model Predictions for R/Weka ClassifiersDescription Predicted values based on fitted Weka classifier models. predict_Weka_clusterer5 Usage ## S3 method for class?Weka_classifier? predict(object, newdata = NULL, type = c("class", "probability"), ...)Arguments
objectan object of class inheriting fromWeka_classifier. newdataan optional data frame in which to look for variables with which to predict. If omitted orNULL, the training instances are used. typecharacter string determining whether classes should be predicted (numeric for regression, factor for classification) or class probabilities (only available for classification). May be abbreviated. ...further arguments passed to or from other methods. ValueEither a vector with classes or a matrix with the posterior class probabilities, with rows correspond-
ing to instances and columns to classes.predict_Weka_clusterer Class Predictions for R/Weka ClusterersDescription Predict class ids or memberships based on fitted Weka clusterers. Usage ## S3 method for class?Weka_clusterer? predict(object, newdata = NULL, type = c("class_ids", "memberships"), ...)Arguments
objectan object of class inheriting fromWeka_clusterer. newdataan optional data set for predictions are sought. This must be given for predict- ing class memberships. If omitted orNULL, the training instances are used for predicting class ids. typea character string indicating whether class ids or memberships should be re- turned. May be abbreviated. ...further arguments passed to or from other methods.6read.arff
Details
method.read.arffRead Data from ARFF FilesDescription Reads data from Weka Attribute-Relation File Format (ARFF) files. Usage read.arff(file)Arguments
filea character string with the name of theARFFfile to read from, or aconnection which will be opened if necessary, and if so closed at the end of the function call. Value A data frame containing the data from theARFFfile.References
arff/See Also
write.arffExamples
read.arff(system.file("arff", "contact-lenses.arff", package = "RWeka")) Weka_associators7Weka_associatorsR/Weka AssociatorsDescription R interfaces to Weka association rule learning algorithms. UsageApriori(x, control = NULL)
Tertius(x, control = NULL)
Arguments
xan R object with the data to be associated. controlan object of classWeka_control, or a character vector of control options, or NULL(default). Available options can be obtained on-line using the Weka OptionWizardWOW, or the Weka documentation.
Details
Aprioriimplements an Apriori-type algorithm, which iteratively reduces the minimum support until it finds the required number of rules with the given minimum confidence.Tertiusimplements a Tertius-type algorithm.
See the references for more information on these algorithms. Value A list inheriting from classWeka_associatorswith components including associatora reference (of classjobjRef) to a Java object obtained by applying the Weka buildAssociationsmethod to the training instances using the given control options. Note Tertiusrequires Weka packagetertiusto be installed.References
R. Agrawal and R. Srikant (1994). Fast algorithms for mining association rules in large databases. Proceedings of the International Conference on Very Large Databases, 478-499. Santiago, Chile:Morgan Kaufmann, Los Altos, CA.
P. A. Flach and N. Lachiche (1999). Confirmation-guided discovery of first-order rules with Tertius. Machine Learning,42, 61-95.doi:10.1023/A:1007656703224 . I. H. Witten and E. Frank (2005).Data Mining: Practical Machine Learning Tools and Techniques.2nd Edition, Morgan Kaufmann, San Francisco.
8Weka_attribute_evaluators
Examples
x <- read.arff(system.file("arff", "contact-lenses.arff", package = "RWeka")) ## Apriori with defaults.Apriori(x)
## Some options: set required number of rules to 20.Apriori(x, Weka_control(N = 20))
## Not run: ## Requires Weka package?tertius?to be installed. ## Tertius with defaults.Tertius(x)
## Some options: only classification rules (single item in the RHS).Tertius(x, Weka_control(S = TRUE))
## End(Not run)Weka_attribute_evaluatorsR/Weka Attribute EvaluatorsDescription
R interfaces to Weka attribute evaluators.
Usage GainRatioAttributeEval(formula, data, subset, na.action, control = NULL) InfoGainAttributeEval(formula, data, subset, na.action, control = NULL)Arguments
formulaa symbolic description of a model. Note that for unsupervised filters the re- sponse can be omitted. dataan optional data frame containing the variables in the model. subsetan optional vector specifying a subset of observations to be used in the fitting process. na.actiona function which indicates what should happen when the data containNAs. See model.framefor details. controlan object of classWeka_control, or a character vector of control options, or NULL(default). Available options can be obtained on-line using the Weka OptionWizardWOW, or the Weka documentation.
Weka_classifiers9
Details
GainRatioAttributeEvalevaluates the worth of an attribute by measuring the gain ratio with respect to the class. InfoGainAttributeEvalevaluates the worth of an attribute by measuring the information gain with respect to the class.Currently, only interfaces to classes which evaluate single attributes (as opposed to subsets, techni-
cally, which implement the Weka AttributeEvaluator interface) are possible. Value A numeric vector with the figures of merit for the attributes specified by the right hand side of formula.Examples
InfoGainAttributeEval(Species ~ . , data = iris)Weka_classifiersR/Weka ClassifiersDescriptionR interfaces to Weka classifiers.
Details
Supervised learners, i.e., algorithms for classification and regression, are termed "classifiers" by Weka. (Numeric prediction, i.e., regression, is interpreted as prediction of a continuous class.) R interface functions to Weka classifiers are created bymake_Weka_classifier, and have formals formula,data,subset,na.action, andcontrol(default: none), where the first four have the "usual" meanings for statistical modeling functions in R, and the last again specifies the control options to be employed by the Weka learner.By default, the model formulae should only use the '+" and '-" operators to indicate the variables to
be included or not used, respectively.