Skip to content

Commit 3b506f6

Browse files
committed
Format Python code
1 parent b1ed6d3 commit 3b506f6

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

hdc/datasets/ccpp.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
from .utils import download_file, unzip_file
1010

11+
1112
class CyclePowerPlant(data.Dataset):
1213
"""Combined cycle power planet dataset <https://archive.ics.uci.edu/ml/datasets/combined+cycle+power+plant>`_,
1314
Features consist of hourly average ambient variables Temperature (T), Ambient Pressure (AP), Relative Humidity (RH) and Exhaust Vacuum (V) to predict the net hourly electrical energy output (EP) of the plant.
@@ -22,9 +23,10 @@ class CyclePowerPlant(data.Dataset):
2223
target_transform (callable, optional): A function/transform that takes in the
2324
target and transforms it.
2425
"""
26+
2527
def __init__(
26-
self,
27-
root:str,
28+
self,
29+
root: str,
2830
download: bool = False,
2931
transform: Optional[Callable] = None,
3032
target_transform: Optional[Callable] = None,
@@ -72,31 +74,31 @@ def __getitem__(self, index: int) -> Tuple[torch.FloatTensor, torch.FloatTensor]
7274
def _check_integrity(self) -> bool:
7375
if not os.path.isdir(self.root):
7476
return False
75-
77+
7678
# Check if root directory contains the required data file
7779
has_data_file = os.path.isfile(os.path.join(self.root, "Folds5x2_pp.xlsx"))
7880
if has_data_file:
7981
return True
80-
82+
8183
return False
8284

8385
def _load_data(self):
8486
file_name = "Folds5x2_pp.xlsx"
8587
data = pd.read_excel(os.path.join(self.root, file_name))
8688
self.data = torch.tensor(data.values[:, :-1], dtype=torch.float)
8789
self.targets = torch.tensor(data.values[:, -1], dtype=torch.float)
88-
90+
8991
def download(self):
9092
"""Downloads the dataset if not already present"""
9193

9294
if self._check_integrity():
9395
print("Files already downloaded and verified")
9496
return
95-
97+
9698
zip_file_path = os.path.join(self.root, "data.zip")
9799
download_file(
98-
"https://archive.ics.uci.edu/ml/machine-learning-databases/00294/CCPP.zip",
99-
zip_file_path
100+
"https://archive.ics.uci.edu/ml/machine-learning-databases/00294/CCPP.zip",
101+
zip_file_path,
100102
)
101103

102104
unzip_file(zip_file_path, self.root)

0 commit comments

Comments
 (0)