Skip to content

Commit

Permalink
preparing for release
Browse files Browse the repository at this point in the history
  • Loading branch information
dbolotov committed Sep 13, 2019
1 parent 617124f commit c70b041
Show file tree
Hide file tree
Showing 65 changed files with 221 additions and 162 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: pmml
Type: Package
Title: Generate PMML for Various Models
Version: 2.0.0.9000
Version: 2.1.0
Authors@R: c(
person("Dmitriy", "Bolotov", email = "[email protected]", role = c("aut", "cre")),
person("Tridivesh", "Jena", email = "[email protected]", role = "aut"),
Expand Down
31 changes: 18 additions & 13 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
# pmml 2.0.0.9000 (development version)
# pmml 2.1.0

## Major Changes
* Package is now compliant with PMML schema 4.4
* Package now exports PMML with schema version 4.4.

* Package now supports ARIMA time series models with conditional least squares forecasting from the `forecast` package.
* `pmml.ARIMA()` function added - exports ARIMA time series models from the `forecast` package with conditional least squares forecasting.

* pmml.svm() now has `detect_anomaly` argument, allowing the user to specify whether the PMML detects anomalies or inliers. Please see the doc for more details.

* The following arguments are deprecated. They can still be used, but will produce a warning message:
- pmml.iForest: `anomalyThreshold` -> `anomaly_threshold`
- pmml.kmeans: `algorithm.name` -> `algorithm_name`
- rename_wrap_var, `wrap_data` -> `wrap_object`
- xform_norm_discrete: `inputVar` -> `input_var`
## Breaking Changes
* `pmml.svm()` now has a `detect_anomaly` argument, allowing the user to specify whether the PMML detects anomalies or inliers. The exported PMML now has two OutputField elements: `anomalyScore` and one of `anomaly` or `inlier`.

* The following arguments are deprecated. They can still be used, but will produce a warning message and will be removed in a future release.
- `pmml.iForest`: `anomalyThreshold` -> `anomaly_threshold`
- `pmml.kmeans`: `algorithm.name` -> `algorithm_name`
- `rename_wrap_var`: `wrap_data` -> `wrap_object`
- `xform_norm_discrete`: `inputVar` -> `input_var`


## Other Changes
* Application version in PMML Header corresponds to pmml package version.

* `pmml.iForest` now uses `sampleDataSize` instead of `ParameterList` to store the `model$phi` value. This should not affect the user.
* `pmml.iForest` now uses attribute `sampleDataSize` instead of element `ParameterList` to store the `model$phi` value.

* `pmml.gbm` now adds `modelName` attribute to the final segment for multinomial gbm models.

* `testthat` file names now correspond to the functions being tested.
* `testthat` file names correspond to the functions being tested.

* Edited `make_output_nodes` doc for clarity.

* Minor edits in `make_output_nodes` doc for clarity.
* Updated formatting in vignettes.

* Minor formatting edits in vignettes.
* Fixed spelling and added word list via `spelling` package.



Expand Down
20 changes: 17 additions & 3 deletions R/pmml.ARIMA.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,29 @@
#'
#' @return PMML representation of the \code{ARIMA} object.
#'
#' @details The model is represented in the PMML TimeSeriesModel format.
#' @details The model is represented in the PMML TimeSeriesModel format with conditional
#' least squares forecasting. Note that ARIMA models in R are
#' estimated using a state space formulation.
#'
#' Transforms are currently not supported for ARIMA models.
#'
#' @author Dmitriy Bolotov
#'
#' @examples
#' library(forecast)
#'
#' # non-seasonal model
#' data("WWWusage")
#' mod <- Arima(WWWusage, order = c(3, 1, 1))
#' mod_pmml <- pmml(mod)
#'
#' # seasonal model
#' data("JohnsonJohnson")
#' mod_02 <- Arima(JohnsonJohnson,
#' order = c(1, 1, 1),
#' seasonal = c(1, 1, 1)
#' )
#' mod_02_pmml <- pmml(mod_02)
#' @export pmml.ARIMA
#' @export
pmml.ARIMA <- function(model,
Expand All @@ -47,9 +61,9 @@ pmml.ARIMA <- function(model,
transforms = NULL,
missing_value_replacement = NULL,
...) {
if (!inherits(model, "ARIMA")) stop("Not a legitimate ARIMA stats object.")
if (!inherits(model, "ARIMA")) stop("Not a legitimate ARIMA forecast object.")

if (!is.null(transforms)) stop("Transforms not supported for ARIMA stats models.")
if (!is.null(transforms)) stop("Transforms not supported for ARIMA forecast models.")

# Stop if model includes both intercept and drift terms
if (("intercept" %in% names(model$coef)) & ("drift") %in% names(model$coef)) {
Expand Down
15 changes: 7 additions & 8 deletions R/pmml.svm.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
#'
#' @section One-Classification SVM Models:
#'
#' For a one-classification svm (OCSVM) model, the PMML has two OutputField elements.
#' For a one-classification svm (OCSVM) model, the PMML has two OutputField elements:
#' \code{anomalyScore} and one of \code{anomaly} or \code{outlier}.
#'
#' The OutputField \code{anomalyScore} is the signed distance to the separating boundary;
#' \code{anomalyScore} corresponds to the \code{decision.values} attribute of the output of the
Expand All @@ -70,12 +71,12 @@
#'
#' Setting \code{detect_anomaly} to FALSE results in the second field instead being \code{inlier}.
#' This OutputField is TRUE when an inlier is
#' detected, and conforms to the \pkg{e1071} definition of one-class SVMs. This field is FALSE when
#' an anomaly is detected; that is, the R svm model predicts whether an input belongs to the
#' detected, and conforms to the e1071 definition of one-class SVMs. This field is FALSE when
#' an anomaly is detected; that is, the R svm model predicts whether an observation belongs to the
#' class. When comparing the predictions from R and PMML, this field should be used, since it
#' will match R's output.
#'
#' For example, say that for an input of observations, the R OCSVM model predicts a positive
#' For example, say that for an an observation, the R OCSVM model predicts a positive
#' decision value of 0.4 and label of TRUE. According to the R object, this means that the
#' observation is an inlier. By default, the PMML export of this model will give the following for the
#' same input: \code{anomalyScore = 0.4, anomaly = "false"}. According to the PMML, the observation is not an anomaly.
Expand Down Expand Up @@ -674,7 +675,7 @@ pmml.svm <- function(model,
dataType = "boolean",
optype = "categorical"
))

output_apply <- xmlNode("Apply", attrs = c("function" = "lessThan"))
output_fieldref <- xmlNode("FieldRef", attrs = c(field = "anomalyScore"))
output_constant <- xmlNode("Constant", 0, attrs = c(dataType = "double"))
Expand All @@ -687,7 +688,7 @@ pmml.svm <- function(model,
dataType = "boolean",
optype = "categorical"
))

output_apply <- xmlNode("Apply", attrs = c("function" = "greaterOrEqual"))
output_fieldref <- xmlNode("FieldRef", attrs = c(field = "anomalyScore"))
output_constant <- xmlNode("Constant", 0, attrs = c(dataType = "double"))
Expand All @@ -696,5 +697,3 @@ pmml.svm <- function(model,
}
return(output)
}


34 changes: 10 additions & 24 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,17 @@
## Test environments
* Local Linux Mint install, R 3.6.0
* win-builder (devel and release)
* Local Linux Mint install, R 3.6.1
* win-builder (release)

## R CMD check results

There was 1 NOTE:
There were no ERRORs, WARNINGs, or NOTEs during local or win-builder checks.

* checking CRAN incoming feasibility ... NOTE
Maintainer: 'Dmitriy Bolotov <[email protected]>'
There wsas 1 ERROR on r-patched-solaris-x86 (https://cloud.r-project.org/web/checks/check_results_pmml.html):

New maintainer:
Dmitriy Bolotov <[email protected]>
Old maintainer(s):
Tridivesh Jena <[email protected]>
> library(testthat)
> library(pmml, quietly = T)
>
> test_check("pmml")
Error: segfault from C stack overflow

The maintainer has changed.


There was 1 NOTE during reverse dependency checks:

Changes to worse in reverse depends:

Package: fpmoutliers
Check: R code for possible problems
New result: NOTE
generatePMML: no visible global function definition for ‘pmml.itemsets’
Undefined global functions or variables:
pmml.itemsets

This note is due to the method not being explicitly exported in the namespace. We have added an explicit export.
We are not sure how to address this issue.
2 changes: 1 addition & 1 deletion docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/CODE_OF_CONDUCT.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/articles/packages_and_functions.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/xform_function.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/authors.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 29 additions & 18 deletions docs/news/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/add_attributes.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/add_data_field_attributes.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/reference/add_data_field_children.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit c70b041

Please sign in to comment.