🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

sportsfeatures

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sportsfeatures

A library for processing sports features over a dataframe containing sports data.

0.0.60
PyPI
Maintainers
1

sports-features

PyPi

A library for processing sports features over a dataframe containing sports data.

Dependencies :globe_with_meridians:

Python 3.11.6:

Raison D'être :thought_balloon:

sportsfeatures aims to process features relevant to predicting aspects of sporting games.

Architecture :triangular_ruler:

sportsfeatures is a functional library, meaning that each phase of feature extraction gets put through a different function until the final output. It contains some caching when the processing is heavy (such as skill processing). The features its computes are as follows:

  • Process the player and teams skill levels using OpenSkill. This is an ELO like rating system giving a probability of win and loss.
  • Compute the offensive efficiency of each team/player.
  • Compute the time series values of the numeric features for each team/player over the various windows provided. This includes lag, count, sum, mean, median, var, std, min, max, skew, kurt, sem, rank.
  • Compute the datetime features for any datetime columns.
  • Remove the lookahead features.

Installation :inbox_tray:

This is a python package hosted on pypi, so to install simply run the following command:

pip install sportsfeatures

or install using this local repository:

python setup.py install --old-and-unmanageable

Usage example :eyes:

The use of sportsfeatures is entirely through code due to it being a library. It attempts to hide most of its complexity from the user, so it only has a few functions of relevance in its outward API.

Generating Features

To generate features:

import datetime

import pandas as pd

from sportsfeatures.process import process
from sportsfeatures.identifier import Identifier
from sportsfeatures.entity_type import EntityType

df = ... # Your sports data
identifiers = [
    Identifier(EntityType.TEAM, "teams/0/id", ["teams/0/kicks"], "teams/0"),
    Identifier(EntityType.TEAM, "teams/1/id", ["teams/1/kicks"], "teams/1"),
]
df = process(df, identifiers, [datetime.timedelta(days=365), None], "dt")

This will produce a dataframe that contains the new sports related features.

License :memo:

The project is available under the MIT License.

Keywords

features

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts