问题描述
我正在尝试在 R 中实现 PaCMAP 降维,如本文档 https://rdrr.io/github/milescsmith/dim.reduction.wrappers/man/pacmap.html 所示,pacmap
函数是 https://github.com/YingfanWang/PaCMAP 中原始 python pacmap 的包装函数。>
下面是一些如何在 Python 中完成的示例
import pandas as pd
import pacmap
fraud_data = pd.read_csv(r'C:/Users/User/Desktop/Open Source Dataset/fraud_data.csv')
embedding = pacmap.PaCMAP(n_dims=2,n_neighbors=None,MN_ratio=0.5,FP_ratio=2.0)
X_transformed = embedding.fit_transform(fraud_data.values,init="pca")
这是我在 R 版本 4.1.0 中尝试但无济于事的方法:
library(ReductionWrappers)
fraud_data <- read.csv("fraud_data")
pacmap_mapping <- pacmap(as.matrix(fraud_data),n_dims=2,n_neighbors=2,MN_ratio=1,FP_ratio=2)
Error in py_call_impl(callable,dots$args,dots$keywords) :
TypeError: 'float' object cannot be interpreted as an integer
pacmap_mapping <- pacmap(fraud_data,FP_ratio=2)
Error in py_call_impl(callable,dots$keywords) :
TypeError: '(0,slice(None,None,None))' is an invalid key
我不明白如何解决此错误,因为已经完成了最少的示例,我需要什么输入才能使其工作?
以下是用于执行此示例的数据:https://drive.google.com/file/d/1Yt4V1Ir00fm1vQ9futziWbwjUE9VvYK7/view?usp=sharing
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)