Skip to content

Commit 0ad64d7

Browse files
andyliaw-mrkcran-robot
authored andcommitted
version 4.7-1.2
1 parent ac6e7cb commit 0ad64d7

12 files changed

+84
-73
lines changed

DESCRIPTION

+18-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
Package: randomForest
2-
Title: Breiman and Cutler's Random Forests for Classification and
2+
Title: Breiman and Cutlers Random Forests for Classification and
33
Regression
4-
Version: 4.7-1.1
4+
Version: 4.7-1.2
55
Date: 2022-01-24
66
Depends: R (>= 4.1.0), stats
77
Suggests: RColorBrewer, MASS
8-
Author: Fortran original by Leo Breiman and Adele Cutler, R port by Andy Liaw and Matthew Wiener.
8+
Authors@R: c(person("Leo", "Breiman", role = "aut",
9+
comment = "Fortran original"),
10+
person("Adele", "Cutler", role = "aut",
11+
comment = "Fortran original"),
12+
person("Andy", "Liaw", role = c("aut", "cre"),
13+
email = "[email protected]",
14+
comment = "R port"),
15+
person("Matthew", "Wiener", role = "aut",
16+
comment = "R port"))
917
Description: Classification and regression based on a forest of trees using random inputs, based on Breiman (2001) <DOI:10.1023/A:1010933404324>.
10-
Maintainer: Andy Liaw <[email protected]>
1118
License: GPL (>= 2)
1219
URL: https://www.stat.berkeley.edu/~breiman/RandomForests/
1320
NeedsCompilation: yes
14-
Packaged: 2022-05-23 08:06:39 UTC; hornik
21+
Packaged: 2024-09-22 08:30:17 UTC; hornik
1522
Repository: CRAN
16-
Date/Publication: 2022-05-23 08:27:49 UTC
23+
Date/Publication: 2024-09-22 09:14:44 UTC
24+
Author: Leo Breiman [aut] (Fortran original),
25+
Adele Cutler [aut] (Fortran original),
26+
Andy Liaw [aut, cre] (R port),
27+
Matthew Wiener [aut] (R port)
28+
Maintainer: Andy Liaw <[email protected]>

MD5

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
393a5ca445f6965873eca0259a17f833 *COPYING
2-
c7fb0874404c16675bf24630a11e0748 *DESCRIPTION
3-
978decaa39e75944d88ab2dbe33a726a *NAMESPACE
2+
a2729aa6dee937053f616b6730882b3a *DESCRIPTION
3+
47f0c68ce5460bac806e587645925c50 *NAMESPACE
44
a025b98c25cb7761c0dbf3f421618a4d *R/MDSplot.R
55
eae0c348160c0e1f5c5140169c7610be *R/classCenter.R
66
1fcc48ac21e6e66f22dcc5a02cd722d1 *R/combine.R
@@ -25,16 +25,17 @@ e695b3cfc07facf54856bf366870e360 *R/tuneRF.R
2525
143dac20c44a22e3bd132cad4385e90e *R/varImpPlot.R
2626
18f94384910772d7babc8354b4ebae17 *R/varUsed.R
2727
a54ba14b0cb6cc15e4b7687ead9a2bf9 *R/zzz.R
28-
a7f95178c626d8f7830768e75f0961db *data/imports85.rda
29-
980aa22e77a4fccedc05d253b65645be *inst/CITATION
28+
aa5e5a2cbfaea3d9b6cdbe378ac48cee *build/partial.rdb
29+
c2c56a849b187e54307470cfa2b1da3d *data/imports85.rda
30+
aad37847b2fb0ead0b6f991ba9185c95 *inst/CITATION
3031
9e00469f24af18d37dfe36b1ff57654e *inst/NEWS
3132
b9b69f61e9ed079e1d9d84df6360d522 *man/MDSplot.Rd
3233
4fcbc72dd2475ff32f5a348bfa71af41 *man/classCenter.Rd
3334
e25dffb14a3dc288fda639b762757595 *man/combine.Rd
3435
3e2a6b978a69049e7ea7dc7a306c92fd *man/getTree.Rd
3536
cd05a7ccb5857db3a60da26503a22ef9 *man/grow.Rd
3637
3a63f7f925c1b4ca1bf805c5c7eca4f0 *man/importance.Rd
37-
3720f27c0c909c615d6d7f99826e1d3b *man/imports85.Rd
38+
110ee15f5d64c221b3995703b18131a1 *man/imports85.Rd
3839
c901b3cb1b2ad299574e76e5d80859ed *man/margin.Rd
3940
288befa4e77e572480dab78b686411f0 *man/na.roughfix.Rd
4041
8ecd590e5b87afb8e84058adea3f8415 *man/outlier.Rd
@@ -49,11 +50,11 @@ ac3d31008c56add22352b609f8cea599 *man/rfcv.Rd
4950
e7180386828b0d248c172a03915fc187 *man/tuneRF.Rd
5051
4ef6a1e04cf7e13580922c4f5769de09 *man/varImpPlot.Rd
5152
1638c2a6ba3ef89fe83321470c6d9386 *man/varUsed.Rd
52-
8ddc24e3050c344581787ce7ed10d7a5 *src/classTree.c
53+
6c450c23429e0fd0ab6ce1fe3b31ed89 *src/classTree.c
5354
adde4a205871318b538e448e6b8db090 *src/init.c
54-
71d6ddd355af9e2628304b53bcfde18c *src/regTree.c
55-
65214356bb8b82c817dc50d4b2751c91 *src/regrf.c
56-
c732a558584798d8d7574710060a2c70 *src/rf.c
55+
e3dbd6e39a262c4eb9f442d59f8d2b9b *src/regTree.c
56+
9cd55649aa061ba0bd4851fbdb3d210e *src/regrf.c
57+
ff7098e03cb8044f9eff4e459aa3ae5b *src/rf.c
5758
eb0ecd114bb31a940b2c131bd5a111c4 *src/rf.h
5859
a7656a9f81dafdc4fdf8621dbba47979 *src/rfsub.f
59-
6878639f320be3254a38999a26d5380e *src/rfutils.c
60+
ebd0c55f9255ab5d2c499730201fda52 *src/rfutils.c

NAMESPACE

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ S3method(importance, randomForest)
1515
S3method(outlier, randomForest)
1616
S3method(outlier, default)
1717

18+
S3method(grow, default)
19+
S3method(importance, default)
20+
S3method(margin, default)
21+
S3method(partialPlot, default)
22+
1823
S3method(randomForest, formula)
1924
S3method(randomForest, default)
2025
S3method(rfImpute, formula)

build/partial.rdb

61 Bytes
Binary file not shown.

data/imports85.rda

3 Bytes
Binary file not shown.

inst/CITATION

+5-12
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,11 @@
1-
citHeader("To cite randomForest in publications use:")
2-
3-
citEntry(entry="Article",
1+
bibentry("Article",
42
title = "Classification and Regression by randomForest",
5-
author = personList(person(family="Liaw", given="Andy"),
6-
person(family="Wiener", given="Matthew")),
3+
author = c(person(family="Liaw", given="Andy"),
4+
person(family="Wiener", given="Matthew")),
75
journal = "R News",
86
year = "2002",
97
volume = "2",
108
number = "3",
119
pages = "18-22",
12-
url = "https://CRAN.R-project.org/doc/Rnews/",
13-
14-
textVersion =
15-
paste("A. Liaw and M. Wiener (2002). ",
16-
"Classification and Regression by randomForest. ",
17-
"R News 2(3), 18--22.",
18-
sep=""))
10+
url = "https://CRAN.R-project.org/doc/Rnews/"
11+
)

man/imports85.Rd

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ data(imports85)
3333
Auto Manuals, Insurance Services Office, and Insurance Collision
3434
Report, Insurance Institute for Highway Safety.
3535
36-
The original data is at \url{http://www.ics.uci.edu/~mlearn/MLSummary.html}.
36+
The original data is at \doi{10.24432/C5B01C}.
3737
}
3838
\references{
3939
1985 Model Import Car and Truck Specifications, 1985 Ward's Automotive
@@ -62,4 +62,4 @@ numDoors.rf <- randomForest(numOfDoors ~ ., imp85, do.trace=10, ntree=100)
6262
print(numDoors.rf)
6363
}
6464
\author{Andy Liaw}
65-
\keyword{datasets}
65+
\keyword{datasets}

src/classTree.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
This program is free software; you can redistribute it and/or
55
modify it under the terms of the GNU General Public License
6-
as published by the Free Software Foundation; either version 2
6+
as published by the R_Free Software Foundation; either version 2
77
of the License, or (at your option) any later version.
88
99
This program is distributed in the hope that it will be useful,
@@ -305,7 +305,7 @@ void F77_NAME(catmax)(double *parentDen, double *tclasscat,
305305
int j, k, n, icat[MAX_CAT], nsplit;
306306
double leftNum, leftDen, rightNum, decGini, *leftCatClassCount;
307307

308-
leftCatClassCount = (double *) Calloc(*nclass, double);
308+
leftCatClassCount = (double *) R_Calloc(*nclass, double);
309309
*nhit = 0;
310310
nsplit = *lcat > *ncmax ?
311311
*ncsplit : (int) pow(2.0, (double) *lcat - 1) - 1;
@@ -348,7 +348,7 @@ void F77_NAME(catmax)(double *parentDen, double *tclasscat,
348348
*catsp = *lcat > *ncmax ? pack(*lcat, icat) : n + 1;
349349
}
350350
}
351-
Free(leftCatClassCount);
351+
R_Free(leftCatClassCount);
352352
}
353353

354354

@@ -424,7 +424,7 @@ void predictClassTree(double *x, int n, int mdim, int *treemap,
424424

425425
/* decode the categorical splits */
426426
if (maxcat > 1) {
427-
cbestsplit = (int *) Calloc(maxcat * treeSize, int);
427+
cbestsplit = (int *) R_Calloc(maxcat * treeSize, int);
428428
zeroInt(cbestsplit, maxcat * treeSize);
429429
for (i = 0; i < treeSize; ++i) {
430430
if (nodestatus[i] != NODE_TERMINAL) {
@@ -458,5 +458,5 @@ void predictClassTree(double *x, int n, int mdim, int *treemap,
458458
jts[i] = nodeclass[k];
459459
nodex[i] = k + 1;
460460
}
461-
if (maxcat > 1) Free(cbestsplit);
461+
if (maxcat > 1) R_Free(cbestsplit);
462462
}

src/regTree.c

+22-22
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
This program is free software; you can redistribute it and/or
55
modify it under the terms of the GNU General Public License
6-
as published by the Free Software Foundation; either version 2
6+
as published by the R_Free Software Foundation; either version 2
77
of the License, or (at your option) any later version.
88
99
This program is distributed in the hope that it will be useful,
@@ -35,16 +35,16 @@ void regTree(double *x, double *y, int mdim, int nsample, int *lDaughter,
3535
int ndstart, ndend, leftChildLastDataPoint, currentNodeCount, splitResult, msplit;
3636
double label, sumOfSquares, nodeMean, decsplit, ubest, sumOfNodeData;
3737

38-
nodestart = (int *) Calloc(numNodes, int);
39-
numPointsInEachNode = (int *) Calloc(numNodes, int);
38+
nodestart = (int *) R_Calloc(numNodes, int);
39+
numPointsInEachNode = (int *) R_Calloc(numNodes, int);
4040

4141
/* initialize some arrays for the tree */
4242
zeroInt(nodestatus, numNodes);
4343
zeroInt(nodestart, numNodes);
4444
zeroInt(numPointsInEachNode, numNodes);
4545
zeroDouble(nodeMeans, numNodes);
4646

47-
rowIndices = (int *) Calloc(nsample, int);
47+
rowIndices = (int *) R_Calloc(nsample, int);
4848
for (i = 1; i <= nsample; ++i){
4949
rowIndices[i-1] = i;
5050
}
@@ -164,9 +164,9 @@ void regTree(double *x, double *y, int mdim, int nsample, int *lDaughter,
164164
nodestatus[k] = NODE_TERMINAL;
165165
}
166166
}
167-
Free(nodestart);
168-
Free(rowIndices);
169-
Free(numPointsInEachNode);
167+
R_Free(nodestart);
168+
R_Free(rowIndices);
169+
R_Free(numPointsInEachNode);
170170
}
171171

172172
/*
@@ -181,13 +181,13 @@ void findBestSplit(double *x, int *jdex, double *y, int mdim, int nsample,
181181
int i, j, kv, l, *varIndices, *ncase;
182182
double *xt, *ut, *v, *yl, sumcat[MAX_CAT], avcat[MAX_CAT], tavcat[MAX_CAT], valueAtBestSplit;
183183
double crit, bestSplitForAllVariables, bestSplitWithinVariable, suml, sumr, d, critParent;
184-
/*Calloc is different from calloc, r handles memory allocation instead of os*/
185-
ut = (double *) Calloc(nsample, double);
186-
xt = (double *) Calloc(nsample, double);
187-
v = (double *) Calloc(nsample, double);
188-
yl = (double *) Calloc(nsample, double);
189-
varIndices = (int *) Calloc(mdim, int);
190-
ncase = (int *) Calloc(nsample, int);
184+
/*R_Calloc is different from calloc, r handles memory allocation instead of os*/
185+
ut = (double *) R_Calloc(nsample, double);
186+
xt = (double *) R_Calloc(nsample, double);
187+
v = (double *) R_Calloc(nsample, double);
188+
yl = (double *) R_Calloc(nsample, double);
189+
varIndices = (int *) R_Calloc(mdim, int);
190+
ncase = (int *) R_Calloc(nsample, int);
191191
zeroDouble(avcat, MAX_CAT);
192192
zeroDouble(tavcat, MAX_CAT);
193193

@@ -346,12 +346,12 @@ void findBestSplit(double *x, int *jdex, double *y, int mdim, int nsample,
346346
}
347347
} else *jstat = NODE_TERMINAL;
348348

349-
Free(ncase);
350-
Free(varIndices);
351-
Free(v);
352-
Free(yl);
353-
Free(xt);
354-
Free(ut);
349+
R_Free(ncase);
350+
R_Free(varIndices);
351+
R_Free(v);
352+
R_Free(yl);
353+
R_Free(xt);
354+
R_Free(ut);
355355
}
356356

357357
/*====================================================================*/
@@ -365,7 +365,7 @@ void predictRegTree(double *x, int nsample, int mdim,
365365

366366
/* decode the categorical splits */
367367
if (maxcat > 1) {
368-
cbestsplit = (int *) Calloc(maxcat * treeSize, int);
368+
cbestsplit = (int *) R_Calloc(maxcat * treeSize, int);
369369
zeroInt(cbestsplit, maxcat * treeSize);
370370
for (i = 0; i < treeSize; ++i) {
371371
if (nodestatus[i] != NODE_TERMINAL && cat[splitVar[i] - 1] > 1) {
@@ -398,5 +398,5 @@ void predictRegTree(double *x, int nsample, int mdim,
398398
ypred[i] = nodepred[k];
399399
nodex[i] = k + 1;
400400
}
401-
if (maxcat > 1) Free(cbestsplit);
401+
if (maxcat > 1) R_Free(cbestsplit);
402402
}

src/regrf.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
This program is free software; you can redistribute it and/or
55
modify it under the terms of the GNU General Public License
6-
as published by the Free Software Foundation; either version 2
6+
as published by the R_Free Software Foundation; either version 2
77
of the License, or (at your option) any later version.
88
99
This program is distributed in the hope that it will be useful,
@@ -144,7 +144,7 @@ void regRF(double *x, double *y, int *useweights, double *weights, int *xdim, in
144144
/*************************************
145145
* Start the loop over trees.
146146
*************************************/
147-
int *sampledIndices = (int*)Calloc(*sampsize,int);
147+
int *sampledIndices = (int*)R_Calloc(*sampsize,int);
148148
zeroInt(sampledIndices, *sampsize);
149149
for (j = 0; j < *nTree; ++j) {
150150
idx = keepF ? j * *nrnodes : 0;

src/rf.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Copyright (C) 2001-2012 Leo Breiman, Adele Cutler and Merck & Co., Inc.
33
44
This program is free software; you can redistribute it and/or
55
modify it under the terms of the GNU General Public License
6-
as published by the Free Software Foundation; either version 2
6+
as published by the R_Free Software Foundation; either version 2
77
of the License, or (at your option) any later version.
88
99
This program is distributed in the hope that it will be useful,
@@ -12,7 +12,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1212
GNU General Public License for more details.
1313
1414
You should have received a copy of the GNU General Public License
15-
along with this program; if not, write to the Free Software
15+
along with this program; if not, write to the R_Free Software
1616
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1717
1818
C driver for Breiman & Cutler's random forest code.

src/rfutils.c

+12-12
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
44
This program is free software; you can redistribute it and/or
55
modify it under the terms of the GNU General Public License
6-
as published by the Free Software Foundation; either version 2
6+
as published by the R_Free Software Foundation; either version 2
77
of the License, or (at your option) any later version.
88
99
This program is distributed in the hope that it will be useful,
@@ -64,8 +64,8 @@ void makeA(double *x, const int mdim, const int nsample, int *cat, int *a,
6464
int i, j, n1, n2, *index;
6565
double *v;
6666

67-
v = (double *) Calloc(nsample, double);
68-
index = (int *) Calloc(nsample, int);
67+
v = (double *) R_Calloc(nsample, double);
68+
index = (int *) R_Calloc(nsample, int);
6969

7070
for (i = 0; i < mdim; ++i) {
7171
if (cat[i] == 1) { /* numerical predictor */
@@ -92,8 +92,8 @@ void makeA(double *x, const int mdim, const int nsample, int *cat, int *a,
9292
a[i + j*mdim] = (int) x[i + j * mdim];
9393
}
9494
}
95-
Free(index);
96-
Free(v);
95+
R_Free(index);
96+
R_Free(v);
9797
}
9898

9999

@@ -185,7 +185,7 @@ void permuteOOB(int m, double *x, int *in, int nsample, int mdim) {
185185
double *tp, tmp;
186186
int i, last, k, nOOB = 0;
187187

188-
tp = (double *) Calloc(nsample, double);
188+
tp = (double *) R_Calloc(nsample, double);
189189

190190
for (i = 0; i < nsample; ++i) {
191191
/* make a copy of the OOB part of the data into tp (for permuting) */
@@ -212,7 +212,7 @@ void permuteOOB(int m, double *x, int *in, int nsample, int mdim) {
212212
nOOB++;
213213
}
214214
}
215-
Free(tp);
215+
R_Free(tp);
216216
}
217217

218218
/* Compute proximity. */
@@ -310,7 +310,7 @@ void sampleDataRows(int populationSize, int sampleSize, int useWeights,
310310
void sampleWithReplacementWithWeights(int sampleSize, int populationSize, double *weights, int *sampledIndices) {
311311
int mflag = 0;
312312
int numBoundaries = populationSize + 1;
313-
double *boundaries = (double*)Calloc(numBoundaries, double);
313+
double *boundaries = (double*)R_Calloc(numBoundaries, double);
314314
calculateBoundaries(weights, boundaries, populationSize, numBoundaries);
315315

316316
double sample;
@@ -331,14 +331,14 @@ void sampleWithoutReplacementWithWeights(int sampleSize, int populationSize, dou
331331
}*/
332332
int mflag = 0;
333333
int numBoundaries = populationSize + 1;
334-
double *weightsForTree = (double*)Calloc(populationSize, double);
334+
double *weightsForTree = (double*)R_Calloc(populationSize, double);
335335

336336
/*copy over weights to array so we don't mess with original weights when removing them*/
337337
for(int i = 0; i < populationSize; i++){
338338
weightsForTree[i] = weights[i];
339339
}
340-
double *boundaries = (double*)Calloc(numBoundaries, double);
341-
int *populationTaken = (int*)Calloc(populationSize, int);
340+
double *boundaries = (double*)R_Calloc(numBoundaries, double);
341+
int *populationTaken = (int*)R_Calloc(populationSize, int);
342342
zeroInt(populationTaken, populationSize);
343343
calculateBoundaries(weightsForTree, boundaries, populationSize, numBoundaries);
344344
int first;
@@ -365,7 +365,7 @@ void sampleWithReplacement(int sampleSize, int populationSize, int *sampledIndic
365365
}
366366

367367
void sampleWithoutReplacement(int sampleSize, int populationSize, int *sampledIndices) {
368-
int *indices = (int*)Calloc(populationSize, int);
368+
int *indices = (int*)R_Calloc(populationSize, int);
369369
for(int i = 0; i < populationSize; ++i) {
370370
indices[i] = i;
371371
}

0 commit comments

Comments
 (0)