semvec/pypi-packages huggingface dataset:
ilc-models 0.2.3
Data models for the ILC project
Requires Python: >=3.12

# ilc-models

![version](https://img.shields.io/badge/version-0.2.3-blue)
![Python Version from PEP 621 TOML](https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2Ffourtreestech%2Filc-models%2Fmain%2Fpyproject.toml)
![coverage](https://img.shields.io/badge/coverage-100%25-green)

**ilc-models** contains all data models for the *ILC* project.

## Installation

    (.venv) $ pip install ilc-models
llm-feature-gen 0.1.1
Feature discovery and generation utilities
Requires Python: >=3.9

# LLM_feature_gen



**LLM Feature Gen** is a Python library for **discovering and generating interpretable features** from unstructured data using Large Language Models (LLMs).  
The library provides high-level utilities for:
- Discovering human-interpretable features from sets of images,
- Integrating prompts and model outputs into structured JSON representations,
- - Generating new feature representations automatically from raw multimodal data,
e.g., creating structured tables for downstream models,


---

## Module: `discover`

The `discover` module focuses on **feature discovery** — identifying interpretable, discriminative visual or textual properties using an LLM.

### ✅ What it does
Given a folder of images and a prompt, the library:
1. Converts each image into Base64 format,  
2. Sends them to an LLM,  
3. Receives a structured JSON response describing the discovered features,  
4. Automatically saves the output to a  JSON file in `outputs/`.

---

## 📂 Project Structure
```text
LLM_feature_gen/
├─ src/
│  └─ LLM_feature_gen/
│     ├─ init.py
│     ├─ discover.py                # High-level orchestration for feature discovery
│     ├─ providers/
          ├─ openai_provider.py     # OpenAI API wrapper
│         ├─ local_provider.py      # Local LLM wrapper
│     ├─ prompts/
│     │   ├─ discovery_prompt.txt   # Default reasoning prompt
          ├─ generation_prompt.txt  # Default feature generation prompt
│     ├─ utils/
│     │   └─ image.py               # Image → base64 conversion
│     └─ tests/
│        └─ test_discover.py
├─ outputs/                         # Automatically generated feature JSONs
├─ pyproject.toml
└─ README.md
```

---

## ⚙️ Installation

Clone or download the repository, then install in editable mode:

```bash
pip install -e .
```

## 🔑 Environment Setup for OpenAI API

Create a .env file in the project root

##  Example: Discover Features from Images
```python
from LLM_feature_gen.discover import discover_features_from_images
# Folder with your example images
image_folder = "discover_images"

# Run feature discovery
result = discover_features_from_images(
    image_paths_or_folder=image_folder,
    as_set=True,  # analyze all images jointly
)

print(result)
```
This will:
- Read all .jpg/.png images from discover_images/
- the default prompt (prompts/image_discovery_prompt.txt)
- Send them to your LLM provider
- Save the results to outputs/discovered_features_<timestamp>.json

Example saved JSON:
```json
{
  "proposed_features": [
    {
      "feature": "has visible handle",
      "description": "Some objects include handles, others do not.",
      "possible_values": ["present", "absent"]
    },
    {
      "feature": "color tone",
      "description": "Images vary between metallic and earthy color palettes.",
      "possible_values": ["metallic", "matte", "bright", "dark"]
    }
  ]
}
```
lpips-nnx 0.1.0
LPIPS (Learned Perceptual Image Patch Similarity) implementation in Flax NNX
Requires Python: >=3.10

# LPIPS-NNX

LPIPS (Learned Perceptual Image Patch Similarity) implementation in Flax NNX, with weights that exactly match the official PyTorch implementation.

**No PyTorch dependency at runtime** - VGG16 weights are loaded from HuggingFace safetensors, LPIPS linear weights are bundled with the package.

## Installation

```bash
uv add lpips-nnx
```

## Usage

```python
import flax.nnx as nnx
import jax.numpy as jnp
from lpips_nnx import LPIPS

# Initialize LPIPS (downloads VGG16 weights on first use, ~553MB cached)
lpips = LPIPS(rngs=nnx.Rngs(0))

# Create sample images (NHWC format, values in [-1, 1])
x = jnp.zeros((1, 224, 224, 3))
y = jnp.ones((1, 224, 224, 3)) * 0.5

# Compute perceptual distance
distance = lpips(x, y)
print(f"LPIPS distance: {distance.item():.4f}")
```

### Input formats

Images should be in **NHWC** format (batch, height, width, channels) with values in **[-1, 1]**:

```python
# If your images are in [0, 1] range, use normalize=True
distance = lpips(x_01, y_01, normalize=True)
```

### JIT compilation

LPIPS is compatible with JAX's JIT compilation:

```python
import jax

@jax.jit
def compute_lpips(x, y):
    return lpips(x, y)

distance = compute_lpips(x, y)
```

## Dependencies

**Runtime** (lightweight):
- `jax`, `jaxlib`, `flax`
- `safetensors` - for loading VGG16 weights
- `requests` - for downloading weights

**Development only**:
- `torch`, `torchvision`, `lpips` - for comparison tests

## Acknowledgments

- LPIPS weights from [Richard Zhang et al.](https://github.com/richzhang/PerceptualSimilarity) (BSD-2-Clause)
- VGG16 weights from [timm](https://huggingface.co/timm/vgg16.tv_in1k) (BSD-3-Clause)

## References

Zhang, R., Isola, P., Efros, A. A., Shechtman, E., & Wang, O. (2018). The Unreasonable Effectiveness of Deep Features as a Perceptual Metric. CVPR.

## License

MIT (see LICENSE for third-party attributions)
societal-costs-pipeline-2026-02-05-2100 0.1.0
Societal costs pipeline CLI.
Requires Python: >=3.9

# societal_costs

Workspace for the societal costs study.

## Crates

- `crates/costs_core` — core domain types, aggregation, pricing, and validation.
- `crates/costs_models` — two-part, Tweedie, and log-normal models + selection tools.
- `crates/costs_matching` — matching + balance diagnostics.
- `crates/costs_cohort` — cohort assignment + diagnostics.
- `crates/costs_components` — register-derived component builders (LMDB volume so far).
- `crates/costs_population` — population files + public stats QC.
- `crates/costs_pipeline_common` — config, errors, tracing, and shared helpers.
- `crates/costs_pipeline_io` — report/Arrow/CSV/JSON writers.
- `crates/costs_registers` — register ingestion flows (BEF/LPR/LMDB/VNDS/DOD/etc).
- `crates/costs_pipeline_core` — orchestration + analysis/matching/modeling logic.
- `crates/costs_pipeline` — thin facade that re-exports common/core/io APIs.

## LMDB example

See `crates/costs_pipeline/README.md` for the LMDB ingestion example.

## Pipeline config

Start from `pipeline.example.toml` and update the register file paths to match
your local dataset layout. Most SAS7BDAT paths accept either a single file
or a directory (all `.sas7bdat` files are loaded, sorted by name). You can
also set `base_path` in the config to prefix all relative register paths.
File filtering uses `study.data_*` and optional `study.baseline_*` /
`study.followup_*` windows to avoid reading out-of-scope files.
Event registers (VNDS/DOD/DODSAARS/DODSAASG) are **not** year-filtered.
If you use contact-based SCD classification, set
`components.lpr.scd_inpatient_contact_types` (or flip
`components.lpr.scd_allow_outpatient = true` to allow outpatient contacts).

Pipeline outputs include consolidated QC under `qc_summary.csv/json`, plus
step-specific outputs such as `lpr_episode_qc.csv`, `matching_outcome_qc.csv`,
`matching_parent_qc.csv`, and `population_public_stats.csv`.

For terminal progress and timing, set:
- `pipeline.progress = true`
- `pipeline.log_level = "info"` (or `debug`)

## Additional docs

- `crates/costs_core/README.md` — core domain and aggregation usage.
- `crates/costs_models/README.md` — model APIs and examples.
- `crates/costs_models/examples/README.md` — runnable model examples.
- `crates/costs_components/README.md` — LMDB note (missing price fields).
- `crates/costs_pipeline/README.md` — pipeline usage and LMDB example.