Linear discriminant analysis with weights associated with each observation
Project description
WeightedLDA
This code provides a scikit-learn class that extends the sklearn.discriminant_analysis.LinearDiscriminantAnalysis analysis to allow for weighting of each sample. For general use of the analysis, please refer to the scikit-learn webpage:
WeightedLDA provides the same basic utilities of the scikit-learn class except for the following limitations:
- Only
solve="svd"is supported. - The priors cannot be defined a priori.
- The
feature_names_in_attribute is not included.
The following code shows standard usage given sample data X, cluster identification y, and weights wgt:
from WeightedLDA import WeightedLDA
lda = WeightedLDA()
lda.fit(X, y, wgts=wgts)
Calling fit without the wgts variable produces a fit the same as the scikit-learn class.
I tried to replicate the results numerically with the scikit-learn class, and was able to do so with all examples except when the sample data has a nullspace. Even then, the resulting predict method produces consistent results and the transform method is numerically consistent when the data does not extend into the nullspace of the sampled data.
TODO
Write the fit method using PyTorch.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file weightedlda-0.0.1.tar.gz.
File metadata
- Download URL: weightedlda-0.0.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ed05d76c877f1c731e34b62dc09df1972370c879f080f146f53abfe3fbf94ec
|
|
| MD5 |
ca024e276daceffd41feafb12e1058d6
|
|
| BLAKE2b-256 |
aabf3f45f74d07cee9d9bf457f660caf5fbe79e378529eb25d06aa1135077a1d
|
File details
Details for the file WeightedLDA-0.0.1-py3-none-any.whl.
File metadata
- Download URL: WeightedLDA-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5d0b52eb2694d7e5c92c163e9428c500a40cc712075001282617ae3da0a45d9
|
|
| MD5 |
3c06366ec9a862fdb0d30a72d022eb2c
|
|
| BLAKE2b-256 |
67e30295f3b762be7a104c709bafcaea0a98d47c797a1a273bfa51e162fa5bd4
|