Skip to content

Commit

Permalink
Add CovtypeTiny and fix bug in downloader
Browse files Browse the repository at this point in the history
  • Loading branch information
tachyonicClock committed Feb 1, 2024
1 parent 1fd291a commit c17bf43
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/capymoa/datasets/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ class ElectricityTiny(DownloadARFFGzip):

filename = "electricity_tiny.arff"
remote_url = ROOT_URL

class CovtypeTiny(DownloadARFFGzip):
"""A truncated version of the Covtype dataset with 1000 instances."""

filename = "covtype_n1000.arff"
remote_url = ROOT_URL
5 changes: 4 additions & 1 deletion src/capymoa/datasets/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any, Optional
import shutil

import wget
from moa.streams import ArffFileStream
Expand Down Expand Up @@ -45,7 +46,9 @@ def _resolve_dataset(self, auto_download: bool, directory: Path):
working_directory = Path(working_directory)
stream_archive = self.download(working_directory)
tmp_stream = self.extract(stream_archive)
stream = tmp_stream.rename(stream)
# Note shutil.move is needed to move the file across
# physical devices and filesystems
stream = shutil.move(tmp_stream, stream)
else:
raise FileNotFoundError(
f"Dataset {self.filename} not found in {directory}"
Expand Down

0 comments on commit c17bf43

Please sign in to comment.