Skip to content

Commit

Permalink
Add script to download datasets and moa.jar
Browse files Browse the repository at this point in the history
  • Loading branch information
nuwangunasekara committed Oct 20, 2023
1 parent cbfe596 commit c599ebb
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
33 changes: 33 additions & 0 deletions download_datasets_and_moa.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import os.path
import gdown
import zipfile

z_files = {
# 'electricity': ['https://drive.google.com/file/d/1ilTSg8aL3Ur4jYmlDhK4RprVRCzxEjwL/view?usp=share_link', 'zip'],
# 'covtFD': ['https://drive.google.com/file/d/13MiPqDzuKzv1RvhAqKFCTmCKav3C6s5P/view?usp=share_link', 'zip'],
# 'covtype': ['https://drive.google.com/file/d/15kfa2rdnQgwoFVr5MG5hyjqLDNY_v94L/view?usp=share_link', 'zip'],
# 'Hyper100k': ['https://drive.google.com/file/d/1tjcKD8kzNfv5RBi7cTymCjoIBFD0ItZV/view?usp=share_link', 'zip'],
# 'RBFm_100k': ['https://drive.google.com/file/d/1sd53lVQg5txMwURR4u2YBGYEg4EbKM8a/view?usp=share_link', 'zip'],
# 'RTG_2abrupt': ['https://drive.google.com/file/d/1YJRwEI04lLF7LQqeEx52o1Q3lE6p85xr/view?usp=share_link', 'zip'],
# 'sensor': ['https://drive.google.com/file/d/11AZ92fWT8vDRoX6TOaAQgzcisHKbR9FW/view?usp=share_link', 'zip'],
# 'moa': ['https://drive.google.com/file/d/1W4CR_QmrdGb8qFqmhP9UXSTh3k5azIv9/view?usp=share_link', 'jar'],
}

for name, file_info in z_files.items():
out_file_name = name + '.' + file_info[1]
url = file_info[0]
print(f'Downloading {out_file_name} from : {url}')
gdown.download(url, out_file_name, quiet=False, fuzzy=True)
print(f'downloaded file name: {out_file_name}')
if file_info[1].__eq__('zip'):
with zipfile.ZipFile(out_file_name, 'r') as archive:
for archive_file in archive.namelist():
if archive_file.find('/' + name + '.csv') or archive_file.find('/' + name + '.arff'):
print(f'unzip: {archive_file} to ./data/')
archive.extract(archive_file, './data/')
print(f'remove downloaded zip file: {out_file_name}')
os.remove(out_file_name)
elif file_info[1].__eq__('jar'):
os.rename(out_file_name, 'jar/' + out_file_name)

os.rmdir('./data/__MACOSX')
3 changes: 0 additions & 3 deletions prepare_jpype.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ def start_jpype():
moa_jar_path = config['Paths']['moa_jar_path']
jvm_args = config['JVM']['args'].split(' ')

if (not moa_jar_path.__eq__('')) and os.path.dirname(moa_jar_path).__eq__(''): # moa jar is available in source root
moa_jar_path = os.path.join(os.getcwd(), moa_jar_path)

# Add the moa jar to the class path
jpype.addClassPath(moa_jar_path)

Expand Down

0 comments on commit c599ebb

Please sign in to comment.