所以我创建了两个类。第一个(myModel)有一个函数,可以用“predictFinalIncome”函数计算收入。我出于 SO 的目的对其进行了简化。
class myModel:
"""
The earning growth model for individuals in the utopia
"""
def __init__(self, bias) :
"""
:param bias: we will use this potential bias to explore different scenarios to the functions of gender and ethnicity
:param b_0: the intercept of the model.\
:param b_age: age at world creation
:param b_education: similar.
:param b_gender: similar
:param b_marital: marital status
:param b_ethnic: similar
:param b_industry: similar
:param b_income: similar.
"""
self.bias = bias # bias is a dictionary with info to set bias on the gender function and the ethnic function
def predictFinalIncome( self, n, person ):
for i in range(n):
n_income = n_income* i
return n_income
所以这个类接受一个“Person”字典,比如:
utopModel = myModel( { "gender": False, "ethnic": False } )
months = 12
plato = { "age": 58, "education": 20, "gender": 1, "marital": 0, "ethnic": 2, "industry": 7, "income": 100000 }
utopModel.predictFinalIncome(months,plato)
所以我的目标是创建一个类(Person),它可以在每次调用该函数时存储给定 Person 的 predictFinalIncome(),从而删除前一个。这样我就可以跟踪一个人并在我调用该函数时存储他们的预测收入。
我想将其作为收入存储在 Person 中。
class Person:
"""
The attributes of a Person to build a person up, having their information in one place as it changes.
"""
def __init__(self, bias) :
"""
:param age: person's age
:param education: person's years of education
:param gender: male or female
:param marital: marital status
:param ethnic: ethnicity
:param industry: what sector of work
:param income: salary
"""
def age00(self, age):
return age
def age(self, age):
return
def income00(self, income):
return income
def income(self, n, income):
return
def __getitem__(self, item):
return self.__dict__[item]
心有法竹
交互式爱情
holdtom
随时随地看视频慕课网APP
相关分类