Hubness简化和分析工具
scikit-hubness的Python项目详细描述
SCIKIT轮毂
scikit-hubness
包含用于分析和
高维数据中hubbness的缩减。
丈夫是维度诅咒的一个方面。
对许多机器学习和数据挖掘任务都是有害的。
skhubness.analysis
和skhubness.reduction
包允许
- 分析,您的数据集是否显示Hubness
- 通过各种不同的技术降低轮毂
- 使用
scikit-learn
执行下游分析(性能评估) 由于兼容的数据结构
skhubness.neighbors
包充当sklearn.neighbors
的替换项。
除了从scikit-learn
继承的功能外,
它还具有
- {EM1}近似最近邻< EME>搜索
- 亮度降低
- 以及组合,
它允许在大型数据集中快速减少hubbness邻居搜索 (用100万个物体测试)。
我们遵循api惯例和scikit-learn
的代码风格。
安装
确保你有一个工作的python3环境(至少3.7)。
使用pip安装来自pypi的最新稳定版本scikit-hubness
:
pip install scikit-hubness
如果需要,将自动安装依赖项。
scikit-hubness
需要numpy
、scipy
和scikit-learn
。
近似最近邻搜索与近似粗糙度约简
另外还需要nmslib
和/或falconn
。
有些模块需要tqdm
或joblib
。所有这些包裹都有
从打开的存储库中,例如PyPI。
有关更多详细信息和备选方案,请参见Installation instructions。
文档
文档可在线获取: http://scikit-hubness.readthedocs.io/en/latest/index.html
快速启动
scikit-hubness
的用户可能希望
- 分析,他们的数据是否显示出哈比
- 减小轮毂
- 执行学习(分类、回归等)
下面的示例显示了示例数据集的所有这些步骤
来自文本域(dexter)。(请确保已安装hubness
)。
# load the example dataset 'dexter'fromskhubness.dataimportload_dexterX,y=load_dexter()# dexter is embedded in a high-dimensional space,# and could, thus, be prone to hubnessprint(f'X.shape = {X.shape}, y.shape={y.shape}')# assess the actual degree of hubness in dexterfromskhubnessimportHubnesshub=Hubness(k=10,metric='cosine')hub.fit(X)k_skew=hub.score()print(f'Skewness = {k_skew:.3f}')# additional hubness indices are available, for example:print(f'Robin hood index: {hub.robinhood_index:.3f}')print(f'Antihub occurrence: {hub.antihub_occurrence:.3f}')print(f'Hub occurrence: {hub.hub_occurrence:.3f}')# There is considerable hubness in dexter.# Let's see, whether hubness reduction can improve# kNN classification performance fromsklearn.model_selectionimportcross_val_scorefromskhubness.neighborsimportKNeighborsClassifier# vanilla kNNknn_standard=KNeighborsClassifier(n_neighbors=5,metric='cosine')acc_standard=cross_val_score(knn_standard,X,y,cv=5)# kNN with hubness reduction (mutual proximity)knn_mp=KNeighborsClassifier(n_neighbors=5,metric='cosine',hubness='mutual_proximity')acc_mp=cross_val_score(knn_mp,X,y,cv=5)print(f'Accuracy (vanilla kNN): {acc_standard.mean():.3f}')print(f'Accuracy (kNN with hubness reduction): {acc_mp.mean():.3f}')# Accuracy was considerably improved by mutual proximity.# Did it actually reduce hubness?hub_mp=Hubness(k=10,metric='cosine',hubness='mutual_proximity')hub_mp.fit(X)k_skew_mp=hub_mp.score()print(f'Skewness: {k_skew:.3f} 'f'(reduction of {k_skew - k_skew_mp:.3f})')print(f'Robin hood: {hub_mp.robinhood_index:.3f} 'f'(reduction of {hub.robinhood_index - hub_mp.robinhood_index:.3f})')# The neighbor graph can also be created directly,# with or without hubness reductionfromskhubness.neighborsimportkneighbors_graphneighbor_graph=kneighbors_graph(X,n_neighbors=5,hubness='mutual_proximity')
检查Tutorial 用于其他示例用法。
开发
scikit-hubness
的开发者欢迎各种贡献!
如果您有意见,请与我们联系,
希望看到一个额外的功能实现,
希望贡献代码或有任何其他类型的问题。
请毫不犹豫地提交issue
这里是Github。
(c) 2018-2019, Roman Feldbauer
Austrian Research Institute for Artificial Intelligence (OFAI) and
University of Vienna, Division of Computational Systems Biology (CUBE)
Contact: <roman.feldbauer@univie.ac.at>
引文
目前正在编写一份软件出版物。在那之前,
如果您在科学出版物中使用scikit-hubness
,请引用:
@INPROCEEDINGS{8588814,
author={R. {Feldbauer} and M. {Leodolter} and C. {Plant} and A. {Flexer}},
booktitle={2018 IEEE International Conference on Big Knowledge (ICBK)},
title={Fast Approximate Hubness Reduction for Large High-Dimensional Data},
year={2018},
volume={},
number={},
pages={358-367},
keywords={computational complexity;data analysis;data mining;mobile computing;public domain software;software packages;mobile device;open source software package;high-dimensional data mining;fast approximate hubness reduction;massive mobility data;linear complexity;quadratic algorithmic complexity;dimensionality curse;Complexity theory;Indexes;Estimation;Data mining;Approximation algorithms;Time measurement;curse of dimensionality;high-dimensional data mining;hubness;linear complexity;interpretability;smartphones;transport mode detection},
doi={10.1109/ICBK.2018.00055},
ISSN={},
month={Nov},}
技术报告 可在OFAI找到。
附加读数
Local and Global Scaling Reduce Hubs in Space
,机器学习研究杂志2012,
Link。
A comprehensive empirical comparison of hubness reduction in high-dimensional spaces
,
知识和信息系统2018,DOI。
许可证
scikit-hubness
是根据bsd-3-子句license的条款授权的。
从sklearn.neighbors
修改了skhubness.neighbors
包,
分布在同一个license下。
因此,用户可以以同样的方式安全地使用scikit-hubness
使用scikit-learn
。
注: 单个文件包含以下标记,而不是完整的许可证文本。
SPDX-License-Identifier: BSD-3-Clause
这使得基于SPDX的许可证信息的机器处理成为可能 此处提供的许可证标识符:https://spdx.org/licenses/
致谢
来自scikit-learn
的scikit-hubness
改编代码的几个部分。
我们感谢这个项目的所有作者和贡献者
因为他们所做的巨大工作。
PyvmMonitor正用于支持此免费开放源代码的开发 软件包。有关详细信息,请转到http://www.pyvmmonitor.com