| """this is loading script for milling processes files""" |
|
|
| import csv |
| import json |
| import os |
|
|
| import datasets |
|
|
| |
| |
| _CITATION = """\ |
| @InProceedings{huggingface:dataset, |
| title = {Multivariate time series data of milling processes with varying tool wear and machine tools}, |
| author={Tobias Stiehl}, |
| year={2023} |
| } |
| """ |
|
|
| _DESCRIPTION = """\ |
| """ |
|
|
| _HOMEPAGE = "https://data.mendeley.com/datasets/zpxs87bjt8/3" |
|
|
| _LICENSE = "CC BY 4.0" |
|
|
| |
| |
| |
| _URLS = { |
| "first_domain": "https://huggingface.co/great-new-dataset-first_domain.zip", |
| "second_domain": "https://huggingface.co/great-new-dataset-second_domain.zip", |
| } |
|
|
|
|
| class MillingProcessesLUH(datasets.GeneratorBasedBuilder): |
| """TODO: Short description of my dataset.""" |
|
|
| VERSION = datasets.Version("3") |
|
|
| |
| |
| |
|
|
| |
| |
| |
|
|
| |
| |
| |
| BUILDER_CONFIGS = [ |
|
|
| ] |
|
|
| DEFAULT_CONFIG_NAME = "first_domain" |
|
|
| def _info(self): |
| |
| features = datasets.Features( |
| { |
| "cumulated_tool_contact_time":datasets.features.Value("float32"), |
| "machine":datasets.features.Value("float32"), |
| "run":datasets.features.Value("float32"), |
| "tool":datasets.features.Value("float32"), |
| "wear":datasets.features.Value("float32"), |
| "position_control_deviation_axis_x":datasets.Sequence(datasets.Value("float32")), |
| "position_control_deviation_axis_y":datasets.Sequence(datasets.Value("float32")), |
| "time_machine":datasets.Sequence(datasets.Value("float32")), |
| "tool_position_x":datasets.Sequence(datasets.Value("float32")), |
| "tool_position_y":datasets.Sequence(datasets.Value("float32")), |
| "tool_position_z":datasets.Sequence(datasets.Value("float32")), |
| "torque_axis_x":datasets.Sequence(datasets.Value("float32")), |
| "torque_axis_y":datasets.Sequence(datasets.Value("float32")), |
| "torque_axis_z":datasets.Sequence(datasets.Value("float32")), |
| "torque_spindle":datasets.Sequence(datasets.Value("float32")), |
| "force_sensor_x":datasets.Sequence(datasets.Value("float32")), |
| "force_sensor_y":datasets.Sequence(datasets.Value("float32")), |
| "force_sensor_z":datasets.Sequence(datasets.Value("float32")), |
| "time_sensor":datasets.Sequence(datasets.Value("float32")) |
| } |
| ) |
|
|
| return datasets.DatasetInfo( |
| |
| description=_DESCRIPTION, |
| |
| features=features, |
| |
| |
| |
| |
| homepage=_HOMEPAGE, |
| |
| license=_LICENSE, |
| |
| citation=_CITATION, |
| ) |
|
|
| def _split_generators(self, dl_manager): |
| |
| |
|
|
| |
| |
| |
| urls = _URLS[self.config.name] |
| data_dir = dl_manager.download_and_extract(urls) |
| return [ |
| datasets.SplitGenerator( |
| name=datasets.Split.TRAIN, |
| |
| gen_kwargs={ |
| "filepath": os.path.join(data_dir, "train.jsonl"), |
| "split": "train", |
| }, |
| ), |
| datasets.SplitGenerator( |
| name=datasets.Split.VALIDATION, |
| |
| gen_kwargs={ |
| "filepath": os.path.join(data_dir, "dev.jsonl"), |
| "split": "dev", |
| }, |
| ), |
| datasets.SplitGenerator( |
| name=datasets.Split.TEST, |
| |
| gen_kwargs={ |
| "filepath": os.path.join(data_dir, "test.jsonl"), |
| "split": "test" |
| }, |
| ), |
| ] |
|
|
| |
| def _generate_examples(self, filepath, split): |
| |
| |
| with open(filepath, encoding="utf-8") as f: |
| for key, row in enumerate(f): |
| data = json.loads(row) |
| if self.config.name == "first_domain": |
| |
| yield key, { |
| "sentence": data["sentence"], |
| "option1": data["option1"], |
| "answer": "" if split == "test" else data["answer"], |
| } |
| else: |
| yield key, { |
| "sentence": data["sentence"], |
| "option2": data["option2"], |
| "second_domain_answer": "" if split == "test" else data["second_domain_answer"], |
| } |