Skip to main content

No project description provided

Project description

sklearn-pandas plugin for AllenNLP

Python 3.7 Code style: black

sklearn-pandas plugin / wrapper for AllenNLP.

Install

$ pip install git+ssh://git@github.com/shunk031/allennlp-dataframe-mapper.git

Usage

Config

mapper_iris.jsonnet

{
    "type": "default",
    "features": [
        [["sepal length (cm)"], null],
        [["sepal width (cm)"], null],
        [["petal length (cm)"], null],
        [["petal width (cm)"], null],
        [["species"], [{"type": "flatten"}, {"type": "label-encoder"}]],
    ],
    "df_out": true,
}

Mapper

from allennlp.common import Params
from allennlp_dataframe_mapper import DataFrameMapper

params = Params.from_file("mapper_iris.jsonnet")
mapper = DataFrameMapper.from_params(params=params)

print(mapper)
# DataFrameMapper(df_out=True,
#                 features=[(['sepal length (cm)'], None, {}),
#                           (['sepal width (cm)'], None, {}),
#                           (['petal length (cm)'], None, {}),
#                           (['petal width (cm)'], None, {}),
#                           (['species'], [FlattenTransform(), LabelEncoder()], {})])

mapper.fit_transform(df)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

allennlp-dataframe-mapper-0.0.3.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

allennlp_dataframe_mapper-0.0.3-py3-none-any.whl (5.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page