[Subgroup-commits] r12 - in pkg: . R man tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Aug 2 00:43:07 CEST 2014
Author: atzmueller
Date: 2014-08-02 00:43:07 +0200 (Sat, 02 Aug 2014)
New Revision: 12
Added:
pkg/man/subgroup-package.Rd
Removed:
pkg/man/subgroup-package.Rd
Modified:
pkg/DESCRIPTION
pkg/R/AAAonLoad.R
pkg/R/classes.R
pkg/R/subgroup.R
pkg/man/DiscoverSubgroups.Rd
pkg/man/DiscoverSubgroupsByTask.Rd
pkg/tests/test.R
Log:
* new option convert.df for DiscoverSubgorups and DiscoverSubgroupsByTask
* updated notices
Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION 2014-07-14 12:27:43 UTC (rev 11)
+++ pkg/DESCRIPTION 2014-08-01 22:43:07 UTC (rev 12)
@@ -1,12 +1,12 @@
Package: subgroup
Type: Package
-Title: Subgroup Discovery and Analysis
-Version: 0.3
-Date: 2014-07-11
+Title: Subgroup Discovery
+Version: 0.4
+Date: 2014-08-01
Author: Martin Atzmueller
Maintainer: Martin Atzmueller <martin at atzmueller.net>
Description: A collection of efficient and effective tools and
- algorithms for subgroup discovery and analysis. The package
+ algorithms for subgroup discovery and analytics. The package
integrates an R interface to the org.vikamine.kernel library
of the VIKAMINE system (http://www.vikamine.org) implementing
subgroup discovery, pattern mining and analytics in Java.
Modified: pkg/R/AAAonLoad.R
===================================================================
--- pkg/R/AAAonLoad.R 2014-07-14 12:27:43 UTC (rev 11)
+++ pkg/R/AAAonLoad.R 2014-08-01 22:43:07 UTC (rev 12)
@@ -1,8 +1,8 @@
###############################################################################
-# Subgroup package R classes
+# subgroup package R classes
#
# This file is part of the R subgroup package.
-# Copyright (C) 2011-2012 by Martin Atzmueller
+# Copyright (C) 2011-2014 by Martin Atzmueller
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Modified: pkg/R/classes.R
===================================================================
--- pkg/R/classes.R 2014-07-14 12:27:43 UTC (rev 11)
+++ pkg/R/classes.R 2014-08-01 22:43:07 UTC (rev 12)
@@ -1,8 +1,8 @@
###############################################################################
-# Subgroup package R classes
+# subgroup package R classes
#
# This file is part of the R subgroup package.
-# Copyright (C) 2011-2012 by Martin Atzmueller
+# Copyright (C) 2011-2014 by Martin Atzmueller
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Modified: pkg/R/subgroup.R
===================================================================
--- pkg/R/subgroup.R 2014-07-14 12:27:43 UTC (rev 11)
+++ pkg/R/subgroup.R 2014-08-01 22:43:07 UTC (rev 12)
@@ -1,8 +1,8 @@
###############################################################################
-# Subgroup package R core support code
+# subgroup package R classes
#
# This file is part of the R subgroup package.
-# Copyright (C) 2011-2012 by Martin Atzmueller
+# Copyright (C) 2011-2014 by Martin Atzmueller
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -31,13 +31,14 @@
setMethod("CreateARFFProvider", signature(source = "data.frame", name = "character"),
function(source, name, ...) {
- # Creates a dataset provider (converting the dataframe)
+ # Creates a dataset provider (converting the dataframe)
con <- textConnection("arffVector", "w")
write.arff(source, con)
flush(con)
close(con)
+ rm(con)
arff <- paste(arffVector, "", collapse="\n")
- provider <- .jnew("org/vikamine/kernel/xpdl/ARFFAsStringDatasetProvider", arff, name)
+ provider <- .jnew("org/vikamine/kernel/xpdl/ARFFAsStringDatasetProvider", arff, name)
return(provider)
}
)
@@ -52,12 +53,13 @@
CreateOntologyForData <- function(provider, dataset) {
# Creates the ontology object for the respective dataset
- ontology <- J(provider, "getDataset", dataset)
+ ontology <- .jcall(provider, "Lorg/vikamine/kernel/data/Ontology;","getDataset", dataset)
return(ontology)
}
CreateSimpleSDTask <- function(ontology, target) {
# Creates a simple subgroup discovery task
+ 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)
@@ -80,6 +82,7 @@
#
# Returns:
# A subgroup discovery task
+ freeMemory()
provider <- CreateARFFProvider(source, "data")
ontology <- CreateOntologyForData(provider, "data")
task <- CreateSimpleSDTask(ontology, target)
@@ -148,14 +151,14 @@
return(as.character(sgSelectorArray))
}
-DiscoverSubgroupsByTask <- function(task) {
+DiscoverSubgroupsByTask <- function(task, convert.df=FALSE) {
# Internal function for setting up and performing subgroup discovery
# Args:
# task: A subgroup discovery task
#
# Returns:
# A list of subgroup patterns
- sgSet <- J(task, "performSubgroupDiscovery")
+ sgSet <- J(task, "performsubgroup")
sgList <- J(sgSet, "toSortedList", FALSE)
sgArray <- .jevalArray(J(sgList, "toArray"))
@@ -171,10 +174,15 @@
patterns = append(patterns, pattern)
}
- return(patterns)
+ if (convert.df) {
+ dataFrameRules <- ToDataFrame(patterns)
+ return(dataFrameRules)
+ } else {
+ return(patterns)
+ }
}
-DiscoverSubgroups <- function(source, target, config=new("SDTaskConfig")) {
+DiscoverSubgroups <- function(source, target, config=new("SDTaskConfig", convert.df=FALSE)) {
# Performs subgroup discovery according to target and config on data
#
# Args:
@@ -185,7 +193,7 @@
# Returns:
# A list of subgroup patterns
task <- CreateSDTask(source, target, config)
- result <- DiscoverSubgroupsByTask(task)
+ result <- DiscoverSubgroupsByTask(task, convert.df)
return(result)
}
@@ -247,4 +255,12 @@
description=as.vector(descriptions, "character"))
}
return(dataframe)
+}
+
+freeMemory <- function(...) {
+ # Call the R garbage collection
+ # Then call Java garbage collection
+ gc(...)
+ .jcall("java/lang/System", method = "gc")
+ invisible()
}
\ No newline at end of file
Modified: pkg/man/DiscoverSubgroups.Rd
===================================================================
--- pkg/man/DiscoverSubgroups.Rd 2014-07-14 12:27:43 UTC (rev 11)
+++ pkg/man/DiscoverSubgroups.Rd 2014-08-01 22:43:07 UTC (rev 12)
@@ -6,7 +6,7 @@
the configuration on the data.
}
\usage{
-DiscoverSubgroups(source, target, config=new("SDTaskConfig"))
+DiscoverSubgroups(source, target, config=new("SDTaskConfig"), convert.df=FALSE)
}
\arguments{
\item{source}{a data.frame or the a character string giving
@@ -15,6 +15,8 @@
to consider for subgroup discovery.}
\item{config}{an instance of SDTaskConfig providing various
parameters for subgroup discovery.}
+\item{convert.df}{TRUE, if the result patterns should be converted
+to a data.frame using \code{\link{ToDataFrame}}}
}
\seealso{
\code{\link{DiscoverSubgroupsByTask}}.
Modified: pkg/man/DiscoverSubgroupsByTask.Rd
===================================================================
--- pkg/man/DiscoverSubgroupsByTask.Rd 2014-07-14 12:27:43 UTC (rev 11)
+++ pkg/man/DiscoverSubgroupsByTask.Rd 2014-08-01 22:43:07 UTC (rev 12)
@@ -5,11 +5,13 @@
Performs subgroup discovery according to the given task.
}
\usage{
-DiscoverSubgroupsByTask(task)
+DiscoverSubgroupsByTask(task, convert.df=FALSE)
}
\arguments{
\item{task}{a subgroup discovery task constructed by
CreateSDTask.}
+ \item{convert.df}{TRUE, if the result patterns should be converted
+to a data.frame using \code{\link{ToDataFrame}}}
}
\seealso{
\code{\link{DiscoverSubgroups}}.
Deleted: pkg/man/subgroup-package.Rd
===================================================================
--- pkg/man/subgroup-package.Rd 2014-07-14 12:27:43 UTC (rev 11)
+++ pkg/man/subgroup-package.Rd 2014-08-01 22:43:07 UTC (rev 12)
@@ -1,35 +0,0 @@
-\name{subgroup}
-\alias{subgroup}
-\docType{package}
-\title{
-Subgroup Package
- - Algorithms and Tools for Efficient Subgroup Discovery
-}
-\description{
-The subgroup package contains a set of efficient and effective
- tools and algorithms for subgroup discovery.
-}
-\details{
-\tabular{ll}{
-Package: \tab subgroup\cr
-Type: \tab Package\cr
-Version: \tab 0.3\cr
-Date: \tab 2014-07-14\cr
-License: \tab GPL (>= 3)\cr
-LazyLoad: \tab yes\cr
-}
-}
-\author{
-Martin Atzmueller
-
-Maintainer: Martin Atzmueller <martin at atzmueller.net>
-}
-\references{
- \enumerate{
- \item Martin Atzmueller and Frank Puppe. SD-Map - A Fast Algorithm for Exhaustive Subgroup Discovery. Knowledge Discovery in Databases: PKDD 2006, LNAI 4213, pp. 6-17, Springer Verlag, 2006.
- \item Martin Atzmueller and Florian Lemmerich. Fast Subgroup Discovery for Continuous Target Concepts. In: Foundations of Intelligent Systems, LNCS 5722, pp. 35-44, Springer Verlag, 2009.
- \item Florian Lemmerich and Mathias Rohlfs and Martin Atzmueller. Fast Discovery of Relevant Subgroup Patterns. In: Proc. 23rd FLAIRS Conference, AAAI Press, 2010.
- }
-}
-\keyword{ package }
-
Added: pkg/man/subgroup-package.Rd
===================================================================
--- pkg/man/subgroup-package.Rd (rev 0)
+++ pkg/man/subgroup-package.Rd 2014-08-01 22:43:07 UTC (rev 12)
@@ -0,0 +1,35 @@
+\name{subgroup}
+\alias{subgroup}
+\docType{package}
+\title{
+subgroup Package
+ - Algorithms and Tools for Efficient Subgroup Discovery and Analytics
+}
+\description{
+The subgroup package contains a set of efficient and effective
+ tools and algorithms for subgroup discovery and analytics.
+}
+\details{
+\tabular{ll}{
+Package: \tab subgroup\cr
+Type: \tab Package\cr
+Version: \tab 0.4\cr
+Date: \tab 2014-08-01\cr
+License: \tab GPL (>= 3)\cr
+LazyLoad: \tab yes\cr
+}
+}
+\author{
+Martin Atzmueller
+
+Maintainer: Martin Atzmueller <martin at atzmueller.net>
+}
+\references{
+ \enumerate{
+ \item Martin Atzmueller and Frank Puppe. SD-Map - A Fast Algorithm for Exhaustive Subgroup Discovery. Knowledge Discovery in Databases: PKDD 2006, LNAI 4213, pp. 6-17, Springer Verlag, 2006.
+ \item Martin Atzmueller and Florian Lemmerich. Fast Subgroup Discovery for Continuous Target Concepts. In: Foundations of Intelligent Systems, LNCS 5722, pp. 35-44, Springer Verlag, 2009.
+ \item Florian Lemmerich and Mathias Rohlfs and Martin Atzmueller. Fast Discovery of Relevant Subgroup Patterns. In: Proc. 23rd FLAIRS Conference, AAAI Press, 2010.
+ }
+}
+\keyword{ package }
+
Modified: pkg/tests/test.R
===================================================================
--- pkg/tests/test.R 2014-07-14 12:27:43 UTC (rev 11)
+++ pkg/tests/test.R 2014-08-01 22:43:07 UTC (rev 12)
@@ -1,3 +1,25 @@
+###############################################################################
+# subgroup package R classes
+#
+# This file is part of the R subgroup package.
+# Copyright (C) 2011-2014 by Martin Atzmueller
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Contact: Martin Atzmueller (martin at atzmueller.net)
+###############################################################################
+
library(subgroup)
data(credit.data)
More information about the Subgroup-commits
mailing list