
import os
import urllib.request


DATASET_URL = 'http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary/diabetes'
TARGET_PATH = os.path.dirname(os.path.realpath(__file__)) + '/dataset.txt'


def main():
    urllib.request.urlretrieve(DATASET_URL, TARGET_PATH)


if __name__ == '__main__': main()


import os
import urllib.request
import random


DATASET_URL = 'http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/multiclass/letter.scale'
DATASET_SIZE = 1000
TARGET_PATH = os.path.dirname(os.path.realpath(__file__)) + '/dataset.txt'


def main():
    rows = list(urllib.request.urlopen(DATASET_URL))
    selected = random.sample(rows, DATASET_SIZE)
    with open(TARGET_PATH, 'wb') as f:
        for row in selected:
            f.write(row)


if __name__ == '__main__': main()

Change dataset used in example (letter)
Change dataset used in example (letter)

XXX: UncertaintySampling(le) weird?

  
  import os
  import urllib.request
+ import random
  
  
- DATASET_URL = 'http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary/diabetes'
+ DATASET_URL = 'http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/multiclass/letter.scale'
+ DATASET_SIZE = 1000
  TARGET_PATH = os.path.dirname(os.path.realpath(__file__)) + '/dataset.txt'
  
  
  def main():
-     urllib.request.urlretrieve(DATASET_URL, TARGET_PATH)
+     rows = list(urllib.request.urlopen(DATASET_URL))
+     selected = random.sample(rows, DATASET_SIZE)
+     with open(TARGET_PATH, 'wb') as f:
+         for row in selected:
+             f.write(row)
  
  
  if __name__ == '__main__': main()
  
Change dataset used in example (letter)
## Code Before:

import os
import urllib.request


DATASET_URL = 'http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/binary/diabetes'
TARGET_PATH = os.path.dirname(os.path.realpath(__file__)) + '/dataset.txt'


def main():
    urllib.request.urlretrieve(DATASET_URL, TARGET_PATH)


if __name__ == '__main__': main()

## Instruction:
Change dataset used in example (letter)
## Code After:

import os
import urllib.request
import random


DATASET_URL = 'http://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/multiclass/letter.scale'
DATASET_SIZE = 1000
TARGET_PATH = os.path.dirname(os.path.realpath(__file__)) + '/dataset.txt'


def main():
    rows = list(urllib.request.urlopen(DATASET_URL))
    selected = random.sample(rows, DATASET_SIZE)
    with open(TARGET_PATH, 'wb') as f:
        for row in selected:
            f.write(row)


if __name__ == '__main__': main()
