functional loading script
Browse files- data/{M1T1R100C570VB55.h5.parquet → M3T9R588C3352VB152.h5} +2 -2
- data/{M1T1R101C574VB55.h5.parquet → M3T9R589C3356VB152.h5} +2 -2
- data/{M1T1R102C578VB55.h5.parquet → M3T9R590C3360VB153.h5} +2 -2
- data/{M1T1R103C582VB55.h5.parquet → M3T9R591C3364VB153.h5} +2 -2
- data/M3T9R592C3367VB153.h5 +3 -0
- data/M3T9R593C3371VB153.h5 +3 -0
- data/M3T9R594C3375VB154.h5 +3 -0
- data/M3T9R608C3445VB159.h5 +3 -0
- data/M3T9R609C3449VB160.h5 +3 -0
- data/data.csv +0 -0
- milling_LUH_data.py +130 -0
- milling_processes_LUH__testing_propuses.py +0 -165
- notebook.ipynb +122 -1
data/{M1T1R100C570VB55.h5.parquet → M3T9R588C3352VB152.h5}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3aed71faff6cdca2cd97d0a5b5b4a99266665da17327430ec2ba2445122d4811
|
| 3 |
+
size 1643804
|
data/{M1T1R101C574VB55.h5.parquet → M3T9R589C3356VB152.h5}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5b9b858ec0bf75200f0d03c5fe0b8465f07dfcdf8f9c0af40de9cc917ecd3d5d
|
| 3 |
+
size 1633671
|
data/{M1T1R102C578VB55.h5.parquet → M3T9R590C3360VB153.h5}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1f4b9d58bd3d65fb412ec0a4413e9ae4a2013b705b4d1ec6bdf367e25d0e6fe9
|
| 3 |
+
size 1654046
|
data/{M1T1R103C582VB55.h5.parquet → M3T9R591C3364VB153.h5}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5e708af660e1f656341f021d1694709cf35b3ec7eea5195f4fd51efd49811a30
|
| 3 |
+
size 1663625
|
data/M3T9R592C3367VB153.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d0307e59f4324c01251007c3b4a9513bd189ec71862abdd5c93f64ec86181af7
|
| 3 |
+
size 1669190
|
data/M3T9R593C3371VB153.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:26ae43bff8fdd7b66209529a007d902a869a8017106461c4b8d8b5bf2bcc5a20
|
| 3 |
+
size 1670381
|
data/M3T9R594C3375VB154.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9405422f5eb754b1632d1deaa453d6d17de452f90e4814c90ed06ffcb4b74e4f
|
| 3 |
+
size 1672181
|
data/M3T9R608C3445VB159.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8da6bed4aad351689906c818ded36686aab2cf937eab42cc626e4cab0d9e1e8f
|
| 3 |
+
size 1669109
|
data/M3T9R609C3449VB160.h5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ae1beb93a4414737d699a59994115a55deec2313a23d6dfea8f39898fcb2865f
|
| 3 |
+
size 1674966
|
data/data.csv
ADDED
|
File without changes
|
milling_LUH_data.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""this is loading script for milling_LUH_data"""
|
| 2 |
+
|
| 3 |
+
import h5py
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
import datasets
|
| 7 |
+
|
| 8 |
+
_CITATION = """\
|
| 9 |
+
@InProceedings{huggingface:dataset,
|
| 10 |
+
title = {Multivariate time series data of milling processes with varying tool wear and machine tools},
|
| 11 |
+
author={Tobias Stiehl},
|
| 12 |
+
year={2023}
|
| 13 |
+
}
|
| 14 |
+
"""
|
| 15 |
+
|
| 16 |
+
_DESCRIPTION = """\
|
| 17 |
+
"""
|
| 18 |
+
|
| 19 |
+
_HOMEPAGE = "https://data.mendeley.com/datasets/zpxs87bjt8/3"
|
| 20 |
+
|
| 21 |
+
_LICENSE = "CC BY 4.0"
|
| 22 |
+
|
| 23 |
+
class milling_LUH(datasets.GeneratorBasedBuilder):
|
| 24 |
+
""" The presented dataset provides labeled, multivariate time series data of milling processes with varying tool wear and for varying machine tools. The width of the flank wear land VB of peripheral cutting edges is used as a degradation metric. A total of nine end milling cutters were worn from an unused state to end of life (VB ≈ 150 μm) in 3-axis shoulder milling of cast iron 600-3/S. The width of the flank wear land VB was frequently measured with a digital microscope at a magnification of 100x. The tools were of the same model (solid carbide end milling cutter, 4 edges, coated with TiN-TiAlN) but from different batches. Experiments were conducted on three different 5-axis milling centers of a similar size. Workpieces, experimental setups, and process parameters were identical on all of the machine tools. The process forces were recorded with a dynamometer with a sample rate of 25 kHz. The force or torque of the spindle and feed drives, as well as the position control deviation of feed drives, were recorded from the machine tool controls with a sample rate of 500 Hz. The dataset holds a total of 6,418 files labeled with the wear (VB), machine tool (M), tool (T), run (R), and cumulated tool contact time (C). The file “filelist.csv” provides an overview of all the sample files and their corresponding labels. This data could be used to identify signal features that are sensitive to tool wear, to investigate methods for tool wear estimation and tool life prediction, or to examine transfer learning strategies.
|
| 25 |
+
"""
|
| 26 |
+
|
| 27 |
+
VERSION = datasets.Version("3.0.0")
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def _info(self):
|
| 31 |
+
features = datasets.Features(
|
| 32 |
+
{
|
| 33 |
+
"cumulated_tool_contact_time":datasets.features.Value("float32"), #float64
|
| 34 |
+
"machine":datasets.features.Value("float32"),#float64
|
| 35 |
+
"run":datasets.features.Value("float32"),#float64
|
| 36 |
+
"tool":datasets.features.Value("float32"),#float64
|
| 37 |
+
"wear":datasets.features.Value("float32"),#float64
|
| 38 |
+
"position_control_deviation_axis_x":datasets.Sequence(datasets.Value("float32")), #object
|
| 39 |
+
"position_control_deviation_axis_y":datasets.Sequence(datasets.Value("float32")), #object
|
| 40 |
+
"time_machine":datasets.Sequence(datasets.Value("float32")), #object
|
| 41 |
+
"tool_position_x":datasets.Sequence(datasets.Value("float32")),#object
|
| 42 |
+
"tool_position_y":datasets.Sequence(datasets.Value("float32")), #object
|
| 43 |
+
"tool_position_z":datasets.Sequence(datasets.Value("float32")), # object
|
| 44 |
+
"torque_axis_x":datasets.Sequence(datasets.Value("float32")), #object
|
| 45 |
+
"torque_axis_y":datasets.Sequence(datasets.Value("float32")), #object
|
| 46 |
+
"torque_axis_z":datasets.Sequence(datasets.Value("float32")), #object
|
| 47 |
+
"torque_spindle":datasets.Sequence(datasets.Value("float32")), #object
|
| 48 |
+
"force_sensor_x":datasets.Sequence(datasets.Value("float32")), #object
|
| 49 |
+
"force_sensor_y":datasets.Sequence(datasets.Value("float32")), #object
|
| 50 |
+
"force_sensor_z":datasets.Sequence(datasets.Value("float32")), #object
|
| 51 |
+
"time_sensor":datasets.Sequence(datasets.Value("float32")) #object
|
| 52 |
+
}
|
| 53 |
+
)
|
| 54 |
+
|
| 55 |
+
return datasets.DatasetInfo(
|
| 56 |
+
description=_DESCRIPTION,
|
| 57 |
+
features=features, # Here we define them above because they are different between the two configurations
|
| 58 |
+
homepage=_HOMEPAGE,
|
| 59 |
+
license=_LICENSE,
|
| 60 |
+
citation=_CITATION,
|
| 61 |
+
)
|
| 62 |
+
|
| 63 |
+
def _split_generators(self, dl_manager):
|
| 64 |
+
|
| 65 |
+
# TODO change data_dir if the folder name is changed
|
| 66 |
+
files_path = "milling_LUH_data/data"
|
| 67 |
+
return [
|
| 68 |
+
datasets.SplitGenerator(
|
| 69 |
+
name=datasets.Split.TRAIN,
|
| 70 |
+
gen_kwargs= { "files_path": files_path,
|
| 71 |
+
"id_start": 0,
|
| 72 |
+
"id_end":5}
|
| 73 |
+
),
|
| 74 |
+
datasets.SplitGenerator(
|
| 75 |
+
name=datasets.Split.TEST,
|
| 76 |
+
gen_kwargs = {"files_path": files_path,
|
| 77 |
+
"id_start":5,
|
| 78 |
+
"id_end":7}
|
| 79 |
+
),
|
| 80 |
+
datasets.SplitGenerator(
|
| 81 |
+
name=datasets.Split.VALIDATION,
|
| 82 |
+
gen_kwargs = {"files_path": files_path,
|
| 83 |
+
"id_start":7,
|
| 84 |
+
"id_end":9}
|
| 85 |
+
)
|
| 86 |
+
]
|
| 87 |
+
|
| 88 |
+
def _generate_examples(self, files_path, id_start,id_end):
|
| 89 |
+
|
| 90 |
+
# list of all h5 files in files_path
|
| 91 |
+
files = [ file for file in os.listdir(files_path) if file.endswith('.h5')]
|
| 92 |
+
for key,file_name in enumerate(files[id_start:id_end]):
|
| 93 |
+
with h5py.File(files_path +"/"+file_name,'r' ) as file:
|
| 94 |
+
labels = file['labels']
|
| 95 |
+
signals_machine = file['signals_machine']
|
| 96 |
+
signals_sensor = file['signals_sensor']
|
| 97 |
+
|
| 98 |
+
labels_keys=list(labels.keys())
|
| 99 |
+
signals_machine_keys=list(signals_machine.keys())
|
| 100 |
+
signals_sensor_keys=list(signals_sensor.keys())
|
| 101 |
+
|
| 102 |
+
data={}
|
| 103 |
+
for i in labels_keys:
|
| 104 |
+
data[i] = float(labels[i][0][0])
|
| 105 |
+
for j in signals_machine_keys:
|
| 106 |
+
data[j]= signals_machine[j][:].flatten()
|
| 107 |
+
for k in signals_sensor_keys:
|
| 108 |
+
data[k]= signals_sensor[k][:].flatten()
|
| 109 |
+
|
| 110 |
+
yield key, {
|
| 111 |
+
"cumulated_tool_contact_time": data["cumulated_tool_contact_time"],
|
| 112 |
+
"machine": data["machine"],
|
| 113 |
+
"run": data["run"],
|
| 114 |
+
"tool": data["tool"],
|
| 115 |
+
"wear": data["wear"],
|
| 116 |
+
"position_control_deviation_axis_x": data["position_control_deviation_axis_x"],
|
| 117 |
+
"position_control_deviation_axis_y":data["position_control_deviation_axis_y"],
|
| 118 |
+
"time_machine": data["time_machine"],
|
| 119 |
+
"tool_position_x": data["tool_position_x"],
|
| 120 |
+
"tool_position_y": data["tool_position_y"],
|
| 121 |
+
"tool_position_z": data["tool_position_z"],
|
| 122 |
+
"force_axis_x": data["force_axis_x"],
|
| 123 |
+
"force_axis_y": data["force_axis_y"],
|
| 124 |
+
"force_axis_z": data["force_axis_z"],
|
| 125 |
+
"torque_spindle": data["torque_spindle"],
|
| 126 |
+
"force_sensor_x": data["force_sensor_x"],
|
| 127 |
+
"force_sensor_y": data["force_sensor_y"],
|
| 128 |
+
"force_sensor_z": data["force_sensor_z"],
|
| 129 |
+
"time_sensor": data["time_sensor"]
|
| 130 |
+
}
|
milling_processes_LUH__testing_propuses.py
DELETED
|
@@ -1,165 +0,0 @@
|
|
| 1 |
-
"""this is loading script for milling processes files"""
|
| 2 |
-
|
| 3 |
-
import csv
|
| 4 |
-
import json
|
| 5 |
-
import os
|
| 6 |
-
|
| 7 |
-
import datasets
|
| 8 |
-
|
| 9 |
-
# Find for instance the citation on arxiv or on the dataset repo/website
|
| 10 |
-
_CITATION = """\
|
| 11 |
-
@InProceedings{huggingface:dataset,
|
| 12 |
-
title = {Multivariate time series data of milling processes with varying tool wear and machine tools},
|
| 13 |
-
author={Tobias Stiehl},
|
| 14 |
-
year={2023}
|
| 15 |
-
}
|
| 16 |
-
"""
|
| 17 |
-
|
| 18 |
-
_DESCRIPTION = """\
|
| 19 |
-
"""
|
| 20 |
-
|
| 21 |
-
_HOMEPAGE = "https://data.mendeley.com/datasets/zpxs87bjt8/3"
|
| 22 |
-
|
| 23 |
-
_LICENSE = "CC BY 4.0"
|
| 24 |
-
|
| 25 |
-
# TODO: Add link to the official dataset URLs here
|
| 26 |
-
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
| 27 |
-
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
| 28 |
-
_URLS = {
|
| 29 |
-
"first_domain": "data"
|
| 30 |
-
|
| 31 |
-
# "first_domain": "https://huggingface.co/datasets/sameer505/milling_processes_LUH__testing_propuses/resolve/main/data"
|
| 32 |
-
}
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
class MillingProcessesLUH(datasets.GeneratorBasedBuilder):
|
| 36 |
-
"""TODO: Short description of my dataset."""
|
| 37 |
-
|
| 38 |
-
VERSION = datasets.Version("3.0.0")
|
| 39 |
-
|
| 40 |
-
# This is an example of a dataset with multiple configurations.
|
| 41 |
-
# If you don't want/need to define several sub-sets in your dataset,
|
| 42 |
-
# just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes.
|
| 43 |
-
|
| 44 |
-
# If you need to make complex sub-parts in the datasets with configurable options
|
| 45 |
-
# You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig
|
| 46 |
-
# BUILDER_CONFIG_CLASS = MyBuilderConfig
|
| 47 |
-
|
| 48 |
-
# You will be able to load one or the other configurations in the following list with
|
| 49 |
-
# data = datasets.load_dataset('my_dataset', 'first_domain')
|
| 50 |
-
# data = datasets.load_dataset('my_dataset', 'second_domain')
|
| 51 |
-
BUILDER_CONFIGS = [
|
| 52 |
-
|
| 53 |
-
]
|
| 54 |
-
|
| 55 |
-
DEFAULT_CONFIG_NAME = "first_domain" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
| 56 |
-
|
| 57 |
-
def _info(self):
|
| 58 |
-
# TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset
|
| 59 |
-
features = datasets.Features(
|
| 60 |
-
{
|
| 61 |
-
"cumulated_tool_contact_time":datasets.features.Value("float32"), #float64
|
| 62 |
-
"machine":datasets.features.Value("float32"),#float64
|
| 63 |
-
"run":datasets.features.Value("float32"),#float64
|
| 64 |
-
"tool":datasets.features.Value("float32"),#float64
|
| 65 |
-
"wear":datasets.features.Value("float32"),#float64
|
| 66 |
-
"position_control_deviation_axis_x":datasets.Sequence(datasets.Value("float32")), #object
|
| 67 |
-
"position_control_deviation_axis_y":datasets.Sequence(datasets.Value("float32")), #object
|
| 68 |
-
"time_machine":datasets.Sequence(datasets.Value("float32")), #object
|
| 69 |
-
"tool_position_x":datasets.Sequence(datasets.Value("float32")),#object
|
| 70 |
-
"tool_position_y":datasets.Sequence(datasets.Value("float32")), #object
|
| 71 |
-
"tool_position_z":datasets.Sequence(datasets.Value("float32")), # object
|
| 72 |
-
"torque_axis_x":datasets.Sequence(datasets.Value("float32")), #object
|
| 73 |
-
"torque_axis_y":datasets.Sequence(datasets.Value("float32")), #object
|
| 74 |
-
"torque_axis_z":datasets.Sequence(datasets.Value("float32")), #object
|
| 75 |
-
"torque_spindle":datasets.Sequence(datasets.Value("float32")), #object
|
| 76 |
-
"force_sensor_x":datasets.Sequence(datasets.Value("float32")), #object
|
| 77 |
-
"force_sensor_y":datasets.Sequence(datasets.Value("float32")), #object
|
| 78 |
-
"force_sensor_z":datasets.Sequence(datasets.Value("float32")), #object
|
| 79 |
-
"time_sensor":datasets.Sequence(datasets.Value("float32")) #object
|
| 80 |
-
}
|
| 81 |
-
)
|
| 82 |
-
|
| 83 |
-
return datasets.DatasetInfo(
|
| 84 |
-
# This is the description that will appear on the datasets page.
|
| 85 |
-
description=_DESCRIPTION,
|
| 86 |
-
# This defines the different columns of the dataset and their types
|
| 87 |
-
features=features, # Here we define them above because they are different between the two configurations
|
| 88 |
-
# If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
|
| 89 |
-
# specify them. They'll be used if as_supervised=True in builder.as_dataset.
|
| 90 |
-
# supervised_keys=("sentence", "label"),
|
| 91 |
-
# Homepage of the dataset for documentation
|
| 92 |
-
homepage=_HOMEPAGE,
|
| 93 |
-
# License for the dataset if available
|
| 94 |
-
license=_LICENSE,
|
| 95 |
-
# Citation for the dataset
|
| 96 |
-
citation=_CITATION,
|
| 97 |
-
)
|
| 98 |
-
|
| 99 |
-
def _split_generators(self, dl_manager):
|
| 100 |
-
# TODO fix the bug: what should urls be and how to split data correctly
|
| 101 |
-
# TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration
|
| 102 |
-
# If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name
|
| 103 |
-
|
| 104 |
-
# dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLS
|
| 105 |
-
# It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files.
|
| 106 |
-
# By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive
|
| 107 |
-
|
| 108 |
-
# urls = _URLS[self.config.name]
|
| 109 |
-
data_dir = dl_manager.download_and_extract("https://huggingface.co/datasets/sameer505/milling_processes_LUH__testing_propuses/tree/main/data")
|
| 110 |
-
return [
|
| 111 |
-
datasets.SplitGenerator(
|
| 112 |
-
name=datasets.Split.TRAIN,
|
| 113 |
-
# These kwargs will be passed to _generate_examples
|
| 114 |
-
gen_kwargs={"filepaths": [os.path.join(data_dir,i) for i in os.listdir(data_dir)[0:6]],"split": "train"
|
| 115 |
-
# "filepath": os.path.join(data_dir, "train.jsonl"),
|
| 116 |
-
# "split": "train",
|
| 117 |
-
},
|
| 118 |
-
),
|
| 119 |
-
# datasets.SplitGenerator(
|
| 120 |
-
# name=datasets.Split.VALIDATION,
|
| 121 |
-
# # These kwargs will be passed to _generate_examples
|
| 122 |
-
# gen_kwargs={"filepaths": [i for i in os.listdir(data_dir)[6:7]],"split": "validation"
|
| 123 |
-
# # "filepath": os.path.join(data_dir, "dev.jsonl"),
|
| 124 |
-
# # "split": "dev",
|
| 125 |
-
# },
|
| 126 |
-
# ),
|
| 127 |
-
# datasets.SplitGenerator(
|
| 128 |
-
# name=datasets.Split.TEST,
|
| 129 |
-
# # These kwargs will be passed to _generate_examples
|
| 130 |
-
# gen_kwargs={"filepaths": [i for i in os.listdir(data_dir)[7:]], "split": "test"
|
| 131 |
-
# # "filepath": os.path.join(data_dir, "test.jsonl"),
|
| 132 |
-
# # "split": "test"
|
| 133 |
-
# },
|
| 134 |
-
# ),
|
| 135 |
-
]
|
| 136 |
-
|
| 137 |
-
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
| 138 |
-
def _generate_examples(self, filepath, split):
|
| 139 |
-
# TODO: This method handles input defined in _split_generators to yield (key, example) tuples from the dataset.
|
| 140 |
-
# The `key` is for legacy reasons (tfds) and is not important in itself, but must be unique for each example.
|
| 141 |
-
with open(filepath, encoding="utf-8") as f:
|
| 142 |
-
for key, row in enumerate(f):
|
| 143 |
-
data = json.loads(row)
|
| 144 |
-
# Yields examples as (key, example) tuples
|
| 145 |
-
yield key, {
|
| 146 |
-
"cumulated_tool_contact_time": data["cumulated_tool_contact_time"],
|
| 147 |
-
"machine": data["machine"],
|
| 148 |
-
"run": data["run"],
|
| 149 |
-
"tool": data["tool"],
|
| 150 |
-
"wear": data["wear"],
|
| 151 |
-
"position_control_deviation_axis_x": data["position_control_deviation_axis_x"],
|
| 152 |
-
"position_control_deviation_axis_y":data["position_control_deviation_axis_y"],
|
| 153 |
-
"time_machine": data["time_machine"],
|
| 154 |
-
"tool_position_x": data["tool_position_x"],
|
| 155 |
-
"tool_position_y": data["tool_position_y"],
|
| 156 |
-
"tool_position_z": data["tool_position_z"],
|
| 157 |
-
"torque_axis_x": data["torque_axis_x"],
|
| 158 |
-
"torque_axis_y": data["torque_axis_y"],
|
| 159 |
-
"torque_axis_z": data["torque_axis_z"],
|
| 160 |
-
"torque_spindle": data["torque_spindle"],
|
| 161 |
-
"force_sensor_x": data["force_sensor_x"],
|
| 162 |
-
"force_sensor_y": data["force_sensor_y"],
|
| 163 |
-
"force_sensor_z": data["force_sensor_z"],
|
| 164 |
-
"time_sensor": data["time_sensor"]
|
| 165 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notebook.ipynb
CHANGED
|
@@ -1,5 +1,118 @@
|
|
| 1 |
{
|
| 2 |
-
"cells": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
"metadata": {
|
| 4 |
"kernelspec": {
|
| 5 |
"display_name": "base",
|
|
@@ -7,7 +120,15 @@
|
|
| 7 |
"name": "python3"
|
| 8 |
},
|
| 9 |
"language_info": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
"name": "python",
|
|
|
|
|
|
|
| 11 |
"version": "3.12.2"
|
| 12 |
}
|
| 13 |
},
|
|
|
|
| 1 |
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 1,
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"outputs": [],
|
| 8 |
+
"source": [
|
| 9 |
+
"import h5py\n",
|
| 10 |
+
"from datasets import load_dataset\n",
|
| 11 |
+
"import os"
|
| 12 |
+
]
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"cell_type": "markdown",
|
| 16 |
+
"metadata": {},
|
| 17 |
+
"source": [
|
| 18 |
+
"investigating one h5 file"
|
| 19 |
+
]
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"cell_type": "code",
|
| 23 |
+
"execution_count": 2,
|
| 24 |
+
"metadata": {},
|
| 25 |
+
"outputs": [
|
| 26 |
+
{
|
| 27 |
+
"data": {
|
| 28 |
+
"text/plain": [
|
| 29 |
+
"<KeysViewHDF5 ['labels', 'signals_machine', 'signals_sensor']>"
|
| 30 |
+
]
|
| 31 |
+
},
|
| 32 |
+
"execution_count": 2,
|
| 33 |
+
"metadata": {},
|
| 34 |
+
"output_type": "execute_result"
|
| 35 |
+
}
|
| 36 |
+
],
|
| 37 |
+
"source": [
|
| 38 |
+
"h5_file = h5py.File(\"data/M3T9R588C3352VB152.h5\",'r' )\n",
|
| 39 |
+
"h5_file.keys()"
|
| 40 |
+
]
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"cell_type": "markdown",
|
| 44 |
+
"metadata": {},
|
| 45 |
+
"source": [
|
| 46 |
+
"showing all data labels"
|
| 47 |
+
]
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"cell_type": "code",
|
| 51 |
+
"execution_count": 3,
|
| 52 |
+
"metadata": {},
|
| 53 |
+
"outputs": [
|
| 54 |
+
{
|
| 55 |
+
"name": "stdout",
|
| 56 |
+
"output_type": "stream",
|
| 57 |
+
"text": [
|
| 58 |
+
"labels:\t\t<KeysViewHDF5 ['cumulated_tool_contact_time', 'machine', 'run', 'tool', 'wear']>\n",
|
| 59 |
+
"signals_machine: \t<KeysViewHDF5 ['force_axis_x', 'force_axis_y', 'force_axis_z', 'position_control_deviation_axis_x', 'position_control_deviation_axis_y', 'time_machine', 'tool_position_x', 'tool_position_y', 'tool_position_z', 'torque_spindle']>\n",
|
| 60 |
+
"signals_sensor: \t<KeysViewHDF5 ['force_sensor_x', 'force_sensor_y', 'force_sensor_z', 'time_sensor']>\n"
|
| 61 |
+
]
|
| 62 |
+
}
|
| 63 |
+
],
|
| 64 |
+
"source": [
|
| 65 |
+
"labels = h5_file['labels']\t\n",
|
| 66 |
+
"signals_machine = h5_file['signals_machine']\n",
|
| 67 |
+
"signals_sensor = h5_file['signals_sensor']\n",
|
| 68 |
+
"\n",
|
| 69 |
+
"print(f\"labels:\t\\t{labels.keys()}\")\n",
|
| 70 |
+
"print(f\"signals_machine: \\t{signals_machine.keys()}\")\n",
|
| 71 |
+
"print(f\"signals_sensor: \\t{signals_sensor.keys()}\")"
|
| 72 |
+
]
|
| 73 |
+
},
|
| 74 |
+
{
|
| 75 |
+
"cell_type": "markdown",
|
| 76 |
+
"metadata": {},
|
| 77 |
+
"source": [
|
| 78 |
+
"loading data using the python script"
|
| 79 |
+
]
|
| 80 |
+
},
|
| 81 |
+
{
|
| 82 |
+
"cell_type": "code",
|
| 83 |
+
"execution_count": 5,
|
| 84 |
+
"metadata": {},
|
| 85 |
+
"outputs": [
|
| 86 |
+
{
|
| 87 |
+
"data": {
|
| 88 |
+
"text/plain": [
|
| 89 |
+
"DatasetDict({\n",
|
| 90 |
+
" train: Dataset({\n",
|
| 91 |
+
" features: ['cumulated_tool_contact_time', 'machine', 'run', 'tool', 'wear', 'position_control_deviation_axis_x', 'position_control_deviation_axis_y', 'time_machine', 'tool_position_x', 'tool_position_y', 'tool_position_z', 'torque_axis_x', 'torque_axis_y', 'torque_axis_z', 'torque_spindle', 'force_sensor_x', 'force_sensor_y', 'force_sensor_z', 'time_sensor'],\n",
|
| 92 |
+
" num_rows: 5\n",
|
| 93 |
+
" })\n",
|
| 94 |
+
" test: Dataset({\n",
|
| 95 |
+
" features: ['cumulated_tool_contact_time', 'machine', 'run', 'tool', 'wear', 'position_control_deviation_axis_x', 'position_control_deviation_axis_y', 'time_machine', 'tool_position_x', 'tool_position_y', 'tool_position_z', 'torque_axis_x', 'torque_axis_y', 'torque_axis_z', 'torque_spindle', 'force_sensor_x', 'force_sensor_y', 'force_sensor_z', 'time_sensor'],\n",
|
| 96 |
+
" num_rows: 2\n",
|
| 97 |
+
" })\n",
|
| 98 |
+
" validation: Dataset({\n",
|
| 99 |
+
" features: ['cumulated_tool_contact_time', 'machine', 'run', 'tool', 'wear', 'position_control_deviation_axis_x', 'position_control_deviation_axis_y', 'time_machine', 'tool_position_x', 'tool_position_y', 'tool_position_z', 'torque_axis_x', 'torque_axis_y', 'torque_axis_z', 'torque_spindle', 'force_sensor_x', 'force_sensor_y', 'force_sensor_z', 'time_sensor'],\n",
|
| 100 |
+
" num_rows: 2\n",
|
| 101 |
+
" })\n",
|
| 102 |
+
"})"
|
| 103 |
+
]
|
| 104 |
+
},
|
| 105 |
+
"execution_count": 5,
|
| 106 |
+
"metadata": {},
|
| 107 |
+
"output_type": "execute_result"
|
| 108 |
+
}
|
| 109 |
+
],
|
| 110 |
+
"source": [
|
| 111 |
+
"dataset = load_dataset(\"milling_LUH_data.py\", trust_remote_code=True)\n",
|
| 112 |
+
"dataset"
|
| 113 |
+
]
|
| 114 |
+
}
|
| 115 |
+
],
|
| 116 |
"metadata": {
|
| 117 |
"kernelspec": {
|
| 118 |
"display_name": "base",
|
|
|
|
| 120 |
"name": "python3"
|
| 121 |
},
|
| 122 |
"language_info": {
|
| 123 |
+
"codemirror_mode": {
|
| 124 |
+
"name": "ipython",
|
| 125 |
+
"version": 3
|
| 126 |
+
},
|
| 127 |
+
"file_extension": ".py",
|
| 128 |
+
"mimetype": "text/x-python",
|
| 129 |
"name": "python",
|
| 130 |
+
"nbconvert_exporter": "python",
|
| 131 |
+
"pygments_lexer": "ipython3",
|
| 132 |
"version": "3.12.2"
|
| 133 |
}
|
| 134 |
},
|