semvec/pypi-packages huggingface dataset:
sc2-env 0.11.1.2
A StarCraft II bot gym env library over python-sc2
License: MIT
Requires Python: >=3.6
Keywords: StarCraft,StarCraft 2,StarCraft II,AI,Bot

# A StarCraft II bot gym env library over python-sc2

This library provide [python-sc2](https://github.com/Dentosal/python-sc2) as a [gym](https://github.com/openai/gym) environment.
So you benefits both from the sc2.BotAI and gym.Env classes to train your bot using existing algorithms.

**This library (currently) covers only the raw scripted interface.** At this time I don't intend to add support for graphics-based interfaces.

## Documentation

### class Sc2Env(gym.Env)

#### def __init__(self, map, bot_race, get_opponents, **kwargs):

- map `str` upper camel case name of an installed map (ex: KingsCoveLE)
- bot_race `str` race of the bot (ex: Zerg)
- get_opponents `Callable` the opponents of the bot
  - returns a `list` of `AbstractPlayer` (BotAI, Player...)
- initializer `Callable`
    Called on start, must set BotAI.action_space and BotAI.observation_space.
    The defined spaces must inherit from gym.spaces.space.Space.

    example:

    '''python
    def initializer(bot):
        bot.action_space = gym.spaces.Box(5,10)
        bot.observation_space = gym.spaces.Box(3,11)
    '''
- observer: `async` `Callable`
    Called on step takes a `sc2.BotAI` instance, must return an observation and a reward.
    An observation is a `numpy.array` matching the observation space and a reward is `number`.
- actuator: `async` `Callable`
    Called on step, takes a `sc2.BotAI` instance and an action.
    An action is a `numpy.array` matching the action space.
    Used to run actions using in sc2.
- **kwargs `any` sc2.run_game extra arguments

More on sc2.BotAI [here](https://github.com/Dentosal/python-sc2/wiki).

## Installation

By installing this library you agree to be bound by the terms of the [AI and Machine Learning License](http://blzdistsc2-a.akamaihd.net/AI_AND_MACHINE_LEARNING_LICENSE.html).

You'll need Python 3.6 or newer.

```bash
pip3 install --user --upgrade sc2-env
```

You'll also need an StarCraft II executable. If you are running Windows or macOS, just install the normal SC2 from blizzard app. [The free starter edition works too.](https://us.battle.net/account/sc2/starter-edition/). Linux users get the best experience by installing the Windows version of StarCraft II with [Wine](https://www.winehq.org). Linux user can also use the [Linux binary](https://github.com/Blizzard/s2client-proto#downloads), but it's headless so you cannot actually see the game.

You probably want some maps too. Official map downloads are available from [Blizzard/s2client-proto](https://github.com/Blizzard/s2client-proto#downloads). Notice: the map files are to be extracted into *subdirectories* of the `install-dir/Maps` directory.

### Running

After installing the library, a StarCraft II executable, and some maps, you're ready to get started. Look at the dummy bot example!

```bash
python3 examples/dummy_bot.py
```

If you installed StarCraft II on Linux with Wine, set the `SC2PF` environment variable to `WineLinux`:

```bash
SC2PF=WineLinux python3 examples/dummy_bot.py
```
saltclass 0.2.1
Short and Long Text Classifier using clustering-based enrichment
License: MIT
Keywords: short text classification

|Travis|_

.. |Travis| image:: https://travis-ci.com/bagheria/saltclass.svg?token=fYbdQUbpnoucyHyb3fs2&branch=master
.. _Travis: https://travis-ci.com/bagheria/saltclass

saltclass
---------

saltclass (Short and Long Text Classifier) is a Python module for text classification built under the MIT license.
The project was started in 2018 at the Department of Methodology & Statistics, Utrecht University.

Short text classification can be defined simply as follows: Given a set of documents with representation D and a set of labels C, define a function F that will assign a value from the set of C to each document in D. Since short text is characterized by shortness in the length, and sparsity in the representation, we try to optimize D and F in such a way that results in better performance in managing and analyzing EHR text data.

Figure below presents the semantic flowchart of the proposed intra-clustering method. In this framework, the clustering procedure is used as the heart of the approach, where it pumps cluster information throughout the body of text via the smoothing system, supplying text length and other information. This method is a hybrid technique, using benefits of different modules, including dictionary- and topic-based approaches, smoothing methods, and cluster information.

.. image:: https://github.com/bagheria/saltclass/blob/master/Architecture.png

Installation
------------

To install via pip::

    $ pip install saltclass
    $ pip install --upgrade saltclass


Methods overview
------------
.. image:: https://github.com/bagheria/saltclass/blob/master/methods.png

Sample Usage
------------

.. code:: python

Example 1:
    >>> import saltclass
    >>> train_X = [[10, 0, 0], [0, 20, 0], [4, 13, 5]]
    >>> train_y = [0, 1, 1]
    >>> vocab = ['statistics', 'medicine', 'crime']
    >>> object_from_df = saltclass.SALT(train_X, train_y, vocabulary=vocab, language='en')
    >>> X = [[10, 12, 0], [14, 3, 52]]
    >>> object_from_df.enrich(method='kmeans', include_unlabeled=True, unlabeled_matrix=X)
    >>> object_from_df.train(classifier='KNN', k=5)

Example 2:
    >>> object_from_df.enrich(method='lda', include_unlabeled=True, unlabeled_dir='/Data/unlabeled/')
    >>> object_from_df.train(classifier='nn', alpha=0.01, hidden_layer_sizes=(50,), max_iter=10, solver='adam', activation='relu')

Example 3:
    >>> object_from_file = SALT.data_from_dir(train_dir='/train/', language='nl')
    >>> object_from_df.enrich(include_unlabeled=False)
    >>> object_from_df.train(classifier='svm', kernel='sigmoid')
    >>> object_from_df.print_info()

    >>> prediction = object_from_df.predict(data_file='second_test.txt')
    >>> print(object_from_df.vocabulary)
    >>> print(object_from_df.newdata)
    >>> print([k for (k, v) in object_from_df.vocabulary.items() if object_from_df.newdata[0][v] != 0])
    >>> print(prediction)


Dependencies
~~~~~~~~~~~~

saltclass requires:

- Python (>= 3.5)
- NumPy (>= 1.11.0)
- SciPy (>= 0.17.0)
- LDA
- Scikit-learn (>= 0.20.0)
- Matplotlib (>= 3.0)
- Tqdm
- Language_check