init commit: загрузка и предобработка данных

This commit is contained in:
xausssr
2024-05-11 12:29:10 +03:00
commit 0a55543ae2
22 changed files with 1986 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
import numpy as np
import torch
class TableDataset(torch.utils.data.Dataset):
def __init__(self, x: np.ndarray, y: np.ndarray) -> None:
"""Простой датасет из объектов numpy
Args:
x (np.ndarray): обучающие объекты
y (np.ndarray): метки
"""
super().__init__()
self.map_labels = None
self.x = x
self.y = y
def __len__(self):
return len(self.x)
def __getitem__(self, idx) -> tuple[torch.Tensor, torch.Tensor]:
return torch.FloatTensor(self.x[idx]), torch.FloatTensor(self.y[idx])