semvec/pypi-packages huggingface dataset:
approx-subsetsum 0.2.4
Find fast approximate solutions for the subsetsum problem.
Requires Python: >=3.10
Keywords: subsetsum

# Approximate Subset Sum

Find fast approximate solutions for the [subset sum problem](https://en.wikipedia.org/wiki/Subset_sum_problem).

## Installation
```sh
pip install approx_subsetsum
```

## Usage
Given an integer numpy array `samples`, this function tries to find a subset of `samples`, that has a sum close to a given `capacity`.

```py
import numpy as np
from approx_subsetsum import subsetsum

samples = np.array([1, 2, 3, 4, 5])
capacity = 7
indices = subsetsum(samples, capacity, timeout=10.0, allow_higher=100)
solution = samples[indices]
if np.sum(solution) == capacity:
    print('found solution')
else:
    print('solution is off by', abs(np.sum(solution) - capacity))
```

### Parameters
- `samples`: The input array of integers. Fastest if given as numpy array (no copy). Otherwise the data will be copied.
- `capacity`: The target sum as integer. High capacities can lead to high memory usage and runtime.
- `timeout`: The maximum runtime in seconds. If the algorithm does not find a solution within this time, it throws a `approx_subsetsum.TimeoutError`.
- `allow_higher`: If set to a positive integer, the algorithm will also try to find a solution higher than `capacity` (up to `capacity + allow_higher`). Note that setting `allow_higher` to a large value can hurt performance.

## Performance
The algorithm is not well optimized, but at least implemented in C++.

For the following measurements, a script similar to the following code snippet was executed:
```py
import numpy as np
from approx_subsetsum import subsetsum

def bench(n_samples, capacity):
    samples = np.random.randint(1, 1000000, n_samples)
    subsetsum(samples, capacity, timeout=10.0)
```

The plot shows the runtime depending on the number of samples and the capacity.
![Plot visualizing the runtime](images/plot.png)
*Note: The algorithm timed out after 10 seconds.*

The following table shows an overview of the runtimes.
Of course, this depends on many things but can be used to get an idea of the performance.

| #samples | capacity | runtime    |
|----------|----------|------------|
| 1000     | 10000    | 0.000 secs |
| 10000    | 10000    | 0.001 secs |
| 100000   | 10000    | 0.006 secs |
| 1000000  | 10000    | 0.061 secs |
| 1000     | 100000   | 0.004 secs |
| 10000    | 100000   | 0.057 secs |
| 100000   | 100000   | 0.569 secs |
| 1000000  | 100000   | 5.887 secs |
| 1000     | 1000000  | 0.623 secs |
| 10000    | 1000000  | 6.093 secs |
| 100000   | 1000000  | \>60  secs |
| 1000000  | 1000000  | \>60  secs |
logging-loguru 0.4.6
Tiny script for integrating the Python's standard Logging output to the colorful logs by the Loguru library
Requires Python: >=3.8
Keywords: logging, logging custom handler, loguru

# logging-loguru

<!-- ![Lines of code](https://img.shields.io/tokei/lines/github/ablaternae/py-logging-loguru) -->
[![Code size](https://img.shields.io/github/languages/code-size/ablaternae/py-logging-loguru)](https://github.com/ablaternae/py-logging-loguru/)
[![Downloads](https://img.shields.io/pypi/dm/logging-loguru)](https://pypi.org/project/logging-loguru)
[![Downloads](https://img.shields.io/pypi/dd/logging-loguru?label=&color=green)](https://pypi.org/project/logging-loguru)
[![Statistic](https://static.pepy.tech/personalized-badge/logging-loguru?period=total&units=NONE&left_color=GRAY&right_color=GREEN&left_text=total)](https://pepy.tech/projects/logging-loguru)
[![License](https://img.shields.io/github/license/ablaternae/py-logging-loguru)](https://github.com/ablaternae/py-logging-loguru/blob/trunk/LICENSE.md)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000.svg)](https://github.com/psf/black)
<hr>

Tiny script for integrating the Python's standard Logging output to the colorful logs by the Loguru library.<br>
RLY 3kb: 1 file, 1 class, 1 function


### API
```python
class InterceptHandler(logging.Handler):
    def __init__(self, logger=loguru.logger)
    def emit(self, record: logging.LogRecord) -> None

def adapt(logger=loguru.logger, log=logging, level=0)
```

### usage

#### default behavior
```python
# file.py begin

import logging
import loguru
import logging_loguru

logging_loguru.adapt()

import ...
...
```
catches `logging.Logger` **all log**'s messages and pipes them all to default `loguru.logger` handler

#### choose Logger
```python
log = logging.getLogger("example") # ex: "flask", "WSGI", "peewee" etc, see docs

logging_loguru.adapt(log=log)
```
catches _example_'s logger messages and pipes them to default `loguru.logger` handler

#### tune handler
```python
from loguru import logger as file_logger

LOG_FORMAT = "<green>{time:YYYY-MM-DD HH:mm:ss.SSS}</green> | <level>{level: <8}</level> | <cyan>{name}</cyan>:<cyan>{function}</cyan>:<cyan>{line}</cyan> - <level>{message}</level>"

file_logger.add(
    "example.dev-{time}.log",
    colorize=False,
    compression="gz",
    format=LOG_FORMAT,
    level="DEBUG",
    retention="10 days",
    rotation="4 hours",
    enqueue=True,
)

log = logging.getLogger("example")

logging_loguru.adapt(logger=file_logger, log=log, level="INFO")
```

<br>
That's all, folks!

<hr>
<small>ps: yeah, script is very similar to https://github.com/MatthewScholefield/loguru-logging-intercept/, but how could it have been written differently?</small>
refedez 1.0.0
Tool for automatizing the deployment of easy federated learning examples
Requires Python: >=3.12

<h1 align="center">ReFedEz</h1>

<p align="center">
  <img src="docs/docs/assets/refedez.png" alt="ReFedEz Logo">
</p>

**ReFedEz** 🚀 is a Python application and library designed to simplify the implementation and deployment of federated learning architectures. It provides a command-line interface (CLI) for deploying servers and clients directly in their target environments, ensuring consistency and reproducibility, and a Python library that seamlessly integrates into your machine learning code, enabling federated learning to work "like magic" with minimal modifications.

Federated learning is a powerful technique for training machine learning models across distributed data sources while maintaining privacy. ReFedEz serves as the "fast.ai of federated learning" – a beginner-friendly framework that prioritizes simplicity and rapid prototyping. It abstracts the underlying complexities, allowing researchers and developers to focus on their ML innovations rather than infrastructure challenges.

## Demo 🎥

Experience ReFedEz in action:

<script src="https://asciinema.org/a/S3k6bw7777EUIV1hscmVSvV7d.js" id="asciicast-S3k6bw7777EUIV1hscmVSvV7d" async="true"></script>

## Features ✨

- **Simplicity**: Deploy federated learning setups with ease, and adapt it with minimal code changes.
- **Multi-Backend Support**: Works with NumPy, PyTorch and TensorFlow.
- **Reproducible**: Bit by bit reproducible, thanks to nix and uv2nix.
- **Multi-Node encrypted by default**: Self-signed TLS certificates for the communication between nodes.

## Documentation 📚

For detailed guides, API reference, and more, visit the [Documentation](https://refedez.udl.cat).

## Contributing 🤝

Contributions are welcome! Please see the documentation for guidelines.

## License 📄

This project is licensed under the [MIT license](LICENSE)