【MDS】

本文深入探讨了机器学习中的一种重要降维技术——多维尺度缩放(MDS),解释了其基本原理,介绍了如何使用MDS进行数据可视化,并通过实例展示了MDS在高维数据处理中的应用。同时,讨论了MDS与其他降维方法如PCA和t-SNE的对比,帮助读者理解MDS在特定场景下的优势。
摘要由CSDN通过智能技术生成
path="D:/Fluxnet/OUTCOME/MDS_TRY"
outpath="C:/Users/Lenovo/Desktop/R/outcome_try"
getwd()
setwd("D:/Fluxnet/OUTCOME/MDS_TRY")
#+++ load libraries used in this vignette
library(REddyProc)
library(dplyr)



file <- dir(path)
for(i in 1:length(file)){
  
  EddyData <- fLoadTXTIntoDataframe(file[i]) 
  
  #+++ Replace long runs of equal NEE values by NA
  EddyData <- filterLongRuns(EddyData, "LE")
  
  #+++ Add time stamp in POSIX time format and filter long runs of equal values 
  EddyDataWithPosix <- fConvertTimeToPosix(
    EddyData, 'YDH',Year = 'Year',Day = 'DoY', Hour = 'Hour') 
  
  EProcMDS <- sEddyProc$new(
    file[i], EddyDataWithPosix, c('LE', 'Rg', 'Tair', 'VPD'))
    
  #Initialize 'NEE' as variable to fill
  EProcMDS$sFillInit('LE')
  # Set variables and tolerance intervals
  
  V1 = 'Rg'; T1 = 50 # Global radiation 'Rg' within +/-50 W m-2
  V2 = 'VPD'; T2 = 5 # Vapour pressure deficit 'VPD' within 5 hPa
  V3 = 'Tair'; T3 = 2.5 # Air temperature 'Tair' within +/-2.5 degC
  
  # Step 1: Look-up table with window size +/-7 days
  ResultStep1 <- EProcMDS$sFillLUT(7, V1, T1, V2, T2, V3, T3)
  # Step 2: Look-up table with window size +/-14 days
  ResultStep2 <- EProcMDS$sFillLUT(14, V1, T1, V2, T2, V3, T3)
  # Step 3: Look-up table with window size +/-7 days, Rg only
  ResultStep3 <- EProcMDS$sFillLUT(7, V1, T1)
  # Step 4: Mean diurnal course with window size 0 (same day)
  ResultStep4 <- EProcMDS$sFillMDC(0)
  # Step 5: Mean diurnal course with window size +/-1, +/-2 days
  ResultStep5a <- EProcMDS$sFillMDC(1)
  ResultStep5b <- EProcMDS$sFillMDC(2)
  # Step 6: Look-up table with window size +/-21, +/-28, ..., +/-70
  for (WinDays in seq(21, 70, 7) ) 
    ResultStep6 <- EProcMDS$sFillLUT(WinDays, V1, T1, V2, T2, V3, T3)
  # Step 7: Look-up table with window size +/-14, +/-21, ..., +/-70, Rg only
  for (WinDays in seq(14, 70, 7) ) 
    ResultStep7 <- EProcMDS$sFillLUT(WinDays, V1, T1)
  # Step 8: Mean diurnal course with window size +/-7, +/-14, ..., +/-210 days
  for (WinDays in seq(7, 210, 7) ) 
    ResultStep8 <- EProcMDS$sFillMDC(WinDays)
  # Export results, columns are named 'VAR_'
  FilledEddyData <- EProcMDS$sExportResults()
  format(FilledEddyData, scientific = F)
  head(FilledEddyData)
  
  fWriteDataframeToFile(format(FilledEddyData, scientific = F),paste(file[i]), outpath)

  }



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值