outliertree 0.2.1 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ef23e1cd53c4dd31f3adc24d9f403d74d6d7f4680442b5e052b3c7c2d153658
4
- data.tar.gz: 26e792c801de21a0f27f1a522d6fbf9ac03eb65dfb2fba91f4fbd268dffc570f
3
+ metadata.gz: 8ed2332f581bd9cf68d32fe19bdb89c58f268c6ea6feb30e34e8422595920dc3
4
+ data.tar.gz: d7cc844317fc023bee7d461838ae3fad3567268845013d2fc4e761f325934534
5
5
  SHA512:
6
- metadata.gz: 3bf9293f70824055367a2dc32b50c5a8b9bc49af09da7e2e7cbc4824c8764a454fb34fad1b0612b9aaf7b97a4ebb559a05caba247e7f1fc3cf8553fefedeb5c2
7
- data.tar.gz: 7267d09d926458a1770904bb072b144a343950c1652a52f0df9f2e20b4b650a63e508acc75b43c369ada31998052b4719879fc45d1b08ba43c96570f0fff29bd
6
+ metadata.gz: 4afaa3d661d2d225dc55d708ba8d263b0a017fe2a5388d77cb881d5765f9e9cc9ef682b52ef541b706cf00fc0cc7d3834f537a7900c30d3783df1821ef7d432e
7
+ data.tar.gz: 6c0feea6f531277847d84c76cbf146ca3d3821f9dd9635c8f7bf1fe592b1905f02db2d288027600310609d817d891129b510f5dad377946e735364705d0949cd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 0.3.1 (2023-12-19)
2
+
3
+ - Updated OutlierTree to 1.8.2
4
+ - Fixed error with Rice 4.1
5
+
6
+ ## 0.3.0 (2022-06-13)
7
+
8
+ - Updated OutlierTree to 1.8.1
9
+ - Dropped support for Ruby < 2.7
10
+
1
11
  ## 0.2.1 (2021-05-23)
2
12
 
3
13
  - Improved performance
data/NOTICE.txt CHANGED
@@ -1,5 +1,5 @@
1
1
  Copyright (C) 2019-2020 David Cortes
2
- Copyright (C) 2020-2021 Andrew Kane
2
+ Copyright (C) 2020-2022 Andrew Kane
3
3
 
4
4
  This program is free software: you can redistribute it and/or modify
5
5
  it under the terms of the GNU General Public License as published by
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # OutlierTree
1
+ # OutlierTree Ruby
2
2
 
3
3
  :deciduous_tree: [OutlierTree](https://github.com/david-cortes/outliertree) - explainable outlier/anomaly detection - for Ruby
4
4
 
@@ -8,16 +8,16 @@ Produces human-readable explanations for why values are detected as outliers
8
8
  Price (2.50) looks low given Department is Books and Sale is false
9
9
  ```
10
10
 
11
- :evergreen_tree: Check out [IsoTree](https://github.com/ankane/isotree) for an alternative approach that uses Isolation Forest
11
+ :evergreen_tree: Check out [IsoTree](https://github.com/ankane/isotree-ruby) for an alternative approach that uses Isolation Forest
12
12
 
13
- [![Build Status](https://github.com/ankane/outliertree/workflows/build/badge.svg?branch=master)](https://github.com/ankane/outliertree/actions)
13
+ [![Build Status](https://github.com/ankane/outliertree-ruby/workflows/build/badge.svg?branch=master)](https://github.com/ankane/outliertree-ruby/actions)
14
14
 
15
15
  ## Installation
16
16
 
17
17
  Add this line to your application’s Gemfile:
18
18
 
19
19
  ```ruby
20
- gem 'outliertree'
20
+ gem "outliertree"
21
21
  ```
22
22
 
23
23
  ## Getting Started
@@ -28,7 +28,8 @@ Prep your data
28
28
  data = [
29
29
  {department: "Books", sale: false, price: 2.50},
30
30
  {department: "Books", sale: true, price: 3.00},
31
- {department: "Movies", sale: false, price: 5.00}
31
+ {department: "Movies", sale: false, price: 5.00},
32
+ # ...
32
33
  ]
33
34
  ```
34
35
 
@@ -108,22 +109,22 @@ bundle install
108
109
 
109
110
  ## History
110
111
 
111
- View the [changelog](https://github.com/ankane/outliertree/blob/master/CHANGELOG.md)
112
+ View the [changelog](https://github.com/ankane/outliertree-ruby/blob/master/CHANGELOG.md)
112
113
 
113
114
  ## Contributing
114
115
 
115
116
  Everyone is encouraged to help improve this project. Here are a few ways you can help:
116
117
 
117
- - [Report bugs](https://github.com/ankane/outliertree/issues)
118
- - Fix bugs and [submit pull requests](https://github.com/ankane/outliertree/pulls)
118
+ - [Report bugs](https://github.com/ankane/outliertree-ruby/issues)
119
+ - Fix bugs and [submit pull requests](https://github.com/ankane/outliertree-ruby/pulls)
119
120
  - Write, clarify, or fix documentation
120
121
  - Suggest or add new features
121
122
 
122
123
  To get started with development:
123
124
 
124
125
  ```sh
125
- git clone --recursive https://github.com/ankane/outliertree.git
126
- cd outliertree
126
+ git clone --recursive https://github.com/ankane/outliertree-ruby.git
127
+ cd outliertree-ruby
127
128
  bundle install
128
129
  bundle exec rake compile
129
130
  bundle exec rake test
@@ -30,6 +30,29 @@ namespace Rice::detail
30
30
  }
31
31
  };
32
32
 
33
+ template<>
34
+ class To_Ruby<std::vector<signed char>>
35
+ {
36
+ public:
37
+ VALUE convert(std::vector<signed char> const & x)
38
+ {
39
+ auto a = rb_ary_new2(x.size());
40
+ for (const auto& v : x) {
41
+ rb_ary_push(a, To_Ruby<signed char>().convert(v));
42
+ }
43
+ return a;
44
+ }
45
+ };
46
+
47
+ template<>
48
+ struct Type<std::vector<signed char>>
49
+ {
50
+ static bool verify()
51
+ {
52
+ return true;
53
+ }
54
+ };
55
+
33
56
  template<>
34
57
  struct Type<ColType>
35
58
  {
@@ -1,6 +1,6 @@
1
1
  require "mkmf-rice"
2
2
 
3
- $CXXFLAGS += " -std=c++17 $(optflags)"
3
+ $CXXFLAGS += " -std=c++17 $(optflags) -DDONT_THROW_ON_INTERRUPT"
4
4
 
5
5
  apple_clang = RbConfig::CONFIG["CC_VERSION_MESSAGE"] =~ /apple clang/i
6
6
 
@@ -22,7 +22,7 @@ module OutlierTree
22
22
  if outl_col < @numeric_columns.size
23
23
  column = @numeric_columns[outl_col]
24
24
  value = df[column][row]
25
- decimals = model_outputs.outlier_decimals_distr[row]
25
+ _decimals = model_outputs.outlier_decimals_distr[row]
26
26
  else
27
27
  column = @categorical_columns[outl_col - @numeric_columns.size]
28
28
  value = df[column][row]
@@ -94,11 +94,11 @@ module OutlierTree
94
94
  private
95
95
 
96
96
  def add_condition(row, split_type, cluster)
97
- coldecim = 0
97
+ _coldecim = 0
98
98
  case cluster.column_type
99
99
  when :numeric
100
100
  cond_col = @numeric_columns[cluster.col_num]
101
- coldecim = model_outputs.min_decimals_col[cluster.col_num]
101
+ _coldecim = model_outputs.min_decimals_col[cluster.col_num]
102
102
  else
103
103
  cond_col = @categorical_columns[cluster.col_num]
104
104
  end
@@ -1,3 +1,3 @@
1
1
  module OutlierTree
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.1"
3
3
  end
@@ -1,71 +1,109 @@
1
1
  # OutlierTree
2
2
 
3
- Explainable outlier/anomaly detection based on smart decision tree grouping, similar in spirit to the GritBot software developed by RuleQuest research. Written in C++ with interfaces for R and Python. Supports columns of types numeric, categorical, binary/boolean, and ordinal, and can handle missing values in all of them. Ideal as a sanity checker in exploratory data analysis.
4
-
5
- # How it works
6
-
7
- Will try to fit decision trees that try to "predict" values for each column based on the values of each other column. Along the way, each time a split is evaluated, it will take the observations that fall into each branch as a homogeneous cluster in which it will search for outliers in the 1-d distribution of the column being predicted. Outliers are determined according to confidence intervals on this 1-d distribution, and need to have a large gap with respect to the next observation in sorted order to be flagged as outliers. Since outliers are searched for in a decision tree branch, it will know the conditions that make it a rare observation compared to others that meet the same conditions, and the conditions will always be correlated with the target variable (as it's being predicted from them).
8
-
9
- As such, it will only be able to detect outliers that can be described through a decision tree logic, and unlike other methods such as [Isolation Forests](https://github.com/david-cortes/isotree), will not be able to assign an outlier score to each observation, nor to detect outliers that are just overall rare, but will always provide a human-readable justification when it flags an outlier.
10
-
11
- Procedure is described in more detail in [Explainable outlier detection through decision tree conditioning](http://arxiv.org/abs/2001.00636).
3
+ Explainable outlier/anomaly detection based on smart decision tree grouping, similar in spirit to the GritBot software developed by RuleQuest research. Written in C++ with interfaces for R and Python (additional Ruby wrapper can be found [here](https://github.com/ankane/outliertree/)). Supports columns of types numeric, categorical, binary/boolean, and ordinal, and can handle missing values in all of them. Ideal as a sanity checker in exploratory data analysis.
12
4
 
13
5
  # Example outputs
14
6
 
15
- Example outliers from [hypothyroid dataset](http://archive.ics.uci.edu/ml/datasets/thyroid+disease):
7
+ Example outliers from the [hypothyroid dataset](http://archive.ics.uci.edu/ml/datasets/thyroid+disease):
16
8
  ```
17
- row [1137] - suspicious column: [age] - suspicious value: [75.000]
18
- distribution: 95.122% <= 42.000 - [mean: 31.462] - [sd: 5.281] - [norm. obs: 39]
9
+ row [1138] - suspicious column: [age] - suspicious value: [75.00]
10
+ distribution: 95.122% <= 42.00 - [mean: 31.46] - [sd: 5.28] - [norm. obs: 39]
19
11
  given:
20
- [pregnant] = [t]
12
+ [pregnant] = [TRUE]
21
13
 
22
14
 
23
- row [2229] - suspicious column: [T3] - suspicious vale: [10.600]
24
- distribution: 99.951% <= 7.100 - [mean: 1.984] - [sd: 0.750] - [norm. obs: 2050]
15
+ row [2230] - suspicious column: [T3] - suspicious value: [10.60]
16
+ distribution: 99.951% <= 7.10 - [mean: 1.98] - [sd: 0.75] - [norm. obs: 2050]
17
+ given:
18
+ [query.hyperthyroid] = [FALSE]
19
+
20
+ row [745] - suspicious column: [TT4] - suspicious value: [239.00]
21
+ distribution: 98.571% <= 177.00 - [mean: 135.23] - [sd: 12.57] - [norm. obs: 69]
25
22
  given:
26
- [query hyperthyroid] = [f]
23
+ [FTI] between (97.96, 128.12] (value: 112.74)
24
+ [T4U] > [1.12] (value: 2.12)
25
+ [age] > [55.00] (value: 87.00)
27
26
  ```
28
27
  (i.e. it's saying that it's abnormal to be pregnant at the age of 75, or to not be classified as hyperthyroidal when having very high thyroid hormone levels)
29
28
  (this dataset is also bundled into the R package - e.g. `data(hypothyroid)`)
30
29
 
31
30
 
32
- Example outlier from [Titanic dataset](https://www.kaggle.com/c/titanic):
31
+ Example outliers from the [Titanic dataset](https://www.kaggle.com/c/titanic):
33
32
  ```
34
- row [885] - suspicious column: [Fare] - suspicious value: [29.125]
35
- distribution: 97.849% <= 15.500 - [mean: 7.887] - [sd: 1.173] - [norm. obs: 91]
33
+ row [1147] - suspicious column: [Fare] - suspicious value: [29.12]
34
+ distribution: 97.849% <= 15.50 - [mean: 7.89] - [sd: 1.17] - [norm. obs: 91]
36
35
  given:
37
36
  [Pclass] = [3]
38
37
  [SibSp] = [0]
39
38
  [Embarked] = [Q]
39
+
40
+ row [897] - suspicious column: [Fare] - suspicious value: [0.00]
41
+ distribution: 99.216% >= 3.17 - [mean: 9.68] - [sd: 6.98] - [norm. obs: 506]
42
+ given:
43
+ [Pclass] = [3]
44
+ [SibSp] = [0]
40
45
  ```
41
- (i.e. it's saying that the this person paid too much for the kind of accomodation he had)
46
+ (i.e. it's saying that the the first person paid too much for the kind of accomodation he had, and the second person should not have gotten it for free)
42
47
 
43
48
  _Note that it can also produce other types of conditions such as 'between' (for numeric intervals) or 'in' (for categorical subsets)_
44
49
 
50
+ # How it works
51
+
52
+ Will try to fit decision trees that try to "predict" values for each column based on the values of each other column. Along the way, each time a split is evaluated, it will take the observations that fall into each branch as a homogeneous cluster in which it will search for outliers in the 1-d distribution of the column being predicted. Outliers are determined according to confidence intervals on this 1-d distribution, and need to have a large gap with respect to the next observation in sorted order to be flagged as outliers. Since outliers are searched for in a decision tree branch, it will know the conditions that make it a rare observation compared to others that meet the same conditions, and the conditions will always be correlated with the target variable (as it's being predicted from them).
53
+
54
+ As such, it will only be able to detect outliers that can be described through a decision tree logic, and unlike other methods such as [Isolation Forests](https://github.com/david-cortes/isotree), will not be able to assign an outlier score to each observation, nor to detect outliers that are just overall rare, but will always provide a human-readable justification when it flags an outlier.
55
+
56
+ Procedure is described in more detail in [Explainable outlier detection through decision tree conditioning](http://arxiv.org/abs/2001.00636).
57
+
45
58
  # Installation
46
59
 
47
60
  * For R:
61
+
62
+ **Note:** This package benefits from extra optimizations that aren't enabled by default for R packages. See [this guide](https://github.com/david-cortes/installing-optimized-libraries) for instructions on how to enable them.
63
+
48
64
  ```r
49
65
  install.packages("outliertree")
50
66
  ```
51
67
 
52
68
 
53
69
  * For Python:
70
+
71
+ **Note:** requires C/C++ compilers configured for Python. See [this guide](https://github.com/david-cortes/installing-optimized-libraries) for instructions.
72
+
54
73
  ```
55
74
  pip install outliertree
56
75
  ```
57
- (Package has only been tested in Python 3)
76
+ or if that fails:
77
+ ```
78
+ pip install --no-use-pep517 outliertree
79
+ ```
80
+ ** *
58
81
 
59
- **Note for macOS users:** on macOS, the Python version of this package will compile **without** multi-threading capabilities. This is due to default apple's redistribution of `clang` not providing OpenMP modules, and aliasing it to `gcc` which causes confusions in build scripts. If you have a non-apple version of `clang` with the OpenMP modules, or if you have `gcc` installed, you can compile this package with multi-threading enabled by setting up an environment variable `ENABLE_OMP=1`:
82
+ **Note for macOS users:** on macOS, the Python version of this package might compile **without** multi-threading capabilities. In order to enable multi-threading support, first install OpenMP:
60
83
  ```
61
- export ENABLE_OMP=1
84
+ brew install libomp
85
+ ```
86
+ And then reinstall this package: `pip install --upgrade --no-deps --force-reinstall outliertree`.
87
+
88
+ ** *
89
+ **IMPORTANT:** the setup script will try to add compilation flag `-march=native`. This instructs the compiler to tune the package for the CPU in which it is being installed (by e.g. using AVX instructions if available), but the result might not be usable in other computers. If building a binary wheel of this package or putting it into a docker image which will be used in different machines, this can be overriden either by (a) defining an environment variable `DONT_SET_MARCH=1`, or by (b) manually supplying compilation `CFLAGS` as an environment variable with something related to architecture. For maximum compatibility (but slowest speed), it's possible to do something like this:
90
+
91
+ ```
92
+ export DONT_SET_MARCH=1
62
93
  pip install outliertree
63
94
  ```
64
- (Alternatively, can also pass argument `enable-omp` to the `setup.py` file: `python setup.py install enable-omp`)
65
95
 
96
+ or, by specifying some compilation flag for architecture:
97
+ ```
98
+ export CFLAGS="-march=x86-64"
99
+ export CXXFLAGS="-march=x86-64"
100
+ pip install outliertree
101
+ ```
102
+ ** *
66
103
 
67
104
  * For C++: package doesn't have a build system, nor a `main` function that can produce an executable, but can be built as a shared object and wrapped into other languages with any C++11-compliant compiler (`std=c++11` in most compilers, `/std:c++14` in MSVC). For parallelization, needs OpenMP linkage (`-fopenmp` in most compilers, `/openmp` in MSVC). Package should *not* be built with optimization higher than `O3` (i.e. don't use `-Ofast`). Needs linkage to the `math` library, which should be enabled by default in most C++ compilers, but otherwise would require `-lm` argument. No external dependencies are required.
68
105
 
106
+ * For Ruby: see [external repository with wrapper](https://github.com/ankane/outliertree/).
69
107
 
70
108
  # Sample usage
71
109
 
@@ -77,18 +115,18 @@ library(outliertree)
77
115
  nrows = 100
78
116
  set.seed(1)
79
117
  df = data.frame(
80
- numeric_col1 = c(rnorm(nrows - 1), 1e6),
81
- numeric_col2 = rgamma(nrows, 1),
82
- categ_col = sample(c('categA', 'categB', 'categC'), size = nrows, replace = TRUE)
83
- )
118
+ numeric_col1 = c(rnorm(nrows - 1), 1e6),
119
+ numeric_col2 = rgamma(nrows, 1),
120
+ categ_col = sample(c('categA', 'categB', 'categC'), size = nrows, replace = TRUE)
121
+ )
84
122
 
85
123
  ### test data frame with another obvious outlier
86
124
  nrows_test = 50
87
125
  df_test = data.frame(
88
- numeric_col1 = rnorm(nrows_test),
89
- numeric_col2 = c(-1e6, rgamma(nrows_test - 1, 1)),
90
- categ_col = sample(c('categA', 'categB', 'categC'), size = nrows_test, replace = TRUE)
91
- )
126
+ numeric_col1 = rnorm(nrows_test),
127
+ numeric_col2 = c(-1e6, rgamma(nrows_test - 1, 1)),
128
+ categ_col = sample(c('categA', 'categB', 'categC'), size = nrows_test, replace = TRUE)
129
+ )
92
130
 
93
131
  ### fit model
94
132
  outliers_model = outliertree::outlier.tree(df, outliers_print = 10, save_outliers = TRUE)
@@ -101,7 +139,7 @@ summary(new_outliers)
101
139
  ```
102
140
  (see documentation for more examples)
103
141
 
104
- Example [RMarkdown](http://htmlpreview.github.io/?https://github.com/david-cortes/outliertree/blob/master/example/titanic_outliertree_r.html) using the Titanic dataset.
142
+ Example [RMarkdown](http://htmlpreview.github.io/?https://github.com/david-cortes/outliertree/blob/master/vignettes/Explainable_Outlier_Detection_in_Titanic_dataset.html) using the Titanic dataset.
105
143
 
106
144
 
107
145
  * For Python:
@@ -113,17 +151,17 @@ from outliertree import OutlierTree
113
151
  nrows = 100
114
152
  np.random.seed(1)
115
153
  df = pd.DataFrame({
116
- "numeric_col1" : np.r_[np.random.normal(size = nrows - 1), np.array([float(1e6)])],
117
- "numeric_col2" : np.random.gamma(1, 1, size = nrows),
118
- "categ_col" : np.random.choice(['categA', 'categB', 'categC'], size = nrows)
119
- })
154
+ "numeric_col1" : np.r_[np.random.normal(size = nrows - 1), np.array([float(1e6)])],
155
+ "numeric_col2" : np.random.gamma(1, 1, size = nrows),
156
+ "categ_col" : np.random.choice(['categA', 'categB', 'categC'], size = nrows)
157
+ })
120
158
 
121
159
  ### test data frame with another obvious outlier
122
160
  df_test = pd.DataFrame({
123
- "numeric_col1" : np.random.normal(size = nrows),
124
- "numeric_col2" : np.r_[np.array([float(-1e6)]), np.random.gamma(1, 1, size = nrows - 1)],
125
- "categ_col" : np.random.choice(['categA', 'categB', 'categC'], size = nrows)
126
- })
161
+ "numeric_col1" : np.random.normal(size = nrows),
162
+ "numeric_col2" : np.r_[np.array([float(-1e6)]), np.random.gamma(1, 1, size = nrows - 1)],
163
+ "categ_col" : np.random.choice(['categA', 'categB', 'categC'], size = nrows)
164
+ })
127
165
 
128
166
  ### fit model
129
167
  outliers_model = OutlierTree()
@@ -138,6 +176,8 @@ outliers_model.print_outliers(new_outliers)
138
176
 
139
177
  Example [IPython notebook](http://nbviewer.ipython.org/github/david-cortes/outliertree/blob/master/example/titanic_outliertree_python.ipynb) using the Titanic dataset.
140
178
 
179
+ * For Ruby: see the [external repository](https://github.com/ankane/outliertree/).
180
+
141
181
  * For C++: see functions `fit_outliers_models` and `find_new_outliers` in header `outlier_tree.hpp`.
142
182
 
143
183
  # Documentation
@@ -146,6 +186,8 @@ Example [IPython notebook](http://nbviewer.ipython.org/github/david-cortes/outli
146
186
 
147
187
  * For Python: documentation is available at [ReadTheDocs](http://outliertree.readthedocs.io/en/latest/) (and it's also built-in in the package as docstrings, e.g. `help(outliertree.OutlierTree.fit)`).
148
188
 
189
+ * For Ruby: see the [external repository](https://github.com/ankane/outliertree/) and the [Python documentation](http://outliertree.readthedocs.io/en/latest/).
190
+
149
191
  * For C++: documentation is available in the source files (not in the header).
150
192
 
151
193
  # References
@@ -0,0 +1,3 @@
1
+ PKG_CPPFLAGS = -DRCPP_USE_UNWIND_PROTECT -D_FOR_R @SUPPORTS_RESTRICT@
2
+ PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) @FNE_FLAG@ @FNTP_FLAG@ $(CXX_VISIBILITY)
3
+ PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS)
@@ -0,0 +1,3 @@
1
+ PKG_CPPFLAGS = -DRCPP_USE_UNWIND_PROTECT -D_FOR_R
2
+ PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) -fno-trapping-math -fno-math-errno
3
+ PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS)
@@ -5,34 +5,16 @@
5
5
 
6
6
  using namespace Rcpp;
7
7
 
8
- // deserialize_OutlierTree
9
- SEXP deserialize_OutlierTree(Rcpp::RawVector src);
10
- RcppExport SEXP _outliertree_deserialize_OutlierTree(SEXP srcSEXP) {
11
- BEGIN_RCPP
12
- Rcpp::RObject rcpp_result_gen;
13
- Rcpp::RNGScope rcpp_rngScope_gen;
14
- Rcpp::traits::input_parameter< Rcpp::RawVector >::type src(srcSEXP);
15
- rcpp_result_gen = Rcpp::wrap(deserialize_OutlierTree(src));
16
- return rcpp_result_gen;
17
- END_RCPP
18
- }
19
- // check_null_ptr_model
20
- Rcpp::LogicalVector check_null_ptr_model(SEXP ptr_model);
21
- RcppExport SEXP _outliertree_check_null_ptr_model(SEXP ptr_modelSEXP) {
22
- BEGIN_RCPP
23
- Rcpp::RObject rcpp_result_gen;
24
- Rcpp::RNGScope rcpp_rngScope_gen;
25
- Rcpp::traits::input_parameter< SEXP >::type ptr_model(ptr_modelSEXP);
26
- rcpp_result_gen = Rcpp::wrap(check_null_ptr_model(ptr_model));
27
- return rcpp_result_gen;
28
- END_RCPP
29
- }
8
+ #ifdef RCPP_USE_GLOBAL_ROSTREAM
9
+ Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get();
10
+ Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
11
+ #endif
12
+
30
13
  // fit_OutlierTree
31
14
  Rcpp::List fit_OutlierTree(Rcpp::NumericVector arr_num, size_t ncols_numeric, Rcpp::IntegerVector arr_cat, size_t ncols_categ, Rcpp::IntegerVector ncat, Rcpp::IntegerVector arr_ord, size_t ncols_ord, Rcpp::IntegerVector ncat_ord, size_t nrows, Rcpp::LogicalVector cols_ignore_r, int nthreads, bool categ_as_bin, bool ord_as_bin, bool cat_bruteforce_subset, bool categ_from_maj, bool take_mid, size_t max_depth, double max_perc_outliers, size_t min_size_numeric, size_t min_size_categ, double min_gain, bool follow_all, bool gain_as_pct, double z_norm, double z_outlier, bool return_outliers, Rcpp::ListOf<Rcpp::StringVector> cat_levels, Rcpp::ListOf<Rcpp::StringVector> ord_levels, Rcpp::StringVector colnames_num, Rcpp::StringVector colnames_cat, Rcpp::StringVector colnames_ord, Rcpp::NumericVector min_date, Rcpp::NumericVector min_ts);
32
15
  RcppExport SEXP _outliertree_fit_OutlierTree(SEXP arr_numSEXP, SEXP ncols_numericSEXP, SEXP arr_catSEXP, SEXP ncols_categSEXP, SEXP ncatSEXP, SEXP arr_ordSEXP, SEXP ncols_ordSEXP, SEXP ncat_ordSEXP, SEXP nrowsSEXP, SEXP cols_ignore_rSEXP, SEXP nthreadsSEXP, SEXP categ_as_binSEXP, SEXP ord_as_binSEXP, SEXP cat_bruteforce_subsetSEXP, SEXP categ_from_majSEXP, SEXP take_midSEXP, SEXP max_depthSEXP, SEXP max_perc_outliersSEXP, SEXP min_size_numericSEXP, SEXP min_size_categSEXP, SEXP min_gainSEXP, SEXP follow_allSEXP, SEXP gain_as_pctSEXP, SEXP z_normSEXP, SEXP z_outlierSEXP, SEXP return_outliersSEXP, SEXP cat_levelsSEXP, SEXP ord_levelsSEXP, SEXP colnames_numSEXP, SEXP colnames_catSEXP, SEXP colnames_ordSEXP, SEXP min_dateSEXP, SEXP min_tsSEXP) {
33
16
  BEGIN_RCPP
34
17
  Rcpp::RObject rcpp_result_gen;
35
- Rcpp::RNGScope rcpp_rngScope_gen;
36
18
  Rcpp::traits::input_parameter< Rcpp::NumericVector >::type arr_num(arr_numSEXP);
37
19
  Rcpp::traits::input_parameter< size_t >::type ncols_numeric(ncols_numericSEXP);
38
20
  Rcpp::traits::input_parameter< Rcpp::IntegerVector >::type arr_cat(arr_catSEXP);
@@ -75,7 +57,6 @@ Rcpp::List predict_OutlierTree(SEXP ptr_model, size_t nrows, int nthreads, Rcpp:
75
57
  RcppExport SEXP _outliertree_predict_OutlierTree(SEXP ptr_modelSEXP, SEXP nrowsSEXP, SEXP nthreadsSEXP, SEXP arr_numSEXP, SEXP arr_catSEXP, SEXP arr_ordSEXP, SEXP cat_levelsSEXP, SEXP ord_levelsSEXP, SEXP colnames_numSEXP, SEXP colnames_catSEXP, SEXP colnames_ordSEXP, SEXP min_dateSEXP, SEXP min_tsSEXP) {
76
58
  BEGIN_RCPP
77
59
  Rcpp::RObject rcpp_result_gen;
78
- Rcpp::RNGScope rcpp_rngScope_gen;
79
60
  Rcpp::traits::input_parameter< SEXP >::type ptr_model(ptr_modelSEXP);
80
61
  Rcpp::traits::input_parameter< size_t >::type nrows(nrowsSEXP);
81
62
  Rcpp::traits::input_parameter< int >::type nthreads(nthreadsSEXP);
@@ -98,7 +79,6 @@ Rcpp::LogicalVector check_few_values(Rcpp::NumericVector arr_num, size_t nrows,
98
79
  RcppExport SEXP _outliertree_check_few_values(SEXP arr_numSEXP, SEXP nrowsSEXP, SEXP ncolsSEXP, SEXP nthreadsSEXP) {
99
80
  BEGIN_RCPP
100
81
  Rcpp::RObject rcpp_result_gen;
101
- Rcpp::RNGScope rcpp_rngScope_gen;
102
82
  Rcpp::traits::input_parameter< Rcpp::NumericVector >::type arr_num(arr_numSEXP);
103
83
  Rcpp::traits::input_parameter< size_t >::type nrows(nrowsSEXP);
104
84
  Rcpp::traits::input_parameter< size_t >::type ncols(ncolsSEXP);
@@ -107,17 +87,27 @@ BEGIN_RCPP
107
87
  return rcpp_result_gen;
108
88
  END_RCPP
109
89
  }
90
+ // R_has_openmp
91
+ bool R_has_openmp();
92
+ RcppExport SEXP _outliertree_R_has_openmp() {
93
+ BEGIN_RCPP
94
+ Rcpp::RObject rcpp_result_gen;
95
+ rcpp_result_gen = Rcpp::wrap(R_has_openmp());
96
+ return rcpp_result_gen;
97
+ END_RCPP
98
+ }
110
99
 
111
100
  static const R_CallMethodDef CallEntries[] = {
112
- {"_outliertree_deserialize_OutlierTree", (DL_FUNC) &_outliertree_deserialize_OutlierTree, 1},
113
- {"_outliertree_check_null_ptr_model", (DL_FUNC) &_outliertree_check_null_ptr_model, 1},
114
101
  {"_outliertree_fit_OutlierTree", (DL_FUNC) &_outliertree_fit_OutlierTree, 33},
115
102
  {"_outliertree_predict_OutlierTree", (DL_FUNC) &_outliertree_predict_OutlierTree, 13},
116
103
  {"_outliertree_check_few_values", (DL_FUNC) &_outliertree_check_few_values, 4},
104
+ {"_outliertree_R_has_openmp", (DL_FUNC) &_outliertree_R_has_openmp, 0},
117
105
  {NULL, NULL, 0}
118
106
  };
119
107
 
108
+ void init_altrepped_class(DllInfo* dll);
120
109
  RcppExport void R_init_outliertree(DllInfo *dll) {
121
110
  R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
122
111
  R_useDynamicSymbols(dll, FALSE);
112
+ init_altrepped_class(dll);
123
113
  }