-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed FLIBS from Makevars and included new file sits_predictors
- Loading branch information
1 parent
87ac3b7
commit 4f12ca7
Showing
10 changed files
with
364 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
#' @title Obtain predictors for time series samples | ||
#' @name sits_predictors | ||
#' @author Gilberto Camara, \email{gilberto.camara@@inpe.br} | ||
#' @description Predictors are X-Y values required for machine learning | ||
#' algorithms, organized as a data table where each row corresponds | ||
#' to a training sample. The first two columns of the predictors table | ||
#' are categorical ("label_id" and "label"). The other columns are | ||
#' the values of each band and time, organized first by band and then by time. | ||
#' | ||
#' | ||
#' @param samples Time series in sits format | ||
#' | ||
#' | ||
#' @return The predictors for the sample: a data.frame with one row per sample. | ||
#' | ||
#' @note | ||
#' Please refer to the sits documentation available in | ||
#' <https://e-sensing.github.io/sitsbook/> for detailed examples. | ||
#' @examples | ||
#' if (sits_run_examples()) { | ||
#' summary(samples_modis_ndvi) | ||
#' } | ||
#' | ||
#' @export | ||
sits_predictors <- function(samples) { | ||
pred <- .predictors(samples) | ||
} | ||
|
||
#' @title Obtain numerical values of predictors for time series samples | ||
#' @name sits_pred_features | ||
#' @author Gilberto Camara, \email{gilberto.camara@@inpe.br} | ||
#' @description Predictors are X-Y values required for machine learning | ||
#' algorithms, organized as a data table where each row corresponds | ||
#' to a training sample. The first two columns of the predictors table | ||
#' are categorical ("label_id" and "label"). The other columns are | ||
#' the values of each band and time, organized first by band and then by time. | ||
#' This function returns the numeric values associated to each sample. | ||
#' | ||
#' @param pred X-Y predictors: a data.table with one row per sample. | ||
#' | ||
#' @return The Y predictors for the sample: a data.frame with one row per sample. | ||
#' | ||
#' @note | ||
#' Please refer to the sits documentation available in | ||
#' <https://e-sensing.github.io/sitsbook/> for detailed examples. | ||
#' @examples | ||
#' if (sits_run_examples()) { | ||
#' summary(samples_modis_ndvi) | ||
#' } | ||
#' | ||
#' @export | ||
sits_pred_features <- function(pred){ | ||
features <- .pred_features(pred) | ||
} | ||
#' @title Obtain categorical id and labels of predictors for time series samples | ||
#' @name sits_pred_reference | ||
#' @author Gilberto Camara, \email{gilberto.camara@@inpe.br} | ||
#' @description Predictors are X-Y values required for machine learning | ||
#' algorithms, organized as a data table where each row corresponds | ||
#' to a training sample. The first two columns of the predictors table | ||
#' are categorical ("label_id" and "label"). The other columns are | ||
#' the values of each band and time, organized first by band and then by time. | ||
#' This function returns the numeric values associated to each sample. | ||
#' | ||
#' @param pred X-Y predictors: a data.table with one row per sample. | ||
#' | ||
#' @return The label associated to each training sample. | ||
#' | ||
#' @note | ||
#' Please refer to the sits documentation available in | ||
#' <https://e-sensing.github.io/sitsbook/> for detailed examples. | ||
#' @examples | ||
#' if (sits_run_examples()) { | ||
#' summary(samples_modis_ndvi) | ||
#' } | ||
sits_pred_references <- function(pred){ | ||
ref <- .pred_references(pred) | ||
} | ||
#' @title Normalize predictor values | ||
#' @name sits_pred_normalize | ||
#' @author Gilberto Camara, \email{gilberto.camara@@inpe.br} | ||
#' @description Most machine learning algorithms require data to be | ||
#' normalized. This applies to the "SVM" method and to all deep learning ones. | ||
#' To normalize the predictors, it is required that the statistics per band | ||
#' for each sample have been obtained by the "sits_stats" function. | ||
#' | ||
#' @param pred X-Y predictors: a data.table with one row per sample. | ||
#' @param stats The output of the "sits_stats" function applied to the samples. | ||
#' | ||
#' @return A normalized set of predictor values | ||
#' | ||
#' @note | ||
#' Please refer to the sits documentation available in | ||
#' <https://e-sensing.github.io/sitsbook/> for detailed examples. | ||
#' @examples | ||
#' if (sits_run_examples()) { | ||
#' summary(samples_modis_ndvi) | ||
#' } | ||
sits_pred_normalize <- function(pred, stats) { | ||
pred <- .pred_normalize(pred, stats) | ||
} | ||
#' @title Obtain a fraction of the predictors data frame | ||
#' @name sits_pred_sample | ||
#' @author Gilberto Camara, \email{gilberto.camara@@inpe.br} | ||
#' @description Many machine learning algorithms (especially deep learning) | ||
#' use part of the original samples as test data to adjust its hyperparameters | ||
#' and to find an optimal point of convergence using gradient descent. | ||
#' This function extracts a fraction of the predictors to serve as test values | ||
#' for the deep learning algorithm. | ||
#' | ||
#' @param pred X-Y predictors: a data.table with one row per sample. | ||
#' @param frac Fraction of the X-Y predictors to be extracted | ||
#' | ||
#' @return A fraction of the X-Y predictors. | ||
#' | ||
#' @note | ||
#' Please refer to the sits documentation available in | ||
#' <https://e-sensing.github.io/sitsbook/> for detailed examples. | ||
#' @examples | ||
#' if (sits_run_examples()) { | ||
#' summary(samples_modis_ndvi) | ||
#' } | ||
sits_pred_sample <- function(pred, frac){ | ||
sample <- .pred_sample(pred, frac) | ||
} | ||
#' @title Obtain statistics for all sample bands | ||
#' @name sits_stats | ||
#' @author Gilberto Camara, \email{gilberto.camara@@inpe.br} | ||
#' @description Most machine learning algorithms require data to be | ||
#' normalized. This applies to the "SVM" method and to all deep learning ones. | ||
#' To normalize the predictors, it is necessary to extract the statistics | ||
#' of each band of the samples. This function computes the 2% and 98% quantiles | ||
#' of the distribution of each band of the samples. This values are used as | ||
#' minimum and maximum values in the normalization operation performed by | ||
#' the sits_pred_normalize() function. | ||
#' | ||
#' @param samples Time series samples uses as training data. | ||
#' | ||
#' @return A list with the 2% and 98% quantiles for each band of the | ||
#' training data. | ||
#' | ||
#' @note | ||
#' Please refer to the sits documentation available in | ||
#' <https://e-sensing.github.io/sitsbook/> for detailed examples. | ||
#' @examples | ||
#' if (sits_run_examples()) { | ||
#' summary(samples_modis_ndvi) | ||
#' } | ||
sits_stats <- function(samples){ | ||
stats <- .sits_stats(samples) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# CXX_STD = CXX11 | ||
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) | ||
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) | ||
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) |