我有一个名为 IrisData 的类。我在其中定义了一个函数作为描述。
description 有多个我想要访问的子功能。
我希望我的功能像
如果调用描述,它应该返回描述中定义的每个函数。代码行:打印(I.description())
当调用内部函数时,它应该只返回内部函数。代码行:打印(I.description.attribute())*
PFB 代码片段:
class IrisData:
def urls(self):
self.url='https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data'
return self.url
def columns(self):
self.column_name=['sepal length','sepal width','petal length','petal width','class']
return self.column_name
def description(self):
def title():
self.titles ='Title: Iris Plants Database'
return self.titles
def source():
self.sources='''Sources:
\t(a) Creator: R.A. Fisher
\t(b) Donor: Michael Marshall (MARSHALL%PLU@io.arc.nasa.gov)
\t(c) Date: July, 1988'''
return self.sources
def info():
self.descri='''Relevant Information:
\t--- This is perhaps the best known database to be found in the pattern recognition literature. Fisher's paper is a classic in the field and is referenced frequently to this day. (See Duda & Hart, for
example.
\t--- The data set contains 3 classes of 50 instances each, where each class refers to a type of iris plant. One class is linearly separable from the other 2; the latter are NOT linearly
separable from each other.
\t--- Predicted attribute: class of iris plant.
\t--- This is an exceedingly simple domain.
\t--- This data differs from the data presented in Fishers article (identified by Steve Chadwick, spchadwick@espeedaz.net )
\tThe 35th sample should be: 4.9,3.1,1.5,0.2,"Iris-setosa"
\twhere the error is in the fourth feature.
\tThe 38th sample: 4.9,3.6,1.4,0.1,"Iris-setosa"
\twhere the errors are in the second and third features. '''
return self.descri
def attribute():
self.attri="""Attribute Information:
相关分类