In library(package, lib.loc = lib.loc,character.only = TRUE, there is no package called ‘kknn’
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, : there is no package called ‘kknn’
目录
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, : there is no package called ‘kknn’
问题:
解决:
完整错误:
问题:
library(mlr)library(tidyverse)
此处使用的数据集包含在mlr包中的fuelsubset.task中;
使用as_tibble函数将数据框dataframe转化为tibble;
使用mlr的getTaskData函数从任务中提取数据;
数据包含119个样本、367个特征;
heatan变量是目标变量;
data("fuelsubset.task")fuel <- getTaskData(fuelsubset.task)fuelTib <- as_tibble(fuel)fuelTib
# A tibble: 129 x 367
heatan h20 UVVIS.UVVIS.1 UVVIS.UVVIS.2 UVVIS.UVVIS.3 UVVIS.UVVIS.4
<dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 26.8 2.3 0.874 0.748 0.774 0.747
2 27.5 3 -0.855 -1.29 -0.833 -0.976
3 23.8 2.00 -0.0847 -0.294 -0.202 -0.262
4 18.2 1.85 -0.582 -0.485 -0.328 -0.539
5 17.5 2.39 -0.644 -1.12 -0.665 -0.791
6 20.2 2.43 -0.504 -0.890 -0.662 -0.744
7 15.1 1.92 -0.569 -0.507 -0.454 -0.576
8 20.4 3.61 0.158 0.186 0.0303 0.183
9 26.7 2.5 0.334 0.191 0.0777 0.0410
10 24.9 1.28 0.0766 0.266 0.0808 -0.0733
# ... with 119 more rows, and 361 more variables
数据预处理(为方便数据可视化)
fuelUntidy <- fuelTib %>%mutate(id = 1:nrow(.)) %>%gather(key = "variable", value = "absorbance",c(-heatan, -h20, -id)) %>%mutate(spectrum = str_sub(variable, 1, 3),wavelength = as.numeric(str_extract(variable, "(\\d)+")))fuelUntidy# A tibble: 47,085 x 7heatan h20 id variable absorbance spectrum wavelength<dbl> <dbl> <int> <chr> <dbl> <chr> <dbl>1 26.8 2.3 1 UVVIS.UVVIS.1 0.874 UVV 12 27.5 3 2 UVVIS.UVVIS.1 -0.855 UVV 13 23.8 2.00 3 UVVIS.UVVIS.1 -0.0847 UVV 14 18.2 1.85 4 UVVIS.UVVIS.1 -0.582 UVV 15 17.5 2.39 5 UVVIS.UVVIS.1 -0.644 UVV 16 20.2 2.43 6 UVVIS.UVVIS.1 -0.504 UVV 17 15.1 1.92 7 UVVIS.UVVIS.1 -0.569 UVV 18 20.4 3.61 8 UVVIS.UVVIS.1 0.158 UVV 19 26.7 2.5 9 UVVIS.UVVIS.1 0.334 UVV 1
10 24.9 1.28 10 UVVIS.UVVIS.1 0.0766 UVV 1
# ... with 47,075 more rows
数据可视化(关系图、分面关系图)
uelUntidy %>%ggplot(aes(absorbance, heatan, col = as.factor(wavelength))) +facet_wrap(~ spectrum, scales = "free_x") +geom_smooth(se = FALSE, size = 0.2) +ggtitle("Absorbance vs heatan for each wavelength") +theme_bw() +theme(legend.position = "none")fuelUntidy %>%ggplot(aes(wavelength, absorbance, group = id, col = heatan)) +facet_wrap(~ spectrum, scales = "free_x") +geom_smooth(se = FALSE, size = 0.2) +ggtitle("Wavelength vs absorbance for each batch") +theme_bw()fuelUntidy %>%ggplot(aes(h20, heatan)) +geom_smooth(se = FALSE) +ggtitle("Humidity vs heatan") +theme_bw()
R语言使用mlr包的makeRegrTask函数创建回归任务、makeLearner函数指定回归学习函数为KNN回归模型
fuelTask <- makeRegrTask(data = fuelTib, target = "heatan")kknn <- makeLearner("regr.kknn")
> kknn <- makeLearner("regr.kknn")
Loading required package: kknn
Error in requirePackages(package, why = stri_paste("learner", id, sep = " "), :
For learner regr.kknn please install the following packages: kknn
In addition: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called ‘kknn’
> install.packages("kknn")
trying URL 'https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/4.0/kknn_1.3.1.zip'
Content type 'application/zip' length 335586 bytes (327 KB)
downloaded 327 KB
解决:
是因为没有安装kknn包,安装了就好了。
> install.packages("kknn")
trying URL 'https://mirrors.tuna.tsinghua.edu.cn/CRAN/bin/windows/contrib/4.0/kknn_1.3.1.zip'
Content type 'application/zip' length 335586 bytes (327 KB)
downloaded 327 KB
fuelTask <- makeRegrTask(data = fuelTib, target = "heatan")kknn <- makeLearner("regr.kknn")
> kknn
Learner regr.kknn from package kknn
Type: regr
Name: K-Nearest-Neighbor regression; Short name: kknn
Class: regr.kknn
Properties: numerics,factors
Predict-Type: response
Hyperparameters:
完整错误:
> kknn <- makeLearner("regr.kknn")
Loading required package: kknn
Error in requirePackages(package, why = stri_paste("learner", id, sep = " "), :
For learner regr.kknn please install the following packages: kknn
In addition: Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called ‘kknn’
参考:https://www.rdocumentation.org/packages/kknn/versions/1.3.1
参考:https://github.com/mlr-org/mlr/issues/1689
In library(package, lib.loc = lib.loc,character.only = TRUE, there is no package called ‘kknn’相关推荐
- library not found for -lstdc++和dyld: Library not loaded: /usr/lib/swift/libswiftCoreGraphics.dylib解决
最近线上项目12.4及以下的系统启动崩溃,不断有用户反馈,但是我们公司没有对应的真机测试机,加上各种第三方库,包括真机环境下的动态库,导致模拟器也不能正常运行,无法定位具体原因,那么就要想办法解决问题 ...
- VS中解决LIBCMTD.lib和uafxcwd.lib冲突(uafxcw.lib LIBCMT.lib冲突)
如果在编译MFC程序的时候出现下列及类似的错误: 1>uafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator ...
- Vs2010无法打开文件“Kernel32.lib”、无法打开“libcpmt.lib”msvcprt.lib
1.对于无法打开"Kernel"问题,即使复制lib文件到目录,仍然会出现最后的错误; 原因:WindowsSdk 安装失败! 方法:重装 microsoft SDK6.0 ,再在 ...
- /lib/x86, /system/lib, /vendor/lib]]] couldn't find xx.so
近日对接PapPal,对接后在部份手机上会出现崩溃,查看其日志后发现报/lib/x86, /system/lib, /vendor/lib]]] couldn't find xx.so,我解压了打好的 ...
- 解决LaTeX:!Package CJK Error:Invalid character code报错
近期运行一个中文的latex模板总是报错,提示:!Package CJK Error:Invalid character code 我的latex编译套件是: WinEdit + MiKTeX 尝试了 ...
- 去除Reloaded modules: lib, lib.utils, lib.metrics, lib.data_preparation, model, model.model_config
Spyder(python 3.6) IDE运行如下程序: import argparse def main(): parser = argparse.ArgumentParser(descr ...
- FDX协议 #pragma comment(lib,“ws2_32.lib“)
#pragma comment(lib,"ws2_32.lib") 1.问题描述:近期项目在使用Canoe Car2X的过程中,Canoe 内部通信协议FDX需要用到Win32的s ...
- 安装rabbitMq报错:error: unpacking of archive failed on file /usr/lib/rabbitmq/lib/rabbitmq_server-3.8.9
安装rabbitMq报错: 错误提示:error: unpagacking of archive failed on file /usr/lib/rabbitmq/lib/rabbitmq_serve ...
- golang package 是什么意思?一份来自初学者的golang package体验指南
如果你有其他语言的基础,可见性应该很好理解. java的可见性是通过public private来描述的. python的可见性是通过_some_var下划线来约定的. 本文翻译自:https://w ...
- ubuntu进行apt-get时候出现Package ssh is not available, but is referred to by another package 错误...
今天在ubuntu进行ssh安装的时候,出现如下错误. Reading package lists... Done Building dependency tree... Done Package s ...
最新文章
- Matlab图像处理基本函数(1)
- 隐式反馈的去噪,模型取得巨大提升
- ux和ui_我怎么知道UI / UX是否适合我?
- 判断两个日期相差的天数
- odoo pivot中去掉求和_JDK 7 中的 Fork/Join 模式
- Linux下使用shell脚本远程登录主机(Ubuntu CentOS)
- Linux 安装 JAVA(JDK)
- Win10 SAS9.4缺少增强型编辑器
- 大华服务器系统配置图,大华磁盘阵列配置说明指南.doc
- [个人笔记] vCenter回收活跃虚拟机的剩余可用空间
- QQ聊天记录多角度分析Python实现
- 电脑基础知识精选(硬件篇)
- php最大的论坛,phpwind论坛史上最大漏洞 -电脑资料
- Shell中的expr命令
- [Algorithmic Toolbox学习笔记][week6]Placing Parentheses
- 解决iPhone手机时间格式化“NAN“问题
- SVM算法(三层境界)
- 帅哥陈 Hololens开发笔记(1)
- 宝塔部署uniapp和php后端的经历
- FICO配置详解之一:FI总账会计(1)