sc2_datasets.transforms.utils

Attributes

Functions

filter_player_stats(→ dict[str, ...)

Filters PlayerStats events and places them in lists based on the playerId.

average_player_stats(→ dict[str, list[float]])

Exposes the logic of selecting and averaging PlayerStats events from within TrackerEvents list.

select_apm_1v1(→ dict[str, int])

Exposes logic for selecting APM from replay data.

select_outcome_1v1(→ dict[str, int])

Exposes logic for selecting game outcome of a 1v1 game.

Module Contents

RESULT_DICT
filter_player_stats(sc2_replay: sc2_datasets.replay_data.sc2_replay_data.SC2ReplayData) dict[str, list[sc2_datasets.replay_parser.tracker_events.events.player_stats.player_stats.PlayerStats]]

Filters PlayerStats events and places them in lists based on the playerId.

Parameters:

sc2_replay (SC2ReplayData) – Specifies the replay that the outcome will be selected from.

Returns:

Returns a dictionary containing a mapping from playerId to the respective player stats.

Return type:

dict[str, list[PlayerStats]]

Examples

Correct Usage Examples:

The use of this method is intended to filter player’s events from the game based on playerId

You should set sc2_replay parameter.

May help you in analysing on the dataset.

The parameters should be set as in the example below.

>>> filter_player_stats_object = filter_player_stats(
...        sc2_replay= sc2_replay: SC2ReplayData)
>>> assert isinstance(sc2_replay, SC2ReplayData)

Incorrect Usage Examples:

>>> wrong_type_object = int(2)
>>> filter_player_stats_object = filter_player_stats(
...        sc2_replay= wrong_type_object)
Traceback (most recent call last):
...
TypeError: unsupported operand type(s) ...

If you don’t set parameters or paste incorect parameters’ type.

Will throw an exception if the player’s id in the game is greater than 2.

average_player_stats(sc2_replay: sc2_datasets.replay_data.sc2_replay_data.SC2ReplayData) dict[str, list[float]]

Exposes the logic of selecting and averaging PlayerStats events from within TrackerEvents list.

Parameters:

sc2_replay (SC2ReplayData) – Specifies the replay that the outcome will be selected from.

Returns:

Returns a dictionary containing averaged features.

Return type:

dict[str, list[float]]

Examples

Correct Usage Examples:

The use of this method is intended to average stats of the player from the game.

You should set sc2_replay parameter.

The parameters should be set as in the example below.

>>> average_player_stats_object = average_player_stats(
...        sc2_replay= sc2_replay: SC2ReplayData)
>>> assert isinstance(sc2_replay, SC2ReplayData)

Incorrect Usage Examples:

>>> wrong_type_object = int(2)
>>> average_player_stats_object = average_player_stats(
...        sc2_replay= wrong_type_object)
Traceback (most recent call last):
...
TypeError: unsupported operand type(s) ...

If you don’t set parameters or paste incorect parameters’ type.

select_apm_1v1(sc2_replay: sc2_datasets.replay_data.sc2_replay_data.SC2ReplayData) dict[str, int]

Exposes logic for selecting APM from replay data.

Parameters:

sc2_replay (SC2ReplayData) – Specifies the replay that the outcome will be selected from.

Returns:

Returns player id to APM mapping.

Return type:

dict[str, int]

Examples

Correct Usage Examples: The use of this method is intended to check the value of the correct APM from the selected replay.

The parameters should be set as in the example below.

>>> select_apm_1v1_object = select_apm_1v1(
...        sc2_replay= sc2_replay: SC2ReplayData)
>>> assert isinstance(sc2_replay, SC2ReplayData)

Incorrect Usage Examples:

>>> wrong_type_object = int(2)
>>> select_apm_1v1_object = select_apm_1v1(
...        sc2_replay= wrong_type_object)
Traceback (most recent call last):
...
TypeError: unsupported operand type(s) ...

If you don’t set parameters or paste incorect parameters’ type.

select_outcome_1v1(sc2_replay: sc2_datasets.replay_data.sc2_replay_data.SC2ReplayData) dict[str, int]

Exposes logic for selecting game outcome of a 1v1 game. Maps loss to 0, and win to 1.

Parameters:

sc2_replay (SC2ReplayData) – Specifies the replay that the outcome will be selected from.

Returns:

Returns a dictionary mapping loss to 0, and win to 1 for playerIDs.

Return type:

dict[str, int]

Examples

The use of this method is intended to check logic value of the selected 1v1 game, lose or win

You should set sc2_replay parameter.

The parameters should be set as in the example below.

>>> select_outcome_1v1_object = select_outcome_1v1(
...        sc2_replay= sc2_replay: SC2ReplayData)
>>> assert isinstance(sc2_replay, SC2ReplayData)

Incorrect Usage Examples:

>>> wrong_type_object = int(2)
>>> select_outcome_1v1_object = select_outcome_1v1(
...        sc2_replay= wrong_type_object)
Traceback (most recent call last):
...
TypeError: unsupported operand type(s) ...

If you don’t set parameters or paste incorect parameters’ type.