1. 定义一个函数,冒号结尾换行后开始写函数注释。
2. 注释整个部分使用三引号注释。
3. 一般分为四个部分:整体简介、参数(Parameters)、返回(Returns)和注意(Notes)。
4. 整体简介作用是简短介绍函数的作用。一句话介绍总结函数作用。换行空行,可补充更细节的描述。一行最好不要有太多字符。
5. 空行之后另起一行Parameters,换行,十个-作为分隔符。每遇一个参数另起一行。依次写参数名称,冒号,参数的数据类型,格式,作用。
6. 空行之后另起一行Returns, 换行,十个-作为分隔符。依次介绍返回变量。
7. 空行之后另起一行Notes,写下想告诉读者的注意事项。
8.另起一行三引号结尾。
"""Create ``Dataset`` abstraction for sparse and dense inputs.
This also returns the ``intercept_decay`` which is different
for sparse datasets.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Training data
y : array-like, shape (n_samples, )
Target values.
sample_weight : numpy array of shape (n_samples,)
The weight of each sample
random_state : int, RandomState instance or None (default)
Determines random number generation for dataset random sampling. It is not
used for dataset shuffling.
Pass an int for reproducible output across multiple function calls.
See :term:`Glossary <random_state>`.
Returns
-------
dataset
The ``Dataset`` abstraction
intercept_decay
The intercept decay
"""