提交 936d73e2 编写于 作者: W wizardforcel

2021-02-20 21:37:51

上级 0e753bd2
......@@ -126,9 +126,7 @@ Pixiedust version 1.1.10
### 注意
**注意** :可以在以下位置找到有关 Kubernetes 容器的其他入门文章:
[https://console.bluemix.net/docs/containers/container_index.html#container_index](https://console.bluemix.net/docs/containers/container_index.html#container_index)
[**注意** :可以在以下位置找到有关 Kubernetes 容器的其他入门文章](https://console.bluemix.net/docs/containers/container_index.html#container_index)。
3. 登录到 IBM Cloud,然后定位 Kubernetes 实例所在的组织和空间。 安装并初始化`container-service`插件:
......@@ -165,9 +163,7 @@ Pixiedust version 1.1.10
### 注意
**注意**:YAML 是一种非常流行的数据序列化格式,通常用于系统配置。 您可以在这里找到更多信息:
[http://www.yaml.org/start.html](http://www.yaml.org/start.html)
[**注意**:YAML 是一种非常流行的数据序列化格式,通常用于系统配置。 您可以在这里找到更多信息](http://www.yaml.org/start.html)。
6. 现在,您可以使用`kubectl`为您的 PixieGateway 服务器创建部署和服务。 为了方便起见,PixieGateway GitHub 存储库已经具有`deployment.yml``service.yml`的通用版本,您可以直接参考。 我们将在本章稍后的 *PixieGateway 服务器配置*部分中介绍如何为 Kubernetes 配置这些文件:
......
......@@ -1239,9 +1239,7 @@ with open(os.path.join(image_dir, "retrained_label.txt"), "w") as f_label:
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%206/sampleCode26.py](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%206/sampleCode26.py)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%206/sampleCode26.py)。
2. Create the bottleneck values (caching them as appropriate) that normalize the image by resizing and rescaling it. This is done in the following code:
......@@ -1262,9 +1260,7 @@ with open(os.path.join(image_dir, "retrained_label.txt"), "w") as f_label:
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%206/sampleCode27.py](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%206/sampleCode27.py)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%206/sampleCode27.py)。
3. 在公共名称空间下,使用`add_final_training_ops`方法添加最终的训练操作,以便在可视化图形时更易于操作。 训练步骤如下:
......
......@@ -304,9 +304,7 @@ class RawTweetsListener(StreamListener):
### 注意
您可以在此处找到的文件文件:
[https:// github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%207/sampleCode2.py](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%207/sampleCode2.py)
[您可以在此处找到的文件文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%207/sampleCode2.py)。
* The CSV files are written in `output_dir` which is defined in its own variable. At start time, we first remove the directory and its contents:
......@@ -327,9 +325,7 @@ class RawTweetsListener(StreamListener):
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%207/sampleCode3.py](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%207/sampleCode3.py)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%207/sampleCode3.py)。
* `field_metadata`包含 Spark 数据类型,我们稍后将在创建 Spark 流查询时使用它来构建架构。
* `field_metadata`还包含一个可选的变换`lambda`函数,用于在将值写入磁盘之前清除该值。 作为参考,Python 中的 lambda 函数是内联定义的匿名函数(请参见 [https://docs.python.org/3/tutorial/controlflow.html#lambda-expressions](https://docs.python.org/3/tutorial/controlflow.html#lambda-expressions) )。 我们将其用于通常作为 HTML 片段返回的源字段。 在此 lambda 函数中,我们使用 BeautifulSoup 库(在上一章中也使用过)仅提取文本,如以下代码片段所示:
......@@ -636,9 +632,7 @@ id: b621e268-f21d-4eef-b6cd-cb0bc66e53c4
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%207/sampleCode10.py](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%207/sampleCode10.py)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%207/sampleCode10.py)。
这种方法的好处是,我们可以使用任何 ANSI SQL 查询来加载数据,而不是使用在第一种方法中必须使用的等效低级 DataFrame API。
......
......@@ -145,9 +145,7 @@ statsmodels.tsa.tests.test_stattools.TestACF_FFT
### 注意
您可以在`np.random`模块上找到更多信息:
[https://docs.scipy.org/doc/numpy-1.14.0/reference/routines.random.html](https://docs.scipy.org/doc/numpy-1.14.0/reference/routines.random.html)
[ 您可以在`np.random`模块上找到更多信息](https://docs.scipy.org/doc/numpy-1.14.0/reference/routines.random.html)。
* `np.arange`: Return an ndarray with evenly spaced values within a given interval.
......@@ -199,9 +197,7 @@ statsmodels.tsa.tests.test_stattools.TestACF_FFT
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%208/sampleCode2.py](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%208/sampleCode2.py)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%208/sampleCode2.py)。
结果如下:
......@@ -257,9 +253,7 @@ statsmodels.tsa.tests.test_stattools.TestACF_FFT
结果: `array([ 0, 1, 4, 9, 16, 25, 36, 49, 64, 81])`
您可以在此处找到有关 NumPy 数学函数的更多信息:
[https://docs.scipy.org/doc/numpy/reference/routines.math.html](https://docs.scipy.org/doc/numpy/reference/routines.math.html)
[您可以在此处找到有关 NumPy 数学函数的更多信息](https://docs.scipy.org/doc/numpy/reference/routines.math.html)。
* **统计函数**
......
......@@ -108,9 +108,7 @@
### 注意
**注意**:有关集中性的更多信息,请参见:
[https://zh.wikipedia.org/wiki/中央](https://en.wikipedia.org/wiki/Centrality)
[ **注意**:有关集中性的更多信息,请参见](https://en.wikipedia.org/wiki/Centrality)。
## 图形和大数据
......
......@@ -60,7 +60,8 @@ Drew 的数据科学 Conway Venn 图现在包括开发人员
* [*时间序列分析-PyCon 2017* , *Aileen Nielsen* ](https://www.youtube.com/watch?v=zmfe2RaX-14)
* [Quandl Python 文档](https://docs.quandl.com/docs/python)
* [Statsmodels 文档](https://www.statsmodels.org/stable/index.html)
* [NetworkX](https://networkx.github.io/documentation/networkx-2.1/index.html) GeoJSON 规范: [http://geojson.org/](http://geojson.org/)
* [NetworkX](https://networkx.github.io/documentation/networkx-2.1/index.html)
* [GeoJSON 规范](http://geojson.org/)
* [*Beautiful Soup 文档*](https://www.crummy.com/software/BeautifulSoup/bs4/doc)
# 附录 A.PixieApp 快速参考
......@@ -112,9 +113,7 @@ Drew 的数据科学 Conway Venn 图现在包括开发人员
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode25.py](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode25.py)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode25.py)。
* `@templateArgs`: Annotation that enables any local variable to be used within the Jinja2 template. Note that `@templateArgs` cannot be used in combination with `@captureOutput`:
......@@ -135,9 +134,7 @@ Drew 的数据科学 Conway Venn 图现在包括开发人员
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode26.py](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode26.py)
[您可以在此处找到代码文件](https://github.com/DTAIEB/T4houghtful-Data-Science/blob/master/chapter%205/sampleCode26.py)。
* `@captureOutput`: Annotation that changes the contract with the route method, so that it doesn’t have to return an HTML fragment anymore. Instead, the method body can simply output the results as it would in a Notebook cell. The framework will capture the output and return it as HTML. Note that you cannot use Jinja2 template in this case.
......@@ -159,9 +156,7 @@ Drew 的数据科学 Conway Venn 图现在包括开发人员
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode27.py](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode27.py)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode27.py)。
* `@Logger`: Add logging capabilities by adding logging methods to the class: `debug`, `warn`, `info`, `error`, `critical`, `exception`.
......@@ -183,15 +178,11 @@ Drew 的数据科学 Conway Venn 图现在包括开发人员
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode28.py](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode28.py)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode28.py)。
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode28.py](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode28.py)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode28.py)。
# 自定义 HTML 属性
......@@ -221,9 +212,7 @@ Drew 的数据科学 Conway Venn 图现在包括开发人员
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode29.html](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode29.html)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode29.html)。
以`pd_options`作为 HTML 属性的示例:
......@@ -236,9 +225,7 @@ Drew 的数据科学 Conway Venn 图现在包括开发人员
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode30.html](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode30.html)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode30.html)。
* `pd_entity`:仅用于在特定数据上调用`display()` API。 必须与`pd_options`结合使用,其中键值对将用作`display()`的参数。 如果未为`pd_entity`属性指定任何值,则假定该实体为传递给启动 PixieApp 的`run`方法的实体。 `pd_entity`值可以是在 Notebook 中定义的变量或 PixieApp 的字段(例如`pd_entity=”df”`),也可以是使用点表示法的对象的字段(例如`pd_entity=”obj_instance.df”`)。
* `pd_target`: By default, the output of a kernel request is injected in the overall output cell or dialog (if you use `runInDialog=”true”` as an argument to the `run` method). However, you can use `pd_target=”elementId”` to specify a target element that will receive the output. (Note that the `elementId` must exist in the current view.)
......@@ -255,9 +242,7 @@ Drew 的数据科学 Conway Venn 图现在包括开发人员
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode31.html](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode31.html)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode31.html)。
* `pd_script`: This invokes arbitrary Python code as part of the kernel request. This can be used in combination with other attributes like `pd_entity` and `pd_options`. It’s important to note that the Python indentation rules ([https://docs.python.org/2.0/ref/indentation.html](https://docs.python.org/2.0/ref/indentation.html)) must be respected to avoid a runtime error.
......@@ -280,9 +265,7 @@ Drew 的数据科学 Conway Venn 图现在包括开发人员
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode32.html](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode32.html)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode32.html)。
* `pd_app`: This dynamically invokes a separate PixieApp by its fully qualified class name. The `pd_options` attribute can be used to pass route arguments to invoke a specific route of the PixieApp.
......@@ -297,9 +280,7 @@ Drew 的数据科学 Conway Venn 图现在包括开发人员
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode33.html](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode33.html)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode33.html)。
* `pd_render_onload`: This should be used to trigger a kernel request upon loading, as opposed to when a user clicks on an element or when a change event occurs. The `pd_render_onload` attribute can be combined with any other attribute that defines the request, like `pd_options` or `pd_script`. Note that this attribute should only be used with a div element.
......@@ -315,9 +296,7 @@ Drew 的数据科学 Conway Venn 图现在包括开发人员
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode34.html](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode34.html)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode34.html)。
* `pd_refresh`: This is used to force the HTML element to execute a kernel request even if no event (click or change event) has occurred. If no value is specified, then the current element is refreshed, otherwise, the element with the ID specified in the value will be refreshed.
......@@ -334,9 +313,7 @@ Drew 的数据科学 Conway Venn 图现在包括开发人员
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode35.html](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode35.html)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode35.html)。
* `pd_event_payload`: This emits a PixieApp event with the specified payload content. This attribute follows the same rules as `pd_options`:
......@@ -364,9 +341,7 @@ Drew 的数据科学 Conway Venn 图现在包括开发人员
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode36.html](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode36.html)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode36.html)。
* `pd_event_handler`: Subscribers can listen to an event by declaring a `<pd_event_handler>` child element which can accept any of the PixieApp kernel execution attributes like `pd_options` and `pd_script`. This element must use the `pd_source` attribute to filter which events they want to process. The `pd_source` attribute can contain one of the following values:
......@@ -388,9 +363,7 @@ Drew 的数据科学 Conway Venn 图现在包括开发人员
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode37.html](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode37.html)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode37.html)。
**注意**:将`pd_source`用作`*`表示将接受所有事件。
......@@ -406,9 +379,7 @@ Drew 的数据科学 Conway Venn 图现在包括开发人员
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode38.html](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode38.html)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode38.html)。
# 方法
......@@ -426,9 +397,7 @@ Drew 的数据科学 Conway Venn 图现在包括开发人员
### 注意
您可以在此处找到代码文件:
[https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode39.py](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode39.py)
[您可以在此处找到代码文件](https://github.com/DTAIEB/Thoughtful-Data-Science/blob/master/chapter%205/sampleCode39.py)。
* `run`: This starts the PixieApp.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册