Browse code

PLS updates (#64)

* add selectivity ratio

* replace vip_summary with feature_importance
renamed and now allows vip, sr and sr_pvalues to be plotted

* add equal_split model
random subsets so generate training sets with equal group numbers

* plot 1 - p-value
to conform with the "best" feature being a maximum value

* add resample iterator
subsample at random over a number of iterations. Option to use
different kinds of splitting methods. Corresponding chart.

* allow use of list() for factor_name

* force apply not to simplify output to guarantee returning a list

* update example

* add correct parameter
collect will collect the requested model output over all iterations in a list WORK IN PROGRESS

* add collection of multiple outputs of model sequence

* plot reg coeff on rhs

* match outputs of xval for use with grid search etc

* specify levels when converting predictions to factor

* change PLSDA to inherit from PLSR
rename some charts to be compatible with both PLSR and PLSDA

* allow y-block column selection

* re-assign y output after PLSR with factor

* update vignettes wrt PLS changes

* update documentation

* update R version to 4.1

* update documentation

* update documentation

* update scatter plot

- new scatter chart object
- used by PCA scores, PLSR/PLSDA scores
- other charts updated to reflect changes in scores plots where necessary
- added ycol param to plots for when y-block is a matrix

* add url to github

* add plsda scores alias

- plsda_scores_plot and pls_scores_plot do that same thing
Included for backwards compatability
- added components back as parameter for scores plots for backwards compatibility

* fix broken example

* fix broken tests

- scores is now returned as a DatasetExperiment object not a data.frame

* Update data_analysis_omics_using_the_structtoolbox.Rmd

- wrt changes in scores plots

* update documentation

* fix colnames for Y matrix

Gavin Rhys Lloyd authored on 28/02/2022 12:38:08 • GitHub committed on 28/02/2022 12:38:08
Showing 1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 % Please edit documentation in R/bootstrap_class.R,
3 3
 %   R/forward_selection_by_rank_class.R, R/grid_search_1d_class.R,
4 4
 %   R/kfold_xval_class.R, R/permutation_test_class.R,
5
-%   R/permute_sample_order_class.R, R/run_doc.R
5
+%   R/permute_sample_order_class.R, R/resample_class.R, R/run_doc.R
6 6
 \name{run,bootstrap,DatasetExperiment,metric-method}
7 7
 \alias{run,bootstrap,DatasetExperiment,metric-method}
8 8
 \alias{run,forward_selection_by_rank,DatasetExperiment,metric-method}
... ...
@@ -10,6 +10,7 @@
10 10
 \alias{run,kfold_xval,DatasetExperiment,metric-method}
11 11
 \alias{run,permutation_test,DatasetExperiment,metric-method}
12 12
 \alias{run,permute_sample_order,DatasetExperiment,metric-method}
13
+\alias{run,resample,DatasetExperiment,metric-method}
13 14
 \alias{run}
14 15
 \title{Runs an iterator, applying the chosen model multiple times.}
15 16
 \usage{
... ...
@@ -24,6 +25,8 @@
24 25
 \S4method{run}{permutation_test,DatasetExperiment,metric}(I, D, MET = NULL)
25 26
 
26 27
 \S4method{run}{permute_sample_order,DatasetExperiment,metric}(I, D, MET)
28
+
29
+\S4method{run}{resample,DatasetExperiment,metric}(I, D, MET)
27 30
 }
28 31
 \arguments{
29 32
 \item{I}{an iterator object}
Browse code

Release 3 12 candidate (#32)

* fix base=10 regardless of input (see #15)

class constructor was always setting base to 10 instead of the input value

* merge bug fix 1.01 into dev (#19)

* bug fix issue #7

Correctly re-order the sample_meta column for colouring samples in the dendrogram plot

* version bump

bug fix issue #7

* fix for https://github.com/computational-metabolomics/structToolbox/issues/18 (#20)

correctly reorder the factor labels so that the control group always ends up in the denominator for the fold change calculation.

* fix for https://github.com/computational-metabolomics/structToolbox/issues/18

fixed incorrect length check on matching class labels.

* Issue 17 ttest factor (#21)

* convert to factor if not one already

fix for issue #17

* update roxygen version

* fix for issue #9 (#22)

changed from lapply to vapply and used drop=FALSE to ensure compatibility with a single factor.

* allow user to set lambda (#24)

- lambda changed to input parameter. NULL = uses pmp optimisation
- model_predict now uses the set value of lambda, or lambda_opt if used.
- documentation updated

* Feature non parametric fold change (#26)

* add "median" method

based on DOI: 10.1080/00949650212140 can now calcuate fold changes equivalent to using medians and corresponding confidence intervals

* update documentation

* update median method

now correctly calculates ratio of medians

* use wilcox for paired median intervals

make use of wilcox.test to estimate intervals for the median when using median for paired samples

* Issue 23 filter by name (#27)

* fix for #23

moved all model_apply functionality to model_predict so that model_train and model_predict can be used as well as model_apply

* update documentation

* Update mean_of_medians.R (#29)

fix for #28
- correctly loop over all levels in the named factor

* Feature documentation 3 12 (#31)

* update documentation

Description and inputs now pulled from the object definitions for consistency.

* fix definition of label_features

allows NULL and description updated

* replace non ascii characters

* export mixed_effect object

* use correct object name to generate documentation

* export mixed_effect object

* remove non ascii characters

* update tests with new object name

* add import for capture.output

* add import for capture.output

* use pca_biplot in tests

chart was renamed

* add utils import

* update struct dependency version

* update documentation

* update news, version bump

Gavin Rhys Lloyd authored on 25/10/2020 08:50:13 • GitHub committed on 25/10/2020 08:50:13
Showing 1 changed files
... ...
@@ -5,7 +5,7 @@
5 5
 %   R/permute_sample_order_class.R, R/run_doc.R
6 6
 \name{run,bootstrap,DatasetExperiment,metric-method}
7 7
 \alias{run,bootstrap,DatasetExperiment,metric-method}
8
-\alias{run,forward_selection_byrank,DatasetExperiment,metric-method}
8
+\alias{run,forward_selection_by_rank,DatasetExperiment,metric-method}
9 9
 \alias{run,grid_search_1d,DatasetExperiment,metric-method}
10 10
 \alias{run,kfold_xval,DatasetExperiment,metric-method}
11 11
 \alias{run,permutation_test,DatasetExperiment,metric-method}
... ...
@@ -15,7 +15,7 @@
15 15
 \usage{
16 16
 \S4method{run}{bootstrap,DatasetExperiment,metric}(I, D, MET = NULL)
17 17
 
18
-\S4method{run}{forward_selection_byrank,DatasetExperiment,metric}(I, D, MET)
18
+\S4method{run}{forward_selection_by_rank,DatasetExperiment,metric}(I, D, MET)
19 19
 
20 20
 \S4method{run}{grid_search_1d,DatasetExperiment,metric}(I, D, MET)
21 21
 
Browse code

update documentation

Gavin Rhys Lloyd authored on 23/03/2020 13:53:17
Showing 1 changed files
... ...
@@ -31,8 +31,6 @@
31 31
 \item{D}{a DatasetExperiment object}
32 32
 
33 33
 \item{MET}{a metric object}
34
-
35
-\item{...}{additional slots and values passed to struct_class}
36 34
 }
37 35
 \value{
38 36
 Modified iterator object
Browse code

update to use new struct class constructors

Gavin Rhys Lloyd authored on 06/02/2020 13:51:52
Showing 1 changed files
... ...
@@ -1,14 +1,13 @@
1 1
 % Generated by roxygen2: do not edit by hand
2 2
 % Please edit documentation in R/bootstrap_class.R,
3 3
 %   R/forward_selection_by_rank_class.R, R/grid_search_1d_class.R,
4
-%   R/kfold_xval_class.R, R/permutation_test2_class.R,
5
-%   R/permutation_test_class.R, R/permute_sample_order_class.R, R/run_doc.R
4
+%   R/kfold_xval_class.R, R/permutation_test_class.R,
5
+%   R/permute_sample_order_class.R, R/run_doc.R
6 6
 \name{run,bootstrap,DatasetExperiment,metric-method}
7 7
 \alias{run,bootstrap,DatasetExperiment,metric-method}
8 8
 \alias{run,forward_selection_byrank,DatasetExperiment,metric-method}
9 9
 \alias{run,grid_search_1d,DatasetExperiment,metric-method}
10 10
 \alias{run,kfold_xval,DatasetExperiment,metric-method}
11
-\alias{run,permutation_test2,DatasetExperiment,metric-method}
12 11
 \alias{run,permutation_test,DatasetExperiment,metric-method}
13 12
 \alias{run,permute_sample_order,DatasetExperiment,metric-method}
14 13
 \alias{run}
... ...
@@ -22,8 +21,6 @@
22 21
 
23 22
 \S4method{run}{kfold_xval,DatasetExperiment,metric}(I, D, MET = NULL)
24 23
 
25
-\S4method{run}{permutation_test2,DatasetExperiment,metric}(I, D, MET = NULL)
26
-
27 24
 \S4method{run}{permutation_test,DatasetExperiment,metric}(I, D, MET = NULL)
28 25
 
29 26
 \S4method{run}{permute_sample_order,DatasetExperiment,metric}(I, D, MET)
Browse code

incremental changes to use struct class constructors

Gavin Rhys Lloyd authored on 04/02/2020 17:18:11
Showing 1 changed files
... ...
@@ -35,7 +35,7 @@
35 35
 
36 36
 \item{MET}{a metric object}
37 37
 
38
-\item{...}{slots and values for the new object}
38
+\item{...}{additional slots and values passed to struct_class}
39 39
 }
40 40
 \value{
41 41
 Modified iterator object
Browse code

fix broken tests and...

...update some documentation

Gavin Rhys Lloyd authored on 17/12/2019 17:24:38
Showing 1 changed files
... ...
@@ -34,6 +34,8 @@
34 34
 \item{D}{a DatasetExperiment object}
35 35
 
36 36
 \item{MET}{a metric object}
37
+
38
+\item{...}{slots and values for the new object}
37 39
 }
38 40
 \value{
39 41
 Modified iterator object
Browse code

use class contructors and...

...rename all function with dot to underscore
replace dataset with DatasetExperiment

Gavin Rhys Lloyd authored on 17/12/2019 15:48:01
Showing 1 changed files
... ...
@@ -3,36 +3,35 @@
3 3
 %   R/forward_selection_by_rank_class.R, R/grid_search_1d_class.R,
4 4
 %   R/kfold_xval_class.R, R/permutation_test2_class.R,
5 5
 %   R/permutation_test_class.R, R/permute_sample_order_class.R, R/run_doc.R
6
-\docType{methods}
7
-\name{run,bootstrap,dataset,metric-method}
8
-\alias{run,bootstrap,dataset,metric-method}
9
-\alias{run,forward_selection_byrank,dataset,metric-method}
10
-\alias{run,grid_search_1d,dataset,metric-method}
11
-\alias{run,kfold_xval,dataset,metric-method}
12
-\alias{run,permutation_test2,dataset,metric-method}
13
-\alias{run,permutation_test,dataset,metric-method}
14
-\alias{run,permute_sample_order,dataset,metric-method}
6
+\name{run,bootstrap,DatasetExperiment,metric-method}
7
+\alias{run,bootstrap,DatasetExperiment,metric-method}
8
+\alias{run,forward_selection_byrank,DatasetExperiment,metric-method}
9
+\alias{run,grid_search_1d,DatasetExperiment,metric-method}
10
+\alias{run,kfold_xval,DatasetExperiment,metric-method}
11
+\alias{run,permutation_test2,DatasetExperiment,metric-method}
12
+\alias{run,permutation_test,DatasetExperiment,metric-method}
13
+\alias{run,permute_sample_order,DatasetExperiment,metric-method}
15 14
 \alias{run}
16 15
 \title{Runs an iterator, applying the chosen model multiple times.}
17 16
 \usage{
18
-\S4method{run}{bootstrap,dataset,metric}(I, D, MET = NULL)
17
+\S4method{run}{bootstrap,DatasetExperiment,metric}(I, D, MET = NULL)
19 18
 
20
-\S4method{run}{forward_selection_byrank,dataset,metric}(I, D, MET)
19
+\S4method{run}{forward_selection_byrank,DatasetExperiment,metric}(I, D, MET)
21 20
 
22
-\S4method{run}{grid_search_1d,dataset,metric}(I, D, MET)
21
+\S4method{run}{grid_search_1d,DatasetExperiment,metric}(I, D, MET)
23 22
 
24
-\S4method{run}{kfold_xval,dataset,metric}(I, D, MET = NULL)
23
+\S4method{run}{kfold_xval,DatasetExperiment,metric}(I, D, MET = NULL)
25 24
 
26
-\S4method{run}{permutation_test2,dataset,metric}(I, D, MET = NULL)
25
+\S4method{run}{permutation_test2,DatasetExperiment,metric}(I, D, MET = NULL)
27 26
 
28
-\S4method{run}{permutation_test,dataset,metric}(I, D, MET = NULL)
27
+\S4method{run}{permutation_test,DatasetExperiment,metric}(I, D, MET = NULL)
29 28
 
30
-\S4method{run}{permute_sample_order,dataset,metric}(I, D, MET)
29
+\S4method{run}{permute_sample_order,DatasetExperiment,metric}(I, D, MET)
31 30
 }
32 31
 \arguments{
33 32
 \item{I}{an iterator object}
34 33
 
35
-\item{D}{a dataset object}
34
+\item{D}{a DatasetExperiment object}
36 35
 
37 36
 \item{MET}{a metric object}
38 37
 }
... ...
@@ -40,13 +39,13 @@
40 39
 Modified iterator object
41 40
 }
42 41
 \description{
43
-Running an iterator will apply the iterator a number of times to a dataset.
42
+Running an iterator will apply the iterator a number of times to a DatasetExperiment.
44 43
 For example, in cross-validation the same model is applied multiple times to
45 44
 the same data, splitting it into training and test sets. The input metric
46 45
 object can be calculated and collected for each iteration as an output.
47 46
 }
48 47
 \examples{
49
-D = iris_dataset() # get some data
48
+D = iris_DatasetExperiment() # get some data
50 49
 MET = metric()  # use a metric
51 50
 I = example_iterator() # initialise iterator
52 51
 models(I) = example_model() # set the model
Browse code

Revert "version bump 0.8.3"

This reverts commit 128a3495f9b0a02a9ba8711527d1616406485b29.

Gavin Rhys Lloyd authored on 19/11/2019 09:40:22
Showing 1 changed files
... ...
@@ -1,14 +1,13 @@
1 1
 % Generated by roxygen2: do not edit by hand
2 2
 % Please edit documentation in R/bootstrap_class.R,
3 3
 %   R/forward_selection_by_rank_class.R, R/grid_search_1d_class.R,
4
-%   R/kfold_xval2_class.R, R/kfold_xval_class.R, R/permutation_test2_class.R,
4
+%   R/kfold_xval_class.R, R/permutation_test2_class.R,
5 5
 %   R/permutation_test_class.R, R/permute_sample_order_class.R, R/run_doc.R
6 6
 \docType{methods}
7 7
 \name{run,bootstrap,dataset,metric-method}
8 8
 \alias{run,bootstrap,dataset,metric-method}
9 9
 \alias{run,forward_selection_byrank,dataset,metric-method}
10 10
 \alias{run,grid_search_1d,dataset,metric-method}
11
-\alias{run,kfold_xval2,dataset,metric-method}
12 11
 \alias{run,kfold_xval,dataset,metric-method}
13 12
 \alias{run,permutation_test2,dataset,metric-method}
14 13
 \alias{run,permutation_test,dataset,metric-method}
... ...
@@ -22,8 +21,6 @@
22 21
 
23 22
 \S4method{run}{grid_search_1d,dataset,metric}(I, D, MET)
24 23
 
25
-\S4method{run}{kfold_xval2,dataset,metric}(I, D, MET = NULL)
26
-
27 24
 \S4method{run}{kfold_xval,dataset,metric}(I, D, MET = NULL)
28 25
 
29 26
 \S4method{run}{permutation_test2,dataset,metric}(I, D, MET = NULL)
Browse code

version bump 0.8.3

also force struct version between 0.4.1 and 0.5.0

Gavin Rhys Lloyd authored on 19/11/2019 09:40:14
Showing 1 changed files
... ...
@@ -1,13 +1,14 @@
1 1
 % Generated by roxygen2: do not edit by hand
2 2
 % Please edit documentation in R/bootstrap_class.R,
3 3
 %   R/forward_selection_by_rank_class.R, R/grid_search_1d_class.R,
4
-%   R/kfold_xval_class.R, R/permutation_test2_class.R,
4
+%   R/kfold_xval2_class.R, R/kfold_xval_class.R, R/permutation_test2_class.R,
5 5
 %   R/permutation_test_class.R, R/permute_sample_order_class.R, R/run_doc.R
6 6
 \docType{methods}
7 7
 \name{run,bootstrap,dataset,metric-method}
8 8
 \alias{run,bootstrap,dataset,metric-method}
9 9
 \alias{run,forward_selection_byrank,dataset,metric-method}
10 10
 \alias{run,grid_search_1d,dataset,metric-method}
11
+\alias{run,kfold_xval2,dataset,metric-method}
11 12
 \alias{run,kfold_xval,dataset,metric-method}
12 13
 \alias{run,permutation_test2,dataset,metric-method}
13 14
 \alias{run,permutation_test,dataset,metric-method}
... ...
@@ -21,6 +22,8 @@
21 22
 
22 23
 \S4method{run}{grid_search_1d,dataset,metric}(I, D, MET)
23 24
 
25
+\S4method{run}{kfold_xval2,dataset,metric}(I, D, MET = NULL)
26
+
24 27
 \S4method{run}{kfold_xval,dataset,metric}(I, D, MET = NULL)
25 28
 
26 29
 \S4method{run}{permutation_test2,dataset,metric}(I, D, MET = NULL)
Browse code

add functions for boostrapping and a modified permutaion test

Gavin Lloyd (College of Medical and Dental Sciences) authored on 31/10/2019 11:54:39
Showing 1 changed files
... ...
@@ -1,23 +1,30 @@
1 1
 % Generated by roxygen2: do not edit by hand
2
-% Please edit documentation in R/forward_selection_by_rank_class.R,
3
-%   R/grid_search_1d_class.R, R/kfold_xval_class.R, R/permutation_test_class.R,
4
-%   R/permute_sample_order_class.R, R/run_doc.R
2
+% Please edit documentation in R/bootstrap_class.R,
3
+%   R/forward_selection_by_rank_class.R, R/grid_search_1d_class.R,
4
+%   R/kfold_xval_class.R, R/permutation_test2_class.R,
5
+%   R/permutation_test_class.R, R/permute_sample_order_class.R, R/run_doc.R
5 6
 \docType{methods}
6
-\name{run,forward_selection_byrank,dataset,metric-method}
7
+\name{run,bootstrap,dataset,metric-method}
8
+\alias{run,bootstrap,dataset,metric-method}
7 9
 \alias{run,forward_selection_byrank,dataset,metric-method}
8 10
 \alias{run,grid_search_1d,dataset,metric-method}
9 11
 \alias{run,kfold_xval,dataset,metric-method}
12
+\alias{run,permutation_test2,dataset,metric-method}
10 13
 \alias{run,permutation_test,dataset,metric-method}
11 14
 \alias{run,permute_sample_order,dataset,metric-method}
12 15
 \alias{run}
13 16
 \title{Runs an iterator, applying the chosen model multiple times.}
14 17
 \usage{
18
+\S4method{run}{bootstrap,dataset,metric}(I, D, MET = NULL)
19
+
15 20
 \S4method{run}{forward_selection_byrank,dataset,metric}(I, D, MET)
16 21
 
17 22
 \S4method{run}{grid_search_1d,dataset,metric}(I, D, MET)
18 23
 
19 24
 \S4method{run}{kfold_xval,dataset,metric}(I, D, MET = NULL)
20 25
 
26
+\S4method{run}{permutation_test2,dataset,metric}(I, D, MET = NULL)
27
+
21 28
 \S4method{run}{permutation_test,dataset,metric}(I, D, MET = NULL)
22 29
 
23 30
 \S4method{run}{permute_sample_order,dataset,metric}(I, D, MET)
Browse code

update documentation and roxygen templates

grlloyd authored on 23/09/2019 14:26:49
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,47 @@
1
+% Generated by roxygen2: do not edit by hand
2
+% Please edit documentation in R/forward_selection_by_rank_class.R,
3
+%   R/grid_search_1d_class.R, R/kfold_xval_class.R, R/permutation_test_class.R,
4
+%   R/permute_sample_order_class.R, R/run_doc.R
5
+\docType{methods}
6
+\name{run,forward_selection_byrank,dataset,metric-method}
7
+\alias{run,forward_selection_byrank,dataset,metric-method}
8
+\alias{run,grid_search_1d,dataset,metric-method}
9
+\alias{run,kfold_xval,dataset,metric-method}
10
+\alias{run,permutation_test,dataset,metric-method}
11
+\alias{run,permute_sample_order,dataset,metric-method}
12
+\alias{run}
13
+\title{Runs an iterator, applying the chosen model multiple times.}
14
+\usage{
15
+\S4method{run}{forward_selection_byrank,dataset,metric}(I, D, MET)
16
+
17
+\S4method{run}{grid_search_1d,dataset,metric}(I, D, MET)
18
+
19
+\S4method{run}{kfold_xval,dataset,metric}(I, D, MET = NULL)
20
+
21
+\S4method{run}{permutation_test,dataset,metric}(I, D, MET = NULL)
22
+
23
+\S4method{run}{permute_sample_order,dataset,metric}(I, D, MET)
24
+}
25
+\arguments{
26
+\item{I}{an iterator object}
27
+
28
+\item{D}{a dataset object}
29
+
30
+\item{MET}{a metric object}
31
+}
32
+\value{
33
+Modified iterator object
34
+}
35
+\description{
36
+Running an iterator will apply the iterator a number of times to a dataset.
37
+For example, in cross-validation the same model is applied multiple times to
38
+the same data, splitting it into training and test sets. The input metric
39
+object can be calculated and collected for each iteration as an output.
40
+}
41
+\examples{
42
+D = iris_dataset() # get some data
43
+MET = metric()  # use a metric
44
+I = example_iterator() # initialise iterator
45
+models(I) = example_model() # set the model
46
+I = run(I,D,MET) # run
47
+}