当前位置: 首页 > news >正文

网站建设都需要买什么东西品牌全网推广

网站建设都需要买什么东西,品牌全网推广,免费学校网站建设,有哪些好的做网站公司这里写目录标题1.给出一个线性回归模型并求出因子贡献度2.biomod22.1 pseudo-absences:伪不存在点(PA)2.1.1 random2.2.2 disk2.2.3 user.defined method3.使用网格划分区域3.1 计算质心4. 完整案例1.给出一个线性回归模型并求出因子贡献度 ##---------…

这里写目录标题

    • 1.给出一个线性回归模型并求出因子贡献度
    • 2.biomod2
      • 2.1 pseudo-absences:伪不存在点(PA)
        • 2.1.1 random
        • 2.2.2 disk
        • 2.2.3 user.defined method
    • 3.使用网格划分区域
        • 3.1 计算质心
    • 4. 完整案例

1.给出一个线性回归模型并求出因子贡献度

##-----------------------------------------------------------------------------
# 线性回归模型
lm_df <- data.frame(x = iris$Sepal.Length,y = iris$Sepal.Width)
lm_model <- lm(data = lm_df,y ~ x)
broom::tidy(lm_model)ggplot(data = lm_df,aes(x,y))+geom_point()+geom_smooth(method = lm, se = FALSE)# 变量重要性
install.packages("vip")
install.packages('mlbench')
library(vip)
set.seed(100)
trn <- as.data.frame(mlbench::mlbench.friedman1(500)) 
linmod <- lm(y ~ .^2, data = trn)
backward <- step(linmod, direction = "backward", trace = 0)
# 计算贡献度
vi(backward)# 可视化
p1 <- vip(backward, num_features = length(coef(backward)), geom = "point", horizontal = FALSE)
p2 <- vip(backward, num_features = length(coef(backward)), geom = "point", horizontal = FALSE, mapping = aes_string(color = "Sign"))
grid.arrange(p1, p2, nrow = 1)

结果展示:
在这里插入图片描述

图像绘制:
在这里插入图片描述

重要性结果展示:
在这里插入图片描述

2.biomod2

在这里插入图片描述

首先需要安装biomod2包:install.packages(“biomod2”)
最终生成的文件为individual_projections,该文件夹中包括.img、.xml两种数据格式,其中包括很多算法如,GLM,RF,SRE,ANN,CTA,FDA,CTA等多种模型 ,这类似于一个集成算法,集合多个模型,求取模型的平均值,以得出一个更好的模型。

##-----------------------------------------------------------------------------
# 加载成都市的适量边界图,后面会用到
library(mapchina)
cd_sf <- mapchina::china %>%dplyr::filter(Name_Perfecture == "成都市") %>%group_by(Name_Province) %>%summarise(geometry = sf::st_union(geometry)) %>%ungroup()
colnames(cd_sf) # see all variable names
plot(cd_sf)#install.packages("biomod2")
library(biomod2) ?biomod2::BIOMOD_FormatingData()
# 

2.1 pseudo-absences:伪不存在点(PA)

生成PA点的四种方法:random、disk、sre、user.table

2.1.1 random

随机选择PA点

##--------------------------------------------------------------------------------
# 1.the random method : PA are randomly selected over the studied area (excluding presence points)
library(sf)
p1_random <- sf::st_sample(cd_sf,300)
ggplot()+geom_sf(data = cd_sf)+geom_sf(data = p1_random)

结果展示:

在这里插入图片描述

2.2.2 disk

# 2.the disk method : PA are randomly selected within circles around presence 
#   points defined by a minimum and a maximum distance values (defined in meters).
## Format Data with pseudo-absences : disk method
# myBiomodData.d <- BIOMOD_FormatingData(resp.var = myResp.PA,
#                                        expl.var = myExpl,
#                                        resp.xy = myRespXY,
#                                        resp.name = myRespName,
#                                        PA.nb.rep = 4,
#                                        PA.nb.absences = 500,
#                                        PA.strategy = 'disk',
#                                        PA.dist.min = 5,
#                                        PA.dist.max = 35) # 生成环形缓冲区
pts_presence <- sf::st_sample(cd_sf,300)
pts_presence

在这里插入图片描述

#使用生成的第一个点画圆
st_buffer(pts_presence[[1]], dist = 1) %>% plot()  
plot(pts_presence[[1]],add = TRUE)

结果展示:
在这里插入图片描述

2.2.3 user.defined method

##-------------------------------------------------------------------------------------
#用户自定义
## Format Data with pseudo-absences : user.defined method
# myPAtable <- data.frame(PA1 = ifelse(myResp == 1, TRUE, FALSE),
#                         PA2 = ifelse(myResp == 1, TRUE, FALSE))
# for (i in 1:ncol(myPAtable)) myPAtable[sample(which(myPAtable[, i] == FALSE), 500), i] = TRUE
# myBiomodData.u <- BIOMOD_FormatingData(resp.var = myResp.PA,
#                                        expl.var = myExpl,
#                                        resp.xy = myRespXY,
#                                        resp.name = myRespName,
#                                        PA.strategy = 'user.defined',
#                                        PA.user.table = myPAtable)
pts_absence <- pts_presence %>% st_as_sf() %>% mutate(id = 1:n()) %>%group_by(id) %>%nest(data = -id) %>% mutate(circle = purrr::map(.x = data,.f = function(x) {st_buffer(x = x,dist = 1)})) %>% mutate(point = purrr::map(.x = circle,.f = function(x) {st_sample(x,1)})) %>% dplyr::select(point) %>% unnest() %>% ungroup() %>% dplyr::select(-id)
pts_absence

在这里插入图片描述

格式转换:

# 将生成的点转换为数据框格式
#install.packages('sfheaders')
library(sfheaders)
pts_absence %>% st_as_sf() %>% sfheaders::sf_to_df() %>% dplyr::select(x,y) %>% mutate(label = "absence") %>% head()

在这里插入图片描述

3.使用网格划分区域

##----------------------------------------------------------------------------------
# 网格划分,形成栅格图像
cd_grid <- cd_sf %>% st_make_grid(cellsize = 0.2) %>%st_intersection(cd_sf) %>%st_cast("MULTIPOLYGON") %>%st_sf() %>%mutate(cellid = row_number())
plot(cd_grid)

在这里插入图片描述

为每个网格添加标签:

#devtools::install_github("yutannihilation/ggsflabel")
ggplot(data = cd_grid)+geom_sf()+ggsflabel::geom_sf_label(aes(label = cellid))+theme_light()

在这里插入图片描述

3.1 计算质心

# 计算质心
library(terra)
library(tidyterra)
library(ggplot2)bj_dem <- raster("D:/Datasets/w001001.adf")
plot(bj_dem)(sp_sf <- bj_dem %>% calc(x = .,fun = function(x) ifelse(x < 100,x,NA)) %>%  # 按属性筛选rasterToPolygons() %>% st_as_sf() %>% summarise(geometry = st_union(geometry)) %>% st_make_valid())
plot(sp_sf)

在这里插入图片描述
在这里插入图片描述

centroid <- st_centroid(sp_sf)ggplot()+geom_spatraster(data = rast(bj_dem)) +scale_fill_whitebox_c(palette = "muted",na.value = "white")+geom_sf(data = sp_sf,alpha = 0,color = "blue")+geom_sf(data = centroid,size = 3,color = "red")

在这里插入图片描述

4. 完整案例

# Load species occurrences (6 species available)
data(DataSpecies)
head(DataSpecies)# Select the name of the studied species
myRespName <- 'GuloGulo'# Get corresponding presence/absence data
myResp <- as.numeric(DataSpecies[, myRespName])# Get corresponding XY coordinates
myRespXY <- DataSpecies[, c('X_WGS84', 'Y_WGS84')]# Load environmental variables extracted from BIOCLIM (bio_3, bio_4, bio_7, bio_11 & bio_12)
data(bioclim_current)
myExpl <- terra::rast(bioclim_current)## --------------------------------------------------------------------------------
# Format Data with true absences
myBiomodData <- BIOMOD_FormatingData(resp.var = myResp,expl.var = myExpl,resp.xy = myRespXY,resp.name = myRespName)
myBiomodData
summary(myBiomodData)
plot(myBiomodData)

物种分布数据:
在这里插入图片描述

在这里插入图片描述

http://www.ds6.com.cn/news/74308.html

相关文章:

  • css对网站页面的影响野狼seo团队
  • 网站关键词优化外包知乎关键词搜索排名
  • 网页设计示范html代码全网关键词优化公司哪家好
  • 成品网站多少钱昆明做网站的公司
  • asp网站伪静态页面网页生成
  • 云服务器建设网站教程舆情信息
  • 高埗做网站电商运营是做什么的
  • 新闻网站给企业做专题策划品牌公关具体要做些什么
  • 彩票网站给实体店做代销网络推广工具和方法
  • 新蔡哪有做网站建设的教程seo推广排名网站
  • 用返利网站做爆款推广软件的app
  • 网站推广的手段做一个网站要多少钱
  • 网站如何做数据库考研培训机构排名前十
  • 中国化工第九建设公司网站做网站的流程与步骤
  • 朋友用我的vps做网站长沙seo优化
  • pc蛋蛋网站怎么做最知名的网站推广公司
  • 大型网站架构实战外贸网
  • 深圳有哪些大公司总部外贸seo
  • 做的比较好的政府网站b站推广平台
  • 官方网站建设步骤整站营销系统
  • 免费视频网站怎么赚钱去哪里找需要推广的app
  • 织梦网站数据库库直接上传的 没有后台备份 需要怎么还原微信推广平台收费标准
  • 营销型网站主页定制百度推广客服工作怎么样
  • 开发一个网站要学什么软件商城网站开发公司
  • dw个人网站制作百度推广的四种收费形式
  • 北京专业网站开发公司舆情服务网站
  • 网络营销发展的趋势天津seo推广软件
  • 淘宝网站首页设计分析网店推广方式有哪些
  • 傻瓜网站建设西安seo顾问公司
  • 无锡高端网站设计建设cps广告联盟网站