semvec/pypi-packages huggingface dataset:
tsbb15-labs 0.0.8
Convenience functions for the tsbb15 labs.
Requires Python: >=3.6

# Support functions for the labs in the TSBB15 course
## Installation
### Setup
Make sure you have python installed.
Additionally we recommend using a package manager such as [miniconda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/index.html).

### Easiest installation
Run the command:
```terminal
pip install tsbb15-labs
```
Note that you do NOT need to clone this repo for this install.
### Install
If you want to change any code (bugfixes etc). You may want to install the package in editable mode, so that changes can be easily observed.
This can be done with the following commands:
```terminal
git clone git@github.com:Parskatt/tsbb15_labs.git
cd tsbb15_labs
pip install -e .
```

## Some known issues
### tiff errors
If you are using conda on windows you might get an error:
> tempfile.tif: Cannot read TIFF header.

If thats the case, uninstall libtiff (conda uninstall libtiff)
and reinstall it. (this will also require you to reinstall pillow)
one-relator-curvature 0.3.3
A package for studying regular sectional curvature of one relator groups
Requires Python: >=3.6

# One Relator Curvature

## About
This project provides an api for studying regular sectional curvature of one-relator groups.



## Installation

```pip install one-relator-curvature```


## Usage
There are two different ways of using the project, either through a collection of command line exposed functions, or as an imported python module

### CLI

Some function are exposed as command line tools. 

* solve_example
* solve_examples 
* get_all_cycle_data
* get_polytope
* get_polytopes

### Example Usage

### Using cli script
For solving all results in te given word range, this command stores database files in the output directory.


```one-relator-curvature solve_examples --output-dir /home/$USER/generated_examples --word-size-range 10 11```

To export polytope for a given word. Stores json for polytope in output directory


```one-relator-curvature get_polytope --word BabbAba -output-dir /home/$USER/polytope_examples```

To export polytopes for cycles of a given word. Stores json for polytope in output directory


```one-relator-curvature get_polytope --word BabbAba -output-dir /home/$USER/polytope_examples --cycles```


#### Importing as Python Module

```
from one_relator_curvature.example import Example
import matplotlib.pyplot as plt

example = Example("Babba")
example.generate_inequalities()
example.solve()
example.plot()
plt.show()
```

### Importing Polytopes into Polymake

The following code can be run as a polymake script passing the directory of any polytopes output by the commands get_polytope and get_polytopes
```

use JSON::Parse 'json_file_to_perl';
use JSON;
use Path::Class;
use application 'polytope';

sub read_inequalities_json {
  my $inequalities_file = $_[0];
  my $inequalities = json_file_to_perl ($inequalities_file);
  my $regions_inequalities = $inequalities->{"regions_inequalities"};
  my $links_inequalities = $inequalities->{"links_inequalities"};
  my $all_inequalities = ();

  push(@$all_inequalities, @$regions_inequalities);
  push(@$all_inequalities, @$links_inequalities);

  my $word_polytopes = {"regions" => new Polytope(INEQUALITIES=>$regions_inequalities),
            "links" => new Polytope(INEQUALITIES=>$links_inequalities),
            "intersection" => new Polytope(INEQUALITIES=>$all_inequalities)};

  return $word_polytopes;
}

sub main {
  my $polytopes_dir = dir($ARGV[0]);

  for my $polytope_file ($polytopes_dir->children) {
    my $word_polytopes = read_inequalities_json($polytope_file);
    my $intersection_polytope = $word_polytopes->{"intersection"};
    my $polytope_dim = $intersection_polytope->DIM;

    print "$polytope_file intersection polytope dimension $polytope_dim \n";
  }
}

main()
```
evostrat 1.4.3
A library that makes Evolutionary Strategies (ES) simple to use.

# EvoStrat 

A library that makes Evolutionary Strategies (ES) simple to use.

### Installation

`pip install evostrat`

### Usage

```python
pop = PopulationImpl(...) # See complete examples for implementations. 
optim = torch.optim.Adam(pop.parameters()) # Use any torch.optim optimizer
for i in range(N):
    optim.zero_grads()
    pop.fitness_grads(n_samples=200) # Computes approximate gradients
    optim.step()
```

For complete examples that solves 'LunarLander-v2' see the [examples/](evostrat/examples). 

![Lunar lander](media/lander.gif)

### Description

Evolutionary Strategies is a powerful approach to solve reinforcement learning problems and other optimization problems where the gradients cannot be computed with backprop. 
See ["Evolution strategies as a scalable alternative to reinforcement learning"](https://arxiv.org/abs/1703.03864) for an excellent introduction.

In ES the objective is to maximize the expected fitness of a distribution over individuals, referred to as the population. 
With a few math tricks this objective can be maximized with gradient ascent, even if the fitness function itself is not differentiable. 

This library offers
 
1. A flexible and natural interface for ES that cleanly separates the environment, the reinforcement learning agent, the population distribution and the optimization.    
2. A plug-and-play approach for reinforcement learning agents with `torch.nn.Module` policy networks. See [examples/lunar_lander.py](evostrat/examples/lunar_lander.py) and [examples/normal_lunar_lander.py](evostrat/examples/normal_lunar_lander.py). 
3. Several population distributions and variants
    1. [Independent Normal](evostrat/normal_population.py). equivalent to OpenAI ES or PEPG depending on whether the standard deviation is fixed or learned. See [examples/normal_lunar_lander.py](evostrat/examples/normal_lunar_lander.py)
    2. [Multivariate Normal](evostrat/multivariate_normal_population.py) with a full covariance matrix. Similar to CMA-ES. See [examples/multivariate_normal_lunar_lander.py](evostrat/examples/multivariate_normal_lunar_lander.py)
    3. [Categorical](evostrat/categorical_population.py). For agents with categorical parameters, demonstrating the ability to handle non-normal distributions. See the [examples/binary_lunar_lander.py](evostrat/examples/binary_lunar_lander.py). 
4. A simple interface for creating your own populations, without having to derive any gradients! Just subclass [Population](evostrat/population.py) and implement the sampling process. See the built in populations for inspiration.

### Attribution

If you use this software in your academic work please cite

``` 
@misc{palm2020,
  author = {Palm, Rasmus Berg},
  title = {EvoStrat},
  year = {2020},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/rasmusbergpalm/evostrat}}
}
```