MIT License

项目介绍

MaxHalford/prince 是一个托管在 GitHub 上的开源项目,主要使用 Python 编写,采用 MIT License 许可证,目前获得 1.5k 个 Star、198 次 Fork。

仓库全名
MaxHalford/prince
开源许可证
MIT License
Star 数
1.5k
Fork 数
198
未关闭 Issue
3

README 摘要

Prince is a Python library for multivariate exploratory data analysis in Python. It includes a variety of methods for summarizing tabular data, including principal component analysis (PCA) and correspondence analysis (CA). Prince provides efficient implementations, using a scikit-learn API. I made Prince when I was at university, back in 2016. I spent a significant amount of time in 2022 to revamp the entire…

完整内容见 GitHub 原始 README 或本页 。

常见问题

prince 用什么语言开发?

主要使用 Python 编写,采用 MIT License 许可证,目前有 1.5k 个 Star。

prince 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 prince 的源码?

可以直接克隆仓库:git clone https://github.com/MaxHalford/prince.git,默认分支为 main;安装与运行步骤见仓库 README。

prince 最近还在维护吗?

仓库最近一次更新为 1 周前,当前有 3 个未关闭 Issue;Star 数为 1.5k,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

:crown: Multivariate exploratory data analysis in Python — PCA, CA, MCA, MFA, FAMD, GPA

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

语言占比

Makefile
Python

README

prince_logo


Prince is a Python library for multivariate exploratory data analysis in Python. It includes a variety of methods for summarizing tabular data, including principal component analysis (PCA) and correspondence analysis (CA). Prince provides efficient implementations, using a scikit-learn API.

I made Prince when I was at university, back in 2016. I spent a significant amount of time in 2022 to revamp the entire package. It is thoroughly tested and supports many features, such as supplementary row/columns, as well as row/column weights.

Example usage

>>> import prince

>>> dataset = prince.datasets.load_decathlon()
>>> decastar = dataset.query('competition == "Decastar"')

>>> pca = prince.PCA(n_components=5)
>>> pca = pca.fit(decastar, supplementary_columns=['rank', 'points'])
>>> pca.eigenvalues_summary
          eigenvalue % of variance % of variance (cumulative)
component
0              3.114        31.14%                     31.14%
1              2.027        20.27%                     51.41%
2              1.390        13.90%                     65.31%
3              1.321        13.21%                     78.52%
4              0.861         8.61%                     87.13%

>>> pca.transform(dataset).tail()
component                       0         1         2         3         4
competition athlete
OlympicG    Lorenzo      2.070933  1.545461 -1.272104 -0.215067 -0.515746
            Karlivans    1.321239  1.318348  0.138303 -0.175566 -1.484658
            Korkizoglou -0.756226 -1.975769  0.701975 -0.642077 -2.621566
            Uldal        1.905276 -0.062984 -0.370408 -0.007944 -2.040579
            Casarsa      2.282575 -2.150282  2.601953  1.196523 -3.571794

>>> chart = pca.plot(dataset)

This chart is interactive, which doesn't show on GitHub. The green points are the column loadings.

>>> chart = pca.plot(
...     dataset,
...     show_row_labels=True,
...     show_row_markers=False,
...     row_labels_column='athlete',
...     color_rows_by='competition'
... )

Installation

pip install prince

🎨 Prince uses Altair for making charts.

Methods

flowchart TD groups?(Groups of columns?) --> |"✅"| MFA groups? --> |"❌"| cat?(Categorical data?) cat? --> |"✅"| num_too?(Numerical data too?) num_too? --> |"✅"| FAMD num_too? --> |"❌"| multiple_cat?(More than two columns?) multiple_cat? --> |"✅"| MCA multiple_cat? --> |"❌"| CA cat? --> |"❌"| shapes?(Analysing shapes?) shapes? --> |"✅"| GPA shapes? --> |"❌"| manifold?(Data on a manifold?) manifold? --> |"✅"| PGA manifold? --> |"❌"| PCA

Principal component analysis (PCA)

Correspondence analysis (CA)

Multiple correspondence analysis (MCA)

Multiple factor analysis (MFA)

Factor analysis of mixed data (FAMD)

Generalized procrustes analysis (GPA)

Principal geodesic analysis (PGA)

Correctness

Prince is tested against scikit-learn and FactoMineR. For the latter, rpy2 is used to run code in R, and convert the results to Python, which allows running automated tests. PGA is tested against geomstats. See more in the tests directory.

Citation

Please use this citation if you use this software as part of a scientific publication.

@software{Halford_Prince,
    author = {Halford, Max},
    license = {MIT},
    title = {{Prince}},
    url = {https://github.com/MaxHalford/prince}
}

License

The MIT License (MIT). Please see the license file for more information.

评论

暂无评论