semvec/pypi-packages huggingface dataset:
Torch-Yottaxx 0.1.3
a simple autograd library
Requires Python: >=3.6

# Simple Torch
`implement by numpy`


## autograd
###  tensor
  Implement: Basic computing between tensors,also,recording depedency between tensors and grad of tensors.
### function
  Implement: Activation function.There is only tanh currently.
### parameter
  Implement: Quick create random tensors with requires_grad=True.
### module
  Implement: Recording of all parameters
###  optim
  Implement: Optimizing for module.

## tests
  Test for autograd function
<br>

#  example
## fizz_buzz

```python
import numpy as np
from typing import List
from autograd import Tensor, Parameter, Module
from autograd.optim import SGD
from autograd.function import tanh

"""
print the numbers 1 to 100,
except  
    if the number is divisible by 3 print "fizz"
    if the number is divisible by 5 print "fizz"
    if the number is divisible by 15 print "fizz_buzz"

"""


def binary_encode(x: int) -> List[int]:
    return [x >> i & 1 for i in range(10)]


def fizz_buzz_encode(x: int) -> List[int]:
    if x % 15 == 0:
        return [0, 0, 0, 1]
    elif x % 5 == 0:
        return [0, 0, 1, 0]
    elif x % 3 == 0:
        return [0, 1, 0, 0]
    else:
        return [1, 0, 0, 0]


x_train = Tensor([binary_encode(x) for x in range(101, 1024)])
y_train = Tensor([fizz_buzz_encode(x) for x in range(101, 1024)])


class FizzBuzzModule(Module):
    def __init__(self, num_hidden: int = 50) -> None:
        self.w1 = Parameter(10, num_hidden)
        self.b1 = Parameter(num_hidden)

        self.w2 = Parameter(num_hidden, 4)
        self.b2 = Parameter(4)

    def predict(self, in_puts: Tensor):
        # inputs (batch_size,10)
        x1 = inputs @ self.w1 + self.b1  # (batch_size,num_hidden)
        x2 = tanh(x1)
        x3 = x2 @ self.w2 + self.b2  # (batch_size,4)
        return x3


optimizer = SGD(lr=0.001)
batch_size = 32
module = FizzBuzzModule()

starts = np.arange(0, x_train.shape[0], batch_size)
for epoch in range(10000):
    epoch_loss = 0.0

    np.random.shuffle(starts)
    for start in starts:
        end = start + batch_size

        module.zero_grad()
        inputs = x_train[start:end]

        predicted = module.predict(inputs)
        actual = y_train[start:end]
        errors = predicted - actual
        loss = (errors * errors).sum()

        loss.backward()
        epoch_loss += loss.data

        optimizer.step(module)
    print(epoch, epoch_loss)

num_correct = 0
for x in range(1, 101):
    inputs = Tensor([binary_encode(x)])
    predicted = module.predict(inputs)[0]
    predicted_idx = np.argmax(predicted.data)
    actual_idx = np.argmax(fizz_buzz_encode(x))
    labels = [str(x), "fizz", "buzz", "fizz_buzz"]

    if predicted_idx == actual_idx:
        num_correct += 1
    print(x, labels[predicted_idx], labels[actual_idx])

print(num_correct,"/100")
```
ws2x-vjsrinivas 0.0.4
A simple simulator for WS2812B-style LED strips
Requires Python: >=3.0

LEDStrip
========

Python simulation of WS2812 (or probably other WS-type LEDs) LED strips commonly used by NeoPixel API.


## Example 
```
from led import LEDSim
import cv2
import numpy as np

pixel = LEDSim()
pixel.fill((0,0,0))

p = 0
for r in range(1,6):
	for g in range(1,6):
		for b in range(1,6):
			pixel[p] = (r,g,b)
			p += 1

pixel.visualize()
```
pyticle 0.0.3
A Python Library for Particle Swarm Intelligence
Requires Python: >=3.6

# pyticle
A Python Library for Particle Swarm Intelligence

[![Build Status](https://circleci.com/gh/owhadi/pyticle.svg)](https://app.circleci.com/pipelines/github/owhadi)

This package implements the Particle Swarm Optimization (PSO) algorithm in pure python. The only thing you need to is 
installing the package and call it with the right parameters!

PSO is an interactive meta-heuristic algorithm that uses "particles" as a candidates for solutions. The goal is to move the particles 
towards the global/local minimum in each iteration.

## Installation
Simply install this package by running the following command:
```bash
pip install pyticle 
```

## Usage

To minimize the 2D function `my_func` in range [-15, 10] using 100 particles via 80 iterations:
```python
from pyticle.swarm_optimization import SwarmOptimization
optimizer = SwarmOptimization(cost_func=my_func, particle_num=100, omega_start=1, omega_end=0.0,
Â coef=[2.0, 2.0], low_bound=-15.0, high_bound=10,
Â boundary_strategy='random', var_size=2, max_iter_num=80, elite_rate=0.1)
optimizer.optimize()
```

## Demo

In this section, you can see the results of using this package for two simple 2D benchmarks. To run the benchmarks, run:
```python
from pyticle.demo_run import demo_run
demo_run()
```

### The Sphere Function
Here is the evolution of 100 particles in 100 iterations to find the minimum of [the Sphere function](https://en.wikipedia.org/wiki/File:Sphere_function_in_3D.pdf):

![](demo/x2_particles.gif)

Here is the changes in the minimum, average, and maximum values of the cost function of all particles over time:

![](demo/x2_history.png)

### The Ackley Function
Same as the previous example, this is the evolution of 100 particles in 100 iterations to find the minimum of [the Ackley function](https://en.wikipedia.org/wiki/Ackley_function):

![](demo/ackley_particles.gif)

Here is the changes in the minimum, average, and maximum values of the cost function of all particles over time:

![](demo/ackley_history.png)


## Contribution
You are very welcome to contribute to this project with your code (as pull-requests), mention the bugs or ask for new 
features (as GitHub Issues), or just tell your friends about it! 

You can also directly contact me by [email](moein.owhadi@gmail.com).
Â