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
#' @author Yonatan Tarazona Coronel | |
#' | |
# DETECCION DE CAMBIOS CON SERIES TEMPORALES Y MACHINE LEARNING - TELEDETECCION | |
## 1. APRENDIZAJE SUPERVISADO | |
### PASOS | |
#### i. Imágenes y librerías en R | |
#### ii. Datos de entrenamiento | |
#### iii. Training-Testing y aprendizaje del modelo | |
#### iv. Evaluamos el modelo y Aplicar el modelo a individuos nuevos |
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
# Simulamos una matriz de un raster con filas y columnas | |
M <- matrix(c(11:14,9:12,21:24,1:4),4,4) # Raster convertido a matriz | |
i <- ncol(M); j <- nrow(M) # número de columnas y filas | |
# Crear las medias para cada columna | |
M_mean <- matrix(data=1, nrow=i) %*% cbind(mean(M[,1]),mean(M[,2]),mean(M[,3]),mean(M[,4])) | |
# Creamos una diferencia de Matriz | |
DIF <- M - M_mean | |
# Obtenemos la matriz de covarianza | |
COV <- (i-1)^-1*t(DIF) %*% DIF | |
COV |