semvec/pypi-packages huggingface dataset:
torchgs 0.0.2
Pytorch wrapper for performing grid-search
Requires Python: >=3.7
Keywords: pytorch,machine-learning,deep-learning,deep learning,machine learning,grid-search,grid search

# torchgs

Pytorch wrapper for grid search of hyperparameters
[https://github.com/danny-1k/torch-gs]

## Install

```
$ pip install torchgs
```

## Example
Finding the best set of hyper-parameters and models for a classification problem

```python
from sklearn.datasets import make_classification

import torch
import torch.nn as nn

from torch.utils.data import TensorDataset

from torchgs import GridSearch

from torchgs.metrics import Loss

X,Y = make_classification(n_samples=200, n_features=20, n_informative=10,n_classes=2,shuffle=True, random_state=42)

X = torch.Tensor(X).float()
Y = torch.Tensor(Y).long()

traindata = TensorDataset(X,Y)

net1 = nn.Sequential(
    nn.Linear(20,10),
    nn.ReLU(),
    nn.Linear(10,2)
)

net2 = nn.Sequential(
    nn.Linear(20,10),
    nn.Tanh(),
    nn.Linear(10,2)
)

net3 = nn.Sequential(
    nn.Linear(20,20),
    nn.ReLU(),
    nn.Linear(20,10),
    nn.ReLU(),
    nn.Linear(10,2)
)

net4 = nn.Sequential(
    nn.Linear(20,20),
    nn.Tanh(),
    nn.Linear(20,10),
    nn.Tanh(),
    nn.Linear(10,2)
)


search_space = {
    'trainer':
        {
            'net': [net1,net2,net3,net4],
            'optimizer': [torch.optim.Adam],
            'lossfn': [torch.nn.CrossEntropyLoss()],
            'epochs': list(range(11)),
            'metric': [Loss(torch.nn.CrossEntropyLoss())],
        },
    'train_loader': {
        'batch_size': [32,64],
    },

    'optimizer':
        {
            'lr': [1e-1,1e-2,1e-3,1e-4],
    },
}

searcher = GridSearch(search_space)
results = searcher.fit(traindata)
best = searcher.best(results,using='mean',topk=10,should_print=True)
```
Output

<img src="output.png" alt="output">



## torchgs
- Trainer
- GridSearch
- metrics
- optimizers

## torchgs.metrics
- Metric
- Loss
- Accuracy
- Recall
- Precision
- F1

## torchgs.optimizers
- Optimizer
- LRscheduler

# Todo
- Parallel Training on multiple GPUS
- Tensorboard Integration

## Pull requests are welcome, let's collab ðŸ¤².
multitoeter 2
Send out messages to Mastodon and Twitter using one simplistic unified API
Requires Python: >=3.7

# 📢 MultiToeter
## Introduction
MultiToeter is a python library providing a simplified unified API for sending messages to both the Twitter and Mastodon platform at the same time.

## Usage
```bash
# install through pip
pip install multitoeter
```

### Initialize through autoinit
MultiToeter support initializing your keys and secrets, needed for connecting to the Twitter and Mastodon API, through environment variables or through a `.env` file. Below are two examples on how to use this. You can mix and match these two methods. The priority is currently to try environment variables first followed by the `.env` file.

```python3
# Simple script to send a message through MultiToeter
# Save as: test.py
from multitoeter import autoinit_multitoeter

mt = autoinit_multitoeter()

toeter = mt.toeter('Testing MultiToeter API autoinit')
toeter = mt.toeter('Reply message', in_reply_to=toeter)
```

```bash
# environment variable example
# only use mastodon in this example
MASTODON_ACCESS_TOKEN=<..> MASTODON_BASE_URL=https://mstdn.science python test.py 
```

```bash
# .env file example
MASTODON_ACCESS_TOKEN=<..>
MASTODON_BASE_URL=https://mstdn.science

TWITTER_CONSUMER_KEY=<..>
TWITTER_CONSUMER_SECRET=<..>
TWITTER_ACCESS_TOKEN=<..>
TWITTER_ACCESS_TOKEN_SECRET=<..>

# Now run test.py:
# python test.py 
```



### Initialize in code
A secondary approach is to initialize MultiToeter in code instead of using the autoinit. This gives you more flexibility and allows you to use more than one account for the same platform should you need it.

```python3
from multitoeter import Mastodon, Twitter, MultiToeter

mastodon1 = Mastodon(
  access_token="<..>",
  api_base_url="https://mstdn.science"
)
mastodon2 = Mastodon(
  access_token="<..>",
  api_base_url="https://mstdn.social/"
)

twitter1 = Twitter(
  consumer_key="<..>"
  consumer_secret="<..>"
  access_token="<..>"
  access_token_secret="<..>"
)

multi = MultiToeter({'mastodon1': mastodon1, 'mastodon2': mastodon2, 'twitter': twitter1})

toeter = multi.toeter("Test post via MultiToeter API")
toeter = multi.toeter("Test reply via MultiToeter API", in_reply_to=toeter)
```


### Adding media files
Limited support for media files is available. The unified API expects you to point to the media files directly.

```python3
# Assume that the file test.jpg exists
from multitoeter import autoinit_multitoeter

mt = autoinit_multitoeter()

toeter = mt.toeter('Testing MultiToeter API autoinit', media_files=['test.jpg'])
```
oops_all_itertools 1.0.1
itertools and more-itertools all in one namespace
Keywords: itertools,iterator,iteration,filter,peek,peekable,chunk,chunked

==================
Oops All Itertools
==================

Python's ``more-itertools`` is a fantastic compliment to ``itertools`` but it's
inconvenient to have to constantly look up which itertool is in which library.
Oops All Itertools heaps them together into a loose pile in a single namespace.

Inspired by `more-itertools issue 681 <https://github.com/more-itertools/more-itertools/issues/681>`_

|Build Status|

.. |Build Status| image:: https://github.com/lonnen/oops-all-itertools/actions/workflows/main.yml/badge.svg?branch=main
   :target: https://github.com/lonnen/oops-all-itertools/actions/workflows/main.yml

:Code:          https://github.com/lonnen/oops-all-itertools
:Issues:        https://github.com/lonnen/oops-all-itertools/issues
:Releases:      https://pypi.org/project/oops_all_itertools/#history
:License:       MIT; See LICENSE

Install
=======

To get started, install the library with `pip <https://pip.pypa.io/en/stable/>`_:

.. code-block:: shell

    $ pip install oops-all-itertools


Usage
=====

.. code-block:: python

    >>> from oops_all_itertools import chain, chunked

    >>> list(chain.from_iterable(chunked(range(6), 3)))
    [0, 1, 2, 3, 4, 5]


For the full list of functions, see the `itertools API documentation <https://docs.python.org/3/library/itertools.html>`_
and the `more-itertools API documentation <https://more-itertools.readthedocs.io/en/stable/api.html>`_.