Skip to main content

Dimension Reduction Function Research (drfr)

This package provides a Reduction Model and Regression Model, which respectively contains several choices for reduction and regression of data.

Discription of Each Model

Reduction Model

contains "NPPE", "UMAP", "LLE", "Hessian", "Spectral", "TSNE", "Isomap", used as keyword argument tag in function get_reduction(). To make tag "UMAP" work properly, an install according to https://github.com/lmcinnes/umap is needed.

Regression Model

contains "lasso", "ridge", "MARS", used as keyword argument tag in function cal_regression(). As basis generator either those in BasisGenerator or self made function can be used, where data X should be the only positional argument.

Basis Generator

contains several functions as basis generators, with form

generate_basis_name(X, p=basis_degree)

Usage

from drfr import ReductionModel, BasisGenerator, RegressionModel
from sklearn import datasets
import matplotlib.pyplot as plt

N = 5000
k = 24
X, color = datasets.samples_generator.make_swiss_roll(n_samples=N, noise=0.00001)
basis_generator = None
poly_degree = 4
tag_red = "NPPE"
tag_reg = "MARS"

# preprocessing
X, color = ReductionModel.pre_process(X, color)

# compute embedded result
red_model = ReductionModel.ReductionModel()
y_nppe = red_model.get_reduction(X, tag=tag_red)

# compute regression weights w given X and y, and compute basis(X)*y
reg_model = RegressionModel.RegressionModel()
y_reg = reg_model.cal_regression(X, y_nppe, tag=tag_reg, basis_generator=BasisGenerator.generate_fourier, p=poly_degree)

# draw results
ax = fig.add_subplot(311, projection='3d')
ax.scatter(X[:, 1], X[:, 0], X[:, 2], c=color, cmap=plt.cm.Spectral)

ax.set_title("Original data")
ax = fig.add_subplot(312)
ax.scatter(y_nppe[:, 1], y_nppe[:, 0], c=color, cmap=plt.cm.Spectral)
plt.axis('tight')
plt.xticks([]), plt.yticks([])
plt.title('Projected data with method' + tag_red)
ax = fig.add_subplot(313)
ax.scatter(y_reg[:, 1], y_reg[:, 0], c=color, cmap=plt.cm.Spectral)
plt.axis('tight')
plt.xticks([]), plt.yticks([])
plt.title("NPPE embedded data regressed by " + tag_reg + " Model\n" + "with basis degree" + poly_degree.__str__())
plt.show()

Metadata

Release files for drfr 0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for drfr 0.9
File Interpreter ABI Platform Actions
drfr-0.9-py3-none-any.whl Python 3 none any Details for drfr-0.9-py3-none-any.whl

Release files / drfr-0.9-py3-none-any.whl

Download URL drfr-0.9-py3-none-any.whl
Size 11.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8b4df55dcab05366a6b2d8868aa85522c0d6757ef57765edf0b62f8c24cf98f2
BLAKE2b-256 checksum
How to use checksums
b5340bd58abc22ce2160adea15e9dc5f987a548907dc5717d86ec08254a2c9ed
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

Security for drfr 0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page