keras文档如何获取方法和属性的详细信息

时间:2019-03-08 15:29:34

标签: methods keras attributes

我想了解更多关于keras tokenizer的信息,而谷歌的快速搜索将我带到了this page(这是gogle搜索中的第一个链接)。为什么它没有列出所有方法和属性?我怎么看这些?是否有单独的页面?

我找到了另一个link。它似乎是官方的keras文档,但对于旧版本而言,它列出了方法和属性。我希望看到类似的信息,但最新的keras版本

3 个答案:

答案 0 :(得分:3)

Keras预处理移至单独的程序包。源代码可在此处找到:https://github.com/keras-team/keras-preprocessing/blob/master/keras_preprocessing/text.py

安装Keras,还将安装keras_applications(著名的模型架构)和keras_preprocessing(用于处理图像,文本和序列数据的实用程序)。 https://github.com/keras-team/keras/blob/master/setup.py(第40,41行)。

在python REPL中,您可以获得所有方法的清单:

enter image description here

答案 1 :(得分:2)

To get the documentation for the methods of the Tokenizer object you could just do

>>> import keras
>>> help(keras.preprocessing.text.Tokenizer)

In the terminal the beginning of the output from the last call looks like this - which is very similar to the documentation of keras 1.2 to which you have referred in your second link:

For the attributes of the Tokenizer object I wasn't able to find proper documentation either.

But - as an alternative to Manoj's answer - to just see the different attributes and methods of a Tokenizer object you could simply

>>> tokenizer = keras.preprocessing.text.Tokenizer()
>>> dir(tokenizer)

for which the output is

['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'char_level', 'document_count', 'filters', 'fit_on_sequences', 'fit_on_texts', 'index_docs', 'lower', 'num_words', 'oov_token', 'sequences_to_matrix', 'split', 'texts_to_matrix', 'texts_to_sequences', 'texts_to_sequences_generator', 'word_counts', 'word_docs']

答案 2 :(得分:1)

如果使用jupyter笔记本,可以在方法前添加?获得带有输入的简短描述,例如?methodname或??。获取该方法的源代码 像??methodname

enter image description here