Library for maximum likelihood principal component analysis for AnyBody models
Project description
sillywalk
sillywalk is a Python library for Maximum Likelihood Principal Component Analysis (ML-PCA). It allows you to build statistical models from data and predict missing values based on observed values. While it can be used with any numerical dataset, it includes special utilities for working with data from the AnyBody Modeling System™.
Installation
You can install sillywalk from PyPI,
pip install sillywalk
or as a conda package:
pixi install sillywalk
For developers
This project is managed by pixi. To set up a development environment:
git clone https://github.com/AnyBody-Research-Group/sillywalk
cd sillywalk
pixi install
pixi run test
Quick Start
Here's a quick example of how to use sillywalk to predict missing data.
1. Create a statistical model
First, you need a dataset to build the model. sillywalk works with both Pandas and Polars DataFrames.
import pandas as pd
import sillywalk
# Sample data of student measurements
data = {
"Sex": [1, 1, 2, 2, 1, 2],
"Age": [25, 30, 28, 22, 35, 29],
"Stature": [175, 180, 165, 160, 185, 170],
"Bodyweight": [70, 80, 60, 55, 85, 65],
"Shoesize": [42, 44, 39, 38, 45, 40],
}
df = pd.DataFrame(data)
# Create a PCAPredictor model from the data
model = sillywalk.PCAPredictor(df)
2. Predict missing values
Once the model is created, you can use it to predict missing values based on some known values (constraints).
# Define the known values (constraints)
constraints = {
"Stature": 180,
"Bodyweight": 65,
}
# Predict the missing values
result = model.predict(constraints)
# The result is a dictionary containing the original constraints
# and predicted values for the other variables.
print(result)
3. Save and load the model
You can save your trained model to a file and load it later to make new predictions without having to re-train it.
# Save the model to a file
model.save_npz("student_model.npz")
# Load the model from the file
loaded_model = sillywalk.PCAPredictor.from_npz("student_model.npz")
# Use the loaded model to make predictions
new_constraints = {"Age": 24, "Shoesize": 43}
prediction = loaded_model.predict(new_constraints)
print(prediction)
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 sillywalk-1.0.0a0.tar.gz.
File metadata
- Download URL: sillywalk-1.0.0a0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7e96c9b58373b42bbcfd54958941674a7a7d3ede8b9543a70cd6f4eaecd8aafa
|
|
| MD5 |
55ec7bf51ac5cf4e1ffaa593a58c065f
|
|
| BLAKE2b-256 |
f459ab0fbc90b943244a13e20a5f8fe8df6a3665478b89c588a7b62e0ed93786
|
Provenance
The following attestation bundles were made for sillywalk-1.0.0a0.tar.gz:
Publisher:
build.yml on AnyBody-Research-Group/sillywalk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sillywalk-1.0.0a0.tar.gz -
Subject digest:
7e96c9b58373b42bbcfd54958941674a7a7d3ede8b9543a70cd6f4eaecd8aafa - Sigstore transparency entry: 362109015
- Sigstore integration time:
-
Permalink:
AnyBody-Research-Group/sillywalk@5240545eaa76c46a10cb505fdbe3c74071ddbd66 -
Branch / Tag:
refs/tags/1.0.0a0 - Owner: https://github.com/AnyBody-Research-Group
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@5240545eaa76c46a10cb505fdbe3c74071ddbd66 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sillywalk-1.0.0a0-py3-none-any.whl.
File metadata
- Download URL: sillywalk-1.0.0a0-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d813730643e9338c43fd91c711273ee0deb715d0030ca1c29486a16ec148517
|
|
| MD5 |
c9c52f01040e11c96842a91249c0021f
|
|
| BLAKE2b-256 |
ea8386998d38084601791d233639419ca9c6f016fe2ddd5f397ebc6d0a7506f3
|
Provenance
The following attestation bundles were made for sillywalk-1.0.0a0-py3-none-any.whl:
Publisher:
build.yml on AnyBody-Research-Group/sillywalk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sillywalk-1.0.0a0-py3-none-any.whl -
Subject digest:
2d813730643e9338c43fd91c711273ee0deb715d0030ca1c29486a16ec148517 - Sigstore transparency entry: 362109021
- Sigstore integration time:
-
Permalink:
AnyBody-Research-Group/sillywalk@5240545eaa76c46a10cb505fdbe3c74071ddbd66 -
Branch / Tag:
refs/tags/1.0.0a0 - Owner: https://github.com/AnyBody-Research-Group
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build.yml@5240545eaa76c46a10cb505fdbe3c74071ddbd66 -
Trigger Event:
push
-
Statement type: