semvec/pypi-packages huggingface dataset:
l-graph 0.2.2
Python module for working with L-graphs

# lgraph
Python module for working with L-graphs.

## Installation
```sh
pip install l-graph
```

## Creating an L-graph
```python
from lgraph import LGraph

lg = LGraph(3)

lg.add_edge(lg.initial_main.name, '1')
lg.add_edge('1', '2', label='b', round_trace=')', square_trace='[')
lg.add_edge('2', '3', label='c', square_trace=']')
lg.add_edge('3', lg.final_main.name)

lg.add_edge('1', '1', label='a', round_trace='(')
lg.add_edge('2', '2', label='b', round_trace=')', square_trace='[')
lg.add_edge('3', '3', label='c', square_trace=']')

```
![Graph_example](graph_images/a^n_b^n_c^n.png)

## Saving and loading L-graphs
```python
lg.save('graph_examples/a^n_b^n_c^n')
lg.load('graph_examples/a^n_b^n')
```

## Cheking if string is in the language of the L-graph
```python
lg = LGraph()
lg.load('graph_examples/a^n_b^n_c^n')

'abc' in lg
>>> True

'abccc' in lg
>>> False

# Finding path of the string
path = lg.find_successful_path('abc')
LGraph.path_to_string(path)
>>> initial_main---->1--a-->1--b-->2--c-->3---->final_main

```

## Type definition of the L-graph
L-graph types defined in LGraph.LGraphType 
```python
class LGraphType(Enum):
    RECURSIVELY_ENUMERABLE = 0
    CONTEXT_SENSITIVE = 1
    CONTEXT_FREE = 2
    REGULAR = 3
```
To define type of the L-graph use:
```python
lg.type
```
To check properties of L-graph use:
```python
lg.is_regular()
lg.is_context_free()
lg.is_context_sensitive()
```

## Opeartions
Left:
![Graph_example](graph_images/left.png)

Right:
![Graph_example](graph_images/right.png)

```python
lg_left, lg_right = LGraph(), LGraph()

lg_left.load('graph_examples/left')
lg_right.load('graph_examples/right')
```

### Concatenation
```
lg = lg_left * lg_right
lg.save('graph_examples/concatenate_result')
```
![Graph_example](graph_images/concat.png)

### Union
```python
lg = lg_left + lg_right
lg.save('graph_examples/union_result')
```
![Graph_example](graph_images/union.png)

Shorter version is also available:
```python
lg_left *= lg_right
lg_left += lg_right
```
experiment-replay 0.0.1
Make running, replaying experiments easier either on Pytorch or Tensorflow

# Experiment replay

## Description

Simple utils to record the commands you run. It was developped with ML experiments
in mind. Where you often tweak your code just a little before launching an experiment
and when after a few days/weeks you come back you want to know how you achieved such
amazing results you don't remember and it takes a long time to achieve again.

This library is extremely simple. You can't run any experiment that is not committed
so you have a commit to know what was changed and why. It also stores the exact command
line you used so that configuration hacking is also remembered. It uses the git commit
message to store that data so it does not require any external tool.

## Install

`pip install experiment_replay`

## Usage

It's simple to enable an experiment just do  in your `train.py` file for instance

```python
import experiment_replay

## My code

if __name__ == "__main__":
    experiment_replay.setup()
    my_training_loop()
```

Then when you actual run your training let's say `python train.py --batch-size=16`.

You can then do:

`python -m experiment_replay` to get the list of all the commands you ran with
experiment_replay enabled.

```
Experiments :
Date                       Id     Commit                                   Command             
2019-05-13 14:53:35.410538 472a12 f9dfe80125ea4856ce368270bce3aeb980829b2c python example.py  
```

You can they replay it with `python -m experiment_replay 472a12`