Beispiel #1
0
    def set_host_info(self):
        memtot = sum(calc_suffix(q.memtot) for q in self.queues if q.disabled is False)
        memuse = sum(calc_suffix(q.memuse) for q in self.queues if q.disabled is False)
        swapto = sum(calc_suffix(q.swapto) for q in self.queues if q.disabled is False)
        swapus = sum(calc_suffix(q.swapus) for q in self.queues if q.disabled is False)

        self.memusage = 0. if memtot == 0 else memuse / memtot
        self.swapusage = 0. if swapto == 0 else swapus / swapto

        self.memtot = add_suffix(memtot)
        self.memuse = add_suffix(memuse)
        self.swapto = add_suffix(swapto)
        self.swapus = add_suffix(swapus)

        super(Cluster, self).set_host_info()
Beispiel #2
0
 def _get_reserved_memory(self):
     self.reserved_memory = sum(c.reserved_memory for c in self.children)
     self.rsvmemusage = 0. if calc_suffix(
         self.memtot) == 0 else self.reserved_memory / calc_suffix(
             self.memtot)
     self.rsvmem = add_suffix(self.reserved_memory)
     self._set_rsvmem_color()
Beispiel #3
0
lib.title("#############6 Inference2#############")
#####データを読み取る#####
HPRICE_dataset = lib.load(filename="HPRICE1.csv")
explanatories = ["const", "sqrft", "bdrms"]
explained = ["lprice"]

#####各変数を定義#####
X = lib.df2mat(df=HPRICE_dataset, columns=explanatories)
Y = lib.df2mat(df=HPRICE_dataset, columns=explained)
b = lib.reg(X=X, Y=Y)
"""
6-1の解答
"""
lib.chaper("<6.1の解答>")
#####解答#####
lib.add_suffix(b, labels=explanatories)
print("\n")
"""
6-2の解答
"""
lib.chaper("<6.2の解答>")
#####回帰係数の取得#####
const, sqrft, bdrms = b[0], b[1], b[2]
y_bdrms = bdrms

#####解答#####
print("bdrmsの数が1単位上がると、priceは" + str(round(y_bdrms * 100, 4)) + "%上がる")
print("\n")
"""
6-3の解答
"""
Beispiel #4
0
#####データを読み取る#####
artifical_dataset = lib.load(filename="artificial.csv")
explanatories = ["x1", "x2"]
explained = ["y"]

#####各変数を定義#####
X = lib.df2mat(df=artifical_dataset, columns=explanatories)
Y = lib.df2mat(df=artifical_dataset, columns=explained)
b = lib.reg(X=X, Y=Y)
"""
1-1の解答
"""
lib.chaper("<大問1.1の回答>")

#####解答#####
lib.add_suffix(b)
print("\n")
"""
1-2の解答
"""
lib.chaper("<大問1.2の回答>")

#####各変数を定義#####
t = lib.t(X=X, Y=Y, beta=b)[0]
print("t value :", t)
print("自由度998で、2.581を基準にしたところ 2.581 <", t, "なので、1%水準でβ0 = 0は棄却される")
print("\n")
"""
1-3の解答
"""
lib.chaper("<大問1.3の回答>")
Beispiel #5
0
"""
3 Multiple Regression
"""
lib.title("#############3 Multiple Regression#############")
#####データを読み取る#####
CEOSAL2_dataset = lib.load(filename="CEOSAL2.csv")
explanatories = ["const", "lsales", "lmktval"]
explained = ["lsalary"]
"""
3-1の解答
"""
lib.chaper("大問3.1の回答")
X = lib.df2mat(df=CEOSAL2_dataset, columns=explanatories)
Y = lib.df2mat(df=CEOSAL2_dataset, columns=explained)
b = lib.reg(X=X, Y=Y)
lib.add_suffix(coefs=b, labels=explanatories)
print("\n")
"""
3-2の解答
"""
lib.chaper("大問3.2の回答")
CEOSAL2_dataset = lib.load(filename="CEOSAL2.csv")
explanatories = ["const", "lsales", "lmktval", "profits"]
explained = ["lsalary"]

X = lib.df2mat(df=CEOSAL2_dataset, columns=explanatories)
Y = lib.df2mat(df=CEOSAL2_dataset, columns=explained)
b = lib.reg(X=X, Y=Y)
lib.add_suffix(coefs=b, labels=explanatories)
print("profitsは、データがマイナスの値をとるものがあるので、真数条件を満たさないため")
print("\n")
Beispiel #6
0
 def _get_reserved_memory(self):
     self.reserved_memory = sum(c.reserved_memory for c in self.children)
     self.rsvmemusage = 0. if calc_suffix(self.memtot) == 0 else self.reserved_memory / calc_suffix(self.memtot)
     self.rsvmem = add_suffix(self.reserved_memory)
     self._set_rsvmem_color()