Skip to content

Commit

Permalink
Fixes #574 and other CRAN submission issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kudkudak committed Sep 27, 2015
1 parent 29622e4 commit 1277546
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 9 deletions.
7 changes: 3 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
Package: gmum.r
Version: 0.2
Date: 2015-08-05
Date: 2015-09-25
Title: Efficient C++ Implementations of SVM, GNG and CEC Models
Type: Package
Author: Wojciech Czarnecki, Stanislaw Jastrzebski, Marcin Data, Igor Sieradzki, Mateusz Bruno-Kaminski, Karol Jurek, Piotr Kowenzowski, Michal Pletty, Konrad Talik, Maciej Zgliczynski
Maintainer: Stanislaw Jastrzebski <[email protected]>
Description: Package focusing on efficiency (C++ implementations) and intuitive API. gmum.r is a close collaboration between GMUM group members (http://gmum.net) and students.
License: MIT + file LICENSE
Repository: CRAN
Depends:
Imports:
ggplot2 (>= 1.0.0),
stats,
igraph,
SparseM,
httr,
Matrix,
MASS (>= 7.3),
httr,
Rcpp (>= 0.11.6)
LinkingTo: Rcpp, RcppArmadillo, BH
NeedsCompilation: yes
Expand Down
18 changes: 18 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,22 @@ importFrom(ggplot2,scale_colour_brewer)
importFrom(ggplot2,scale_fill_brewer)
importFrom(ggplot2,scale_size_continuous)
importFrom(ggplot2,scale_size_identity)
importFrom(grDevices,rainbow)
importFrom(graphics,hist)
importFrom(graphics,pairs)
importFrom(graphics,par)
importFrom(graphics,plot)
importFrom(graphics,plot.new)
importFrom(graphics,points)
importFrom(graphics,title)
importFrom(httr,GET)
importFrom(httr,content)
importFrom(stats,na.omit)
importFrom(stats,prcomp)
importFrom(stats,predict)
importFrom(stats,rnorm)
importFrom(stats,runif)
importFrom(stats,update)
importFrom(utils,data)
importFrom(utils,read.csv)
useDynLib(gmum.r)
8 changes: 7 additions & 1 deletion R/gmum.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#' @importFrom grDevices rainbow
#' @importFrom graphics hist pairs par plot plot.new points title
#' @importFrom stats na.omit prcomp predict rnorm runif update
#' @importFrom utils data read.csv
NULL

# Lazy loading to allow for discovery of all files
evalqOnLoad( {
# Autocompletion override
Expand All @@ -12,7 +18,7 @@ evalqOnLoad( {
.DollarNames.Rcpp_CecModel <<- autocompl

# Workaround RStudio bug
if(exists(".rs.getAnywhere")) {
if(exists(".rs.getAnywhere") && !exists(".rs.getAnywhere.original")) {
.rs.getAnywhere.original <<- .rs.getAnywhere
.rs.getAnywhere <<- function(a, envir=.GlobalEnv){ .rs.getAnywhere.original(a, .GlobalEnv) }
}
Expand Down
9 changes: 6 additions & 3 deletions R/gng.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ library(methods)
#' @importFrom ggplot2 scale_size_continuous scale_size_identity geom_point aes ggplot geom_tile scale_fill_brewer scale_alpha_identity scale_colour_brewer geom_abline
NULL


#' Use first two spatial coordinates as position in layout
#'
#' @note You can pass any igraph layout algorithm to plot
Expand Down Expand Up @@ -113,8 +112,10 @@ gngLoad <- NULL
#' @param community.detection.algorithm Used algorithm from igraph package, by default spinglass.community
#'
#' @examples
#' \dontrun{
#' gng <- GNG(gng.preset.sphere(100))
#' print(node(gng, calculateCentroids(gng)[1])$pos)
#' }
calculateCentroids <- NULL

#' Find closest node
Expand All @@ -128,11 +129,12 @@ calculateCentroids <- NULL
#' @param x Can be either \code{vector} or \code{data.frame.}
#'
#' @examples
#' \dontrun{
#' gng <- GNG(gng.preset.sphere(100))
#' # Find closest centroid to c(1,1,1)
#' found.centroids <- calculateCentroids(gng)
#' findClosests(gng, found.centroids, c(1,1,1))
#'
#' }
findClosests <- NULL

#' Check if GNG is running
Expand Down Expand Up @@ -421,6 +423,7 @@ clustering.Rcpp_GNGServer <- NULL
#' @param seed Seed for internal randomization
#'
#' @examples
#' \dontrun{
#' X <- gng.preset.sphere(100)
#' y <- round(runif(100))
#' # Train in an offline manner
Expand All @@ -436,7 +439,7 @@ clustering.Rcpp_GNGServer <- NULL
#' terminate(gng)
#' # Plot
#' plot(gng)
#'
#' }
GNG <- NULL

#' @title convertToIGraph
Expand Down
2 changes: 2 additions & 0 deletions R/gng.utils.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#' @importFrom httr GET content

#' @export
#' @rdname print.gng
#' @method print Rcpp_GNGServer
Expand Down
2 changes: 2 additions & 0 deletions man/calculateCentroids.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ Using passed community.detection finds communities and for each community pick n
Get centroids
}
\examples{
\dontrun{
gng <- GNG(gng.preset.sphere(100))
print(node(gng, calculateCentroids(gng)[1])$pos)
}
}

2 changes: 2 additions & 0 deletions man/findClosests.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ Finds closest node from given list to vector. Often used together with calculate
Find closest node
}
\examples{
\dontrun{
gng <- GNG(gng.preset.sphere(100))
# Find closest centroid to c(1,1,1)
found.centroids <- calculateCentroids(gng)
findClosests(gng, found.centroids, c(1,1,1))
}
}

2 changes: 2 additions & 0 deletions man/gng.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ see \url{http://sund.de/netze/applets/gng/full/tex/DemoGNG/node20.html}}
Construct GNG object. Can be used to train offline, or online.
}
\examples{
\dontrun{
X <- gng.preset.sphere(100)
y <- round(runif(100))
# Train in an offline manner
Expand All @@ -68,4 +69,5 @@ terminate(gng)
# Plot
plot(gng)
}
}
3 changes: 3 additions & 0 deletions src/packThis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ rm -r $destination/..Rcheck
rm -r $destination/.git
rm -r $destination/.idea
rm -r pkg/pkg
rm -r pkg/doc
rm -r pkg/cmake
rm -r pkg/libs
2 changes: 1 addition & 1 deletion src/svmlight/svm_learn.c
Original file line number Diff line number Diff line change
Expand Up @@ -3714,7 +3714,7 @@ CFLOAT *kernel_cache_clean_and_malloc(KERNEL_CACHE *kernel_cache,
}
kernel_cache->invindex[result]=docnum;
kernel_cache->lru[kernel_cache->index[docnum]]=kernel_cache->time; /* lru */
return((CFLOAT *)((long)kernel_cache->buffer
return((CFLOAT *)((intptr_t)kernel_cache->buffer
+(kernel_cache->activenum*sizeof(CFLOAT)*
kernel_cache->index[docnum])));
}
Expand Down
4 changes: 4 additions & 0 deletions tests/test-all.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ if(!is.installed("e1071")){
install.packages("e1071",repos='http://cran.us.r-project.org')
}

if(!is.installed("MASS")){
install.packages("MASS",repos='http://cran.us.r-project.org')
}

test_check('gmum.r')

0 comments on commit 1277546

Please sign in to comment.