Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 02 more tabular datasets #1237

Merged
merged 2 commits into from
Jul 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions ludwig/datasets/allstate_claims_severity/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2021 Uber Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
import os
import pandas as pd

from ludwig.datasets.base_dataset import BaseDataset, DEFAULT_CACHE_LOCATION
from ludwig.datasets.mixins.kaggle import KaggleDownloadMixin
from ludwig.datasets.mixins.load import CSVLoadMixin
from ludwig.datasets.mixins.process import IdentityProcessMixin


def load(cache_dir=DEFAULT_CACHE_LOCATION, split=False,
kaggle_username=None, kaggle_key=None):
dataset = AllstateClaimsSeverity(
cache_dir=cache_dir,
kaggle_username=kaggle_username,
kaggle_key=kaggle_key
)
return dataset.load(split=split)


class AllstateClaimsSeverity(CSVLoadMixin, IdentityProcessMixin, KaggleDownloadMixin, BaseDataset):
"""Allstate Claims Severity

https://www.kaggle.com/c/allstate-claims-severity/overview
"""

def __init__(
self,
cache_dir=DEFAULT_CACHE_LOCATION,
kaggle_username=None,
kaggle_key=None
):
self.kaggle_username = kaggle_username
self.kaggle_key = kaggle_key
self.is_kaggle_competition = True
super().__init__(dataset_name='allstate_claim_severity', cache_dir=cache_dir)
7 changes: 7 additions & 0 deletions ludwig/datasets/allstate_claims_severity/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 1.0
competition: allstate-claims-severity
archive_filename: allstate-claims-severity.zip
split_filenames:
train_file: train.csv
csv_filename: train.csv
download_file_type: csv
52 changes: 52 additions & 0 deletions ludwig/datasets/porto_seguro_safe_driver/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#! /usr/bin/env python
# coding=utf-8
# Copyright (c) 2021 Uber Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
import os
import pandas as pd

from ludwig.datasets.base_dataset import BaseDataset, DEFAULT_CACHE_LOCATION
from ludwig.datasets.mixins.kaggle import KaggleDownloadMixin
from ludwig.datasets.mixins.load import CSVLoadMixin
from ludwig.datasets.mixins.process import IdentityProcessMixin


def load(cache_dir=DEFAULT_CACHE_LOCATION, split=False,
kaggle_username=None, kaggle_key=None):
dataset = PortoSeguroSafeDriver(
cache_dir=cache_dir,
kaggle_username=kaggle_username,
kaggle_key=kaggle_key
)
return dataset.load(split=split)


class PortoSeguroSafeDriver(CSVLoadMixin, IdentityProcessMixin, KaggleDownloadMixin, BaseDataset):
"""Porto Seguro's Safe Driver Prediction

https://www.kaggle.com/c/porto-seguro-safe-driver-prediction/overview
"""

def __init__(
self,
cache_dir=DEFAULT_CACHE_LOCATION,
kaggle_username=None,
kaggle_key=None
):
self.kaggle_username = kaggle_username
self.kaggle_key = kaggle_key
self.is_kaggle_competition = True
super().__init__(dataset_name='porto_seguro_safe_driver', cache_dir=cache_dir)

7 changes: 7 additions & 0 deletions ludwig/datasets/porto_seguro_safe_driver/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 1.0
competition: porto-seguro-safe-driver-prediction
archive_filename: porto-seguro-safe-driver-prediction.zip
split_filenames:
train_file: train.csv
csv_filename: train.csv
download_file_type: csv