Skip to content

Commit e62790c

Browse files
committed
Pushing the docs to _pst_preview/ for branch: new_web_theme, commit 19196ca625ed40aaa370fa75058e18ae77f01cce
1 parent e86b0f3 commit e62790c

File tree

1,279 files changed

+7589
-7087
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,279 files changed

+7589
-7087
lines changed

_pst_preview/.buildinfo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 6e039326ae97414d0046aae34cf6dd1e
3+
config: 18d37eb98ca80365ed9983fc53edb534
44
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file not shown.
Binary file not shown.

_pst_preview/_downloads/c08598f3ffe66017f7cad294026ee0b9/plot_out_of_core_classification.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
"outputs": [],
3535
"source": [
36-
"class ReutersParser(HTMLParser):\n \"\"\"Utility class to parse a SGML file and yield documents one at a time.\"\"\"\n\n def __init__(self, encoding=\"latin-1\"):\n HTMLParser.__init__(self)\n self._reset()\n self.encoding = encoding\n\n def handle_starttag(self, tag, attrs):\n method = \"start_\" + tag\n getattr(self, method, lambda x: None)(attrs)\n\n def handle_endtag(self, tag):\n method = \"end_\" + tag\n getattr(self, method, lambda: None)()\n\n def _reset(self):\n self.in_title = 0\n self.in_body = 0\n self.in_topics = 0\n self.in_topic_d = 0\n self.title = \"\"\n self.body = \"\"\n self.topics = []\n self.topic_d = \"\"\n\n def parse(self, fd):\n self.docs = []\n for chunk in fd:\n self.feed(chunk.decode(self.encoding))\n for doc in self.docs:\n yield doc\n self.docs = []\n self.close()\n\n def handle_data(self, data):\n if self.in_body:\n self.body += data\n elif self.in_title:\n self.title += data\n elif self.in_topic_d:\n self.topic_d += data\n\n def start_reuters(self, attributes):\n pass\n\n def end_reuters(self):\n self.body = re.sub(r\"\\s+\", r\" \", self.body)\n self.docs.append(\n {\"title\": self.title, \"body\": self.body, \"topics\": self.topics}\n )\n self._reset()\n\n def start_title(self, attributes):\n self.in_title = 1\n\n def end_title(self):\n self.in_title = 0\n\n def start_body(self, attributes):\n self.in_body = 1\n\n def end_body(self):\n self.in_body = 0\n\n def start_topics(self, attributes):\n self.in_topics = 1\n\n def end_topics(self):\n self.in_topics = 0\n\n def start_d(self, attributes):\n self.in_topic_d = 1\n\n def end_d(self):\n self.in_topic_d = 0\n self.topics.append(self.topic_d)\n self.topic_d = \"\"\n\n\ndef stream_reuters_documents(data_path=None):\n \"\"\"Iterate over documents of the Reuters dataset.\n\n The Reuters archive will automatically be downloaded and uncompressed if\n the `data_path` directory does not exist.\n\n Documents are represented as dictionaries with 'body' (str),\n 'title' (str), 'topics' (list(str)) keys.\n\n \"\"\"\n\n DOWNLOAD_URL = (\n \"http://archive.ics.uci.edu/ml/machine-learning-databases/\"\n \"reuters21578-mld/reuters21578.tar.gz\"\n )\n ARCHIVE_SHA256 = \"3bae43c9b14e387f76a61b6d82bf98a4fb5d3ef99ef7e7075ff2ccbcf59f9d30\"\n ARCHIVE_FILENAME = \"reuters21578.tar.gz\"\n\n if data_path is None:\n data_path = Path(get_data_home()) / \"reuters\"\n else:\n data_path = Path(data_path)\n if not data_path.exists():\n \"\"\"Download the dataset.\"\"\"\n print(\"downloading dataset (once and for all) into %s\" % data_path)\n data_path.mkdir(parents=True, exist_ok=True)\n\n def progress(blocknum, bs, size):\n total_sz_mb = \"%.2f MB\" % (size / 1e6)\n current_sz_mb = \"%.2f MB\" % ((blocknum * bs) / 1e6)\n if _not_in_sphinx():\n sys.stdout.write(\"\\rdownloaded %s / %s\" % (current_sz_mb, total_sz_mb))\n\n archive_path = data_path / ARCHIVE_FILENAME\n\n urlretrieve(DOWNLOAD_URL, filename=archive_path, reporthook=progress)\n if _not_in_sphinx():\n sys.stdout.write(\"\\r\")\n\n # Check that the archive was not tampered:\n assert sha256(archive_path.read_bytes()).hexdigest() == ARCHIVE_SHA256\n\n print(\"untarring Reuters dataset...\")\n tarfile.open(archive_path, \"r:gz\").extractall(data_path)\n print(\"done.\")\n\n parser = ReutersParser()\n for filename in data_path.glob(\"*.sgm\"):\n for doc in parser.parse(open(filename, \"rb\")):\n yield doc"
36+
"class ReutersParser(HTMLParser):\n \"\"\"Utility class to parse a SGML file and yield documents one at a time.\"\"\"\n\n def __init__(self, encoding=\"latin-1\"):\n HTMLParser.__init__(self)\n self._reset()\n self.encoding = encoding\n\n def handle_starttag(self, tag, attrs):\n method = \"start_\" + tag\n getattr(self, method, lambda x: None)(attrs)\n\n def handle_endtag(self, tag):\n method = \"end_\" + tag\n getattr(self, method, lambda: None)()\n\n def _reset(self):\n self.in_title = 0\n self.in_body = 0\n self.in_topics = 0\n self.in_topic_d = 0\n self.title = \"\"\n self.body = \"\"\n self.topics = []\n self.topic_d = \"\"\n\n def parse(self, fd):\n self.docs = []\n for chunk in fd:\n self.feed(chunk.decode(self.encoding))\n for doc in self.docs:\n yield doc\n self.docs = []\n self.close()\n\n def handle_data(self, data):\n if self.in_body:\n self.body += data\n elif self.in_title:\n self.title += data\n elif self.in_topic_d:\n self.topic_d += data\n\n def start_reuters(self, attributes):\n pass\n\n def end_reuters(self):\n self.body = re.sub(r\"\\s+\", r\" \", self.body)\n self.docs.append(\n {\"title\": self.title, \"body\": self.body, \"topics\": self.topics}\n )\n self._reset()\n\n def start_title(self, attributes):\n self.in_title = 1\n\n def end_title(self):\n self.in_title = 0\n\n def start_body(self, attributes):\n self.in_body = 1\n\n def end_body(self):\n self.in_body = 0\n\n def start_topics(self, attributes):\n self.in_topics = 1\n\n def end_topics(self):\n self.in_topics = 0\n\n def start_d(self, attributes):\n self.in_topic_d = 1\n\n def end_d(self):\n self.in_topic_d = 0\n self.topics.append(self.topic_d)\n self.topic_d = \"\"\n\n\ndef stream_reuters_documents(data_path=None):\n \"\"\"Iterate over documents of the Reuters dataset.\n\n The Reuters archive will automatically be downloaded and uncompressed if\n the `data_path` directory does not exist.\n\n Documents are represented as dictionaries with 'body' (str),\n 'title' (str), 'topics' (list(str)) keys.\n\n \"\"\"\n\n DOWNLOAD_URL = (\n \"http://archive.ics.uci.edu/ml/machine-learning-databases/\"\n \"reuters21578-mld/reuters21578.tar.gz\"\n )\n ARCHIVE_SHA256 = \"3bae43c9b14e387f76a61b6d82bf98a4fb5d3ef99ef7e7075ff2ccbcf59f9d30\"\n ARCHIVE_FILENAME = \"reuters21578.tar.gz\"\n\n if data_path is None:\n data_path = Path(get_data_home()) / \"reuters\"\n else:\n data_path = Path(data_path)\n if not data_path.exists():\n \"\"\"Download the dataset.\"\"\"\n print(\"downloading dataset (once and for all) into %s\" % data_path)\n data_path.mkdir(parents=True, exist_ok=True)\n\n def progress(blocknum, bs, size):\n total_sz_mb = \"%.2f MB\" % (size / 1e6)\n current_sz_mb = \"%.2f MB\" % ((blocknum * bs) / 1e6)\n if _not_in_sphinx():\n sys.stdout.write(\"\\rdownloaded %s / %s\" % (current_sz_mb, total_sz_mb))\n\n archive_path = data_path / ARCHIVE_FILENAME\n\n urlretrieve(DOWNLOAD_URL, filename=archive_path, reporthook=progress)\n if _not_in_sphinx():\n sys.stdout.write(\"\\r\")\n\n # Check that the archive was not tampered:\n assert sha256(archive_path.read_bytes()).hexdigest() == ARCHIVE_SHA256\n\n print(\"untarring Reuters dataset...\")\n with tarfile.open(archive_path, \"r:gz\") as fp:\n fp.extractall(data_path, filter=\"data\")\n print(\"done.\")\n\n parser = ReutersParser()\n for filename in data_path.glob(\"*.sgm\"):\n for doc in parser.parse(open(filename, \"rb\")):\n yield doc"
3737
]
3838
},
3939
{

_pst_preview/_downloads/f7c999465d2f8d68e0c04bec778aa48e/plot_out_of_core_classification.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ def progress(blocknum, bs, size):
175175
assert sha256(archive_path.read_bytes()).hexdigest() == ARCHIVE_SHA256
176176

177177
print("untarring Reuters dataset...")
178-
tarfile.open(archive_path, "r:gz").extractall(data_path)
178+
with tarfile.open(archive_path, "r:gz") as fp:
179+
fp.extractall(data_path, filter="data")
179180
print("done.")
180181

181182
parser = ReutersParser()

_pst_preview/_images/probabl.png

19.7 KB
-342 Bytes
-227 Bytes
-74 Bytes
-371 Bytes

0 commit comments

Comments
 (0)