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
from sklearn.model_selection import StratifiedKFold, GridSearchCV | |
# Declare grid of hyper-parameters | |
dict_hyperparams = dict(svm__gamma=[0.001,0.01,0.1], | |
svm__C = [1,10,100,1_000]) | |
# Cross Validation for GridSearchCV | |
crossVal = StratifiedKFold(n_splits=5, shuffle=True, random_state=0) | |
model_02 = Pipeline(steps= [ | |
('hogdescriptor', DescriptorHOG()), |
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
from OwnTransformers.ImageDescriptors import DescriptorHOG | |
from sklearn.decomposition import PCA | |
from sklearn.preprocessing import StandardScaler | |
from sklearn.svm import SVC | |
from sklearn.pipeline import Pipeline | |
model = Pipeline( | |
steps=[ | |
('hogdescriptor', DescriptorHOG()), | |
('pca', PCA(n_components=0.9, svd_solver='full')), |
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
from sklearn.svm import SVC | |
svm = SVC(kernel='rbf', gamma= 0.1, C = 100) |
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
from sklearn.decomposition import PCA | |
pca = PCA(n_components=0.9) | |
pca.fit(X) | |
new_X = pca.transform(X) |
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
var BosquesPerdidos_Year_Map = BosquesPerdidos_Year.clip(RdI_Poligono); | |
var VisParams_BosquesPerdidos_Year = { | |
min: 0, | |
max: 20, | |
palette: ['001219', '005f73', '0a9396', | |
'94d2bd', 'e9d8a6','ee9b00', 'ca6702', | |
'bb3e03', 'ae2012', '9b2226'] | |
}; | |
Map.addLayer(BosquesPerdidos_Year_Map,VisParams_BosquesPerdidos_Year, |
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
// PERDIDA GENERAL DE LOS BOSQUES | |
var VisParams_BosquesPerdidos = {palette: ['e5383b']}; | |
var ImageMap_BosquesPerdidos = BosquesPerdidos.mask(BosquesPerdidos) | |
.clip(RdI_Poligono); | |
Map.addLayer(ImageMap_BosquesPerdidos, | |
VisParams_BosquesPerdidos, | |
'Perdida general de bosques (a partir del 2001 hasta 2020)'); | |
// GANANCIA GENERAL DE LOS BOSQUES | |
// Seleccionar bandas en variable nueva |
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
// Seleccionar bandas en variable nueva | |
var ImageMap_Bosques2000_band = Datos_Bosques.select('treecover2000'); | |
// Enmascarar en variable nueva | |
var ImageMap_Bosques2000_Final = ImageMap_Bosques2000_band | |
.mask(ImageMap_Bosques2000_band) | |
.clip(RdI_Poligono); | |
var VisParams_Bosques2000 = { | |
min: 0, | |
max: 100, | |
palette: ['B7EFC5','6EDE8A','2DC653','208B3A','155D27'] |
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
// ESTADO DE LOS BOSQUES EN EL 2000 | |
// Seleccionar bandas con parametros de visualizacion (sin mascara) | |
var VisParams_Bosques2000_NoMask = { | |
palette: ['black','green'], | |
bands: ['treecover2000'] | |
}; | |
Map.addLayer(Datos_Bosques.clip(RdI_Poligono), | |
VisParams_Bosques2000_NoMask, 'Situacion en el 2000 (sin máscara)' ); |
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
// TEMPERATURA DE LA SUPERFICIE | |
// -> Parametros de visualizacion | |
var VisParams_Temperatura = { | |
min: 25, | |
max: 35, | |
palette:['blue', 'limegreen', 'yellow', 'darkorange', 'red'] | |
}; | |
// Visualizar solo en nuestra Region de Interes | |
var ImageMap_Temperatura = Temperatura_Final.median().clip(RdI_Poligono); |
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
// 3.- Crear el plot con arreglos | |
var Plot_PerdidasAnualesBosques = ui.Chart.array.values({ | |
array: Dict_PerdidasAnualesBosques.values(), | |
axis: 0, | |
xLabels: Dict_PerdidasAnualesBosques.keys() | |
}); | |
print("Perdidas de bosques por año (m2)") | |
print(Plot_PerdidasAnualesBosques); |
NewerOlder