semvec/pypi-packages huggingface dataset:
aioitd 0.2.6
Асинхронный клиент для итд.com
Requires Python: >=3.9

# aioitd

Асинхронный Python клиент для итд.com

# Установка

```commandline
pip install aioitd
```

# Пример

```python
from aioitd import AsyncITDClient
import asyncio

refresh_token = "ca1291a4a990b985a57b880ed3fb863eef80ac3990acc68e8f106a783e3af402"

async def main():
    async with AsyncITDClient(refresh_token) as client:
        user = await client.get_user("nowkie")
        print(
            f"id: {user.id}\n"
            f"username: {user.username}\n"
            f"follower_count: {user.followers_count}"
        )

asyncio.run(main())
```

Чтобы получить refresh_token:
1. Войди в аккаунт на итд.com 
2. Откройть devtools
3. Среди табов выбрать network (сеть)
4. Перезагрузить страницу
5. Найти запрос `refresh`
6. В куки запроса скопировать `refresh_token`

Или:
1. Войти в аккаунт на итд.com
2. Откройть devtools
3. Среди табов выбрать application (приложение)
4. Выбрать куки и скопировать токен

# AsyncITDClient

Автоматически вызывает `refersh`, по окончании срока жизни access токена. 

```python
async with AsyncITDClient(refresh_token) as client:
```

или

```python 
client = AsyncITDClient(refresh_token)
...
await client.close()
```



# Создание поста 

```python 
from aioitd import AsyncITDClient, File, Post
import asyncio
from uuid import UUID

refresh_token = "ВАШ ТОКЕН"

async def main():
    async with AsyncITDClient(refresh_token) as client:
        images_path = ["sun.png", "снег.gif", "python.jpg"]
        files_ids: list[UUID] = []
        for path in images_path:
            with open(path, 'rb') as f:
                file: File = await client.upload_file(f)
                files_ids.append(file.id)
        post: Post = await client.create_post("ТЕКСТ ПОСТА", attachment_ids=files_ids)


asyncio.run(main())
```

# Поменять баннер

```python
async def main():
    async with AsyncITDClient(refresh_token) as client:
        with open(r"file.gif", 'rb') as file:
            image = await client.upload_file(file)
        await client.update_profile(username="aioitd", banner_id=image.id)
```

# Error429 и RateLimitError

`Error429` возникает из-за ограничения количества запросов на сервер. Чтобы обойти, нужно соблюдать интервал между запросами.
Его можно указать в `time_delta`, и по умолчанию он равен 0.105 секунд. 

```python
async with AsyncITDClient(refresh_token, time_delta=1)
```

Чтобы отключить задержку между запросами:

```python 
async with AsyncITDClient(refresh_token, time_delta=None)
```


`RateLimitError` ограничение по количеству определённых действий для каждого аккаунта.
`retray_after` — через сколько можно повторить запрос.

```python 
while True:
    try:
        await client.post("content")
    except RateLimitError as ex:
        await asyncio.sleep(ex.retry_after)
```

# Уведомления по SSE 

```python
async def main():
    async with AsyncITDClient(refresh_token) as itd:
        async with itd.connect_sse() as events:
            async for event in events:
                print(event)

asyncio.run(main())
```

Автор в итд [aioitd](https://итд.com/aioitd), тг [@rationessEps](https://t.me/rationessEps)
nsbc 1.0.0
n-SBC: A novel machine learning model
Requires Python: >=3.10
Keywords: machine-learning, scikit-learn, nsbc

# n-SBC

A lazy machine learning classifier based on Hamming similarity over Gray-coded binary representations. Scikit-learn compatible.

> Velazquez-Gonzalez, O., Alarcon-Paredes, A., & Yanez-Marquez, C. (2026).
> *Medical pattern classification using a novel binary similarity approach based on an associative classifier.*
> Frontiers in Artificial Intelligence, 8. [DOI: 10.3389/frai.2025.1610856](https://doi.org/10.3389/frai.2025.1610856)

## Installation

```bash
pip install nsbc
```

## Quick Start

```python
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from nsbc import NSBCClassifier

X, y = load_iris(return_X_y=True)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)

clf = NSBCClassifier(n_value=3, decimals=2, factor=10)
clf.fit(X_train, y_train)

print(f"Accuracy: {clf.score(X_test, y_test):.2%}")
```

## Parameters

| Parameter  | Type  | Default | Description                                      |
|------------|-------|---------|--------------------------------------------------|
| `n_value`  | int   | 3       | Number of top-u similar samples per class         |
| `decimals` | int   | 2       | Decimal places for rounding during normalization  |
| `factor`   | int   | 10      | Multiplicative factor applied after rounding      |

## Examples

In `examples/` will contain examples of how to use the nsbc package, how to train and save the model, how to update it with new data (without requiring a costly training process), and how to load the model to make predictions.

#### TODO:
In next packege release new functions will be added to visualize the model's explainability, making it completely transparent to human understanding. This will allow us to understand the specific reasons or feartures that influenced the model's classification.


## How It Works

n-SBC is a lazy learner: it stores the entire training set encoded as Gray-coded binary vectors. At prediction time, it computes the Hamming similarity between a new sample and every training sample, sums the top-*u* similarities per class, and predicts the class with the highest aggregate similarity. The Gray code encoding ensures that numerically close values differ by only one bit, preserving ordinal relationships in the binary representation.

## Citation

If you use n-SBC in your research, please cite:

```bibtex
@article{velazquez2026medical,
  title={Medical pattern classification using a novel binary similarity approach based on an associative classifier},
  author={Velazquez-Gonzalez, Osvaldo and Alarc{\'o}n-Paredes, Antonio and Ya{\~n}ez-Marquez, Cornelio},
  journal={Frontiers in Artificial Intelligence},
  volume={8},
  year={2026},
  month={1},
  doi={10.3389/frai.2025.1610856}
}
```

## License

MIT -- see [LICENSE](LICENSE) for details.