Skip to content

Commit 69f52b0

Browse files
committed
Revert "version bump 0.8.3"
This reverts commit 128a349.
1 parent 128a349 commit 69f52b0

9 files changed

+20
-180
lines changed

DESCRIPTION

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: structToolbox
22
Type: Package
33
Title: Some tools bult using the struct package
4-
Version: 0.8.3
4+
Version: 0.8.2
55
Author: Gavin Rhys Lloyd
66
Maintainer: Gavin Rhys Lloyd <[email protected]>
77
Description: Extends the class templates provided by the struct package to provide methods for training PCA, PLS models with cross-validation, permutation testing etc.
@@ -44,7 +44,6 @@ Collate:
4444
'glog_class.R'
4545
'grid_search_1d_class.R'
4646
'hca_class.R'
47-
'kfold_xval2_class.R'
4847
'kfold_xval_class.R'
4948
'kfold_xval_charts.R'
5049
'knn_impute_class.R'
@@ -76,7 +75,7 @@ Collate:
7675
'vec_norm_class.R'
7776
'wilcox_test_class.R'
7877
'zzz.R'
79-
Depends: struct (>= 0.4.1), struct(< 0.5.0)
78+
Depends: struct (== 0.4.1)
8079
Imports: ggplot2,
8180
pmp,
8281
gridExtra,
@@ -104,7 +103,7 @@ Suggests:
104103
sbcms,
105104
Rtsne
106105
Remotes: computational-metabolomics/pmp,
107-
computational-metabolomics/struct,
106+
computational-metabolomics/struct@v0.4.1,
108107
computational-metabolomics/sbcms
109108
VignetteBuilder: knitr
110109
biocViews: WorkflowStep

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ export(grid_search_1d)
4242
export(gs_line)
4343
export(hca_dendrogram)
4444
export(kfold_xval)
45-
export(kfold_xval2)
4645
export(kfoldxcv_grid)
4746
export(kfoldxcv_metric)
4847
export(knn_impute)

R/PCA_class.R

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ PCA<-setClass(
1919
outputs.eigenvalues='data.frame',
2020
outputs.ssx='numeric',
2121
outputs.correlation='data.frame',
22-
outputs.that='dataset',
23-
outputs.xhat='dataset'
22+
outputs.that='dataset'
2423
),
2524
prototype = list(name='Principal Component Analysis (PCA)',
2625
description='PCA is a multivariate data reduction technique. It summarises the data in a smaller number of Principal Components that describe the maximum variation present in the dataset.',
@@ -108,12 +107,6 @@ setMethod(f="model.predict",
108107
dataset.data(S)=that
109108
output.value(M,'that')=S
110109

111-
xhat=as.matrix(that)%*%as.matrix(t(P))
112-
xhat=as.data.frame(xhat)
113-
rownames(that)=rownames(X)
114-
colnames(xhat)=colnames(X)
115-
M$xhat=dataset(data=xhat,sample_meta=D$sample_meta,variable_meta=D$variable_meta)
116-
117110
return(M)
118111
}
119112
)

R/forward_selection_by_rank_class.R

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ eval_loess=function(x,X,Y,k=10,p=0.66)
167167
# Y = observed values
168168
# k = number of replicates
169169
# p = proportion in training
170+
170171
residual=numeric(k)
171172
for (i in 1:k)
172173
{
@@ -180,16 +181,9 @@ eval_loess=function(x,X,Y,k=10,p=0.66)
180181
yy2=Y[X %in% xx2]
181182

182183

183-
loessMod <- loess(yy ~ xx, span=x)
184-
185-
# check for NaN
186-
if (any(is.nan(loessMod$fitted))){
187-
residual[i]=99999
188-
} else {
189-
190-
smoothed=stats::predict(loessMod,newdata=xx2)
191-
residual[i]=sum((smoothed-yy2)^2)
192-
}
184+
loessMod <- loess(yy ~ xx, span=x) # 25% smoothing span
185+
smoothed=stats::predict(loessMod,newdata=xx2)
186+
residual[i]=sum((smoothed-yy2)^2)
193187
}
194188
return(sqrt(mean(residual)))
195189
}

R/kfold_xval2_class.R

Lines changed: 0 additions & 128 deletions
This file was deleted.

R/permutation_test2_class.R

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ permutation_test2<-setClass(
1111
slots=c(
1212
params.number_of_permutations='numeric',
1313
params.collect='character',
14-
outputs.metric_permuted='data.frame',
15-
outputs.metric_unpermuted='data.frame',
14+
outputs.results.permuted='data.frame',
15+
outputs.results.unpermuted='data.frame',
16+
outputs.metric='data.frame',
1617
outputs.collected='entity'
1718
),
1819
prototype = list(name='permutation test',
@@ -39,6 +40,9 @@ setMethod(f="run",
3940
WF=models(I)
4041
n=param.value(I,'number_of_permutations')
4142

43+
all_results_permuted=data.frame('actual'=rep(y[,1],n),'predicted'=rep(y[,1],n),'permutation'=0)
44+
all_results_unpermuted=data.frame('actual'=rep(y[,1],n),'predicted'=rep(y[,1],n),'permutation'=0)
45+
4246
collected=list(permuted=list(),unpermuted=list())
4347

4448
for (i in 1:n)
@@ -138,8 +142,8 @@ setMethod(f="run",
138142

139143
}
140144
# store results
141-
output.value(I,'metric_permuted')=all_results_permuted
142-
output.value(I,'metric_unpermuted')=all_results_unpermuted
145+
output.value(I,'results.permuted')=all_results_permuted
146+
output.value(I,'results.unpermuted')=all_results_unpermuted
143147
return(I)
144148
}
145149
)

R/r_squared_class.R

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,9 @@ setMethod(f="calculate",
1919
signature=c('r_squared'),
2020
definition=function(obj,Y,Yhat)
2121
{
22-
23-
M=matrix(colMeans(Y),nrow=1)
24-
O=matrix(1,nrow=nrow(Y),ncol=1)
25-
M=O %*% M
26-
27-
SSR = sum(sum((Yhat-M)^2))
28-
SSE = sum(sum((Y-Yhat)^2))
29-
SSTO = sum(sum((Y-M)^2))
22+
SSR = sum((Yhat-mean(Y))^2)
23+
SSE = sum((Y-Yhat)^2)
24+
SSTO = sum((Y-mean(Y))^2)
3025

3126
R2=1-(SSE/SSTO)
3227

man/kfold_xval2-class.Rd

Lines changed: 0 additions & 13 deletions
This file was deleted.

man/run.Rd

Lines changed: 1 addition & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)