[Subgroup-commits] r15 - in pkg: . R man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Aug 2 21:21:39 CEST 2014


Author: atzmueller
Date: 2014-08-02 21:21:38 +0200 (Sat, 02 Aug 2014)
New Revision: 15

Added:
   pkg/man/Pattern-class.Rd
   pkg/man/credit.data.Rd
Modified:
   pkg/NAMESPACE
   pkg/R/classes.R
   pkg/R/subgroup.R
Log:
* improve documentation
* fix visibility (internal functions), cf. bug #5827

Modified: pkg/NAMESPACE
===================================================================
--- pkg/NAMESPACE	2014-08-02 06:51:24 UTC (rev 14)
+++ pkg/NAMESPACE	2014-08-02 19:21:38 UTC (rev 15)
@@ -1 +1 @@
-exportPattern(".")
\ No newline at end of file
+exportPattern("^[^\\.]")
\ No newline at end of file

Modified: pkg/R/classes.R
===================================================================
--- pkg/R/classes.R	2014-08-02 06:51:24 UTC (rev 14)
+++ pkg/R/classes.R	2014-08-02 19:21:38 UTC (rev 15)
@@ -20,15 +20,7 @@
 #    Contact: Martin Atzmueller (martin at atzmueller.net)
 ###############################################################################
 
-setClass("SDOptions",
-    representation(
-        verbose = "logical",
-        debug = "logical"
-    ),
-    prototype(verbose = FALSE, debug = FALSE)
-)
 
-
 setClass("SDTaskConfig",
     representation(
         qf          = "character",

Modified: pkg/R/subgroup.R
===================================================================
--- pkg/R/subgroup.R	2014-08-02 06:51:24 UTC (rev 14)
+++ pkg/R/subgroup.R	2014-08-02 19:21:38 UTC (rev 15)
@@ -23,13 +23,13 @@
 library(foreign)
 library(rJava)
 
-setGeneric("CreateARFFProvider",
+setGeneric(".CreateARFFProvider",
     function(source, name, ...) {
-      standardGeneric("CreateARFFProvider")
+      standardGeneric(".CreateARFFProvider")
     }
 )
 
-setMethod("CreateARFFProvider", signature(source = "data.frame", name = "character"),
+setMethod(".CreateARFFProvider", signature(source = "data.frame", name = "character"),
     function(source, name, ...) {
       # Creates a dataset provider (converting the dataframe)
       con <- textConnection("arffVector", "w")
@@ -43,7 +43,7 @@
     }
 )
 
-setMethod("CreateARFFProvider", signature(source = "character", name = "character"),
+setMethod(".CreateARFFProvider", signature(source = "character", name = "character"),
     function(source, name, ...) {
       # Creates a dataset provider given a file name
       provider <- .jnew("org/vikamine/kernel/xpdl/FileDatasetProvider", source)
@@ -51,15 +51,15 @@
     }
 )
 
-CreateOntologyForData <- function(provider, dataset) {
+.CreateOntologyForData <- function(provider, dataset) {
   # Creates the ontology object for the respective dataset
   ontology <- .jcall(provider, "Lorg/vikamine/kernel/data/Ontology;","getDataset", dataset)
   return(ontology)
 }
 
-CreateSimpleSDTask <- function(ontology, target) {
+.CreateSimpleSDTask <- function(ontology, target) {
   # Creates a simple subgroup discovery task
-  freeMemory()
+  .FreeMemory()
   simpleTask <- new(J("org/vikamine/kernel/subgroup/search/SDSimpleTask"), ontology)
   if (!is.null(target$value)) {
     selector <- new(J("org/vikamine/kernel/subgroup/selectors/DefaultSGSelector"), ontology, target$attribute, target$value)
@@ -82,10 +82,10 @@
   #
   # Returns:
   #   A subgroup discovery task
-  freeMemory()
-  provider <- CreateARFFProvider(source, "data")
-  ontology <- CreateOntologyForData(provider, "data")
-  task <- CreateSimpleSDTask(ontology, target)
+  .FreeMemory()
+  provider <- .CreateARFFProvider(source, "data")
+  ontology <- .CreateOntologyForData(provider, "data")
+  task <- .CreateSimpleSDTask(ontology, target)
   J(task, "setQualityFunction", config at qf)
   J(task, "setSDMethod", config at method)
   J(task, "setMaxSGCount", as.integer(config at k))
@@ -120,7 +120,7 @@
     return(NULL)
 }
 
-GetParameters <- function(task, sg) {
+.GetParameters <- function(task, sg) {
   target <- J(task, "getTarget")
   if (J(target, "isBoolean")) {
     size <- J(J(sg, "getStatistics"), "getSubgroupSize")
@@ -137,7 +137,7 @@
   }
 }
 
-ConvertDescription <- function(sgDescription) {
+.ConvertDescription <- function(sgDescription) {
   # Internal function for converting a (Java) SGDescription consisting
   # of a set of selection expressions into a character vector of strings
   # representing these
@@ -166,10 +166,10 @@
   for (sg in sgArray) {
     #description <- as.character(J(J(sg, "getSGDescription"), "getDescription"))
     sgDescription <- J(sg, "getSGDescription")
-    description <- ConvertDescription(sgDescription)
+    description <- .ConvertDescription(sgDescription)
     quality <- J(sg, "getQuality")
     size <- J(J(sg, "getStatistics"), "getSubgroupSize")
-    parameters = GetParameters(task, sg)    
+    parameters = .GetParameters(task, sg)    
     pattern <- new("Pattern", description=description, quality=quality, size=size, parameters=parameters)
     patterns = append(patterns, pattern)
   }
@@ -198,7 +198,7 @@
 }
 
 
-FormatDoubleSignificantDigits <- function(double, ndigits=2) {
+.FormatDoubleSignificantDigits <- function(double, ndigits=2) {
   # Internal function: Prints double according to
   if (is.numeric(ndigits)) {
     sprintf(paste("%.", ndigits, "f", sep=""), double)
@@ -230,13 +230,13 @@
   i = 1
   for (pattern in patterns) {
     descriptions[i] = paste(pattern at description, collapse=", ")
-    qualities[i] = FormatDoubleSignificantDigits(pattern at quality, ndigits)
+    qualities[i] = .FormatDoubleSignificantDigits(pattern at quality, ndigits)
     sizes[i] = pattern at size
     if (!is.null(pattern at parameters$mean)) {
-      ps[i] = FormatDoubleSignificantDigits(pattern at parameters$mean, ndigits)
+      ps[i] = .FormatDoubleSignificantDigits(pattern at parameters$mean, ndigits)
       isNumeric = TRUE
     } else {
-      ps[i] = FormatDoubleSignificantDigits(pattern at parameters$p, ndigits)
+      ps[i] = .FormatDoubleSignificantDigits(pattern at parameters$p, ndigits)
       isNumeric = FALSE
     }
     i = i + 1
@@ -257,7 +257,7 @@
   return(dataframe)
 }
 
-freeMemory <- function(...) {
+.FreeMemory <- function(...) {
   # Call the R garbage collection
   # Then call Java garbage collection
   gc(...)

Added: pkg/man/Pattern-class.Rd
===================================================================
--- pkg/man/Pattern-class.Rd	                        (rev 0)
+++ pkg/man/Pattern-class.Rd	2014-08-02 19:21:38 UTC (rev 15)
@@ -0,0 +1,34 @@
+\name{Pattern-class}
+\docType{class}
+\alias{Pattern-class}
+\alias{Pattern}
+
+\title{Class ``Pattern'' --- A Simple Subgroup Description Container}   
+\description{A Simple Container holding the results (subgroups, description and
+    parameters) for the Subgroup and Pattern Mining Algorithms}
+
+\section{Objects from the Class}{
+  Objects are created by calls of the form
+  \code{new("Pattern", ...)}.
+}
+
+\section{Slots}{
+  \describe{
+    \item{\code{description}:}{The subgroup description,
+    as a character vector.
+    }
+    \item{\code{quality}:}{The numeric value denoting the
+    quality of the subgroup pattern as determined by the applied
+    quality function.
+    }
+    \item{\code{size}:}{The size of the subgroup.}
+    \item{\code{parameters}}{Additional quality parameters of the subgroup.}
+    }
+ }
+\seealso{
+\code{\link{DiscoverSubgroups}}.
+\code{\link{DiscoverSubgroupsByTask}}
+\code{\link{CreateSDTask}}
+}
+  
+\keyword{classes}

Added: pkg/man/credit.data.Rd
===================================================================
--- pkg/man/credit.data.Rd	                        (rev 0)
+++ pkg/man/credit.data.Rd	2014-08-02 19:21:38 UTC (rev 15)
@@ -0,0 +1,11 @@
+\name{credit.data}
+\docType{data}
+\alias{credit}
+\title{Statlog (German Credit Data) Data Set}
+\description{
+  This dataset classifies people described by a set of attributes as good or bad credit risks.
+}
+\usage{credit.data}
+\format{A vector containing 1000 observations.}
+\source{UCI Repository, https://archive.ics.uci.edu/ml/datasets/Statlog+(German+Credit+Data).}
+\keyword{datasets}
\ No newline at end of file



More information about the Subgroup-commits mailing list