=== Run information === Scheme: weka.associations.Apriori -I -N 10 -T 0 -C 0.9 -D 0.05 -U 1.0 -M 0.25 -S -1.0 -c -1 Relation: transaction Instances: 9 Attributes: 5 I1 I2 I3 I4 I5 === Associator model (full training set) === Apriori ======= Minimum support: 0.25 (2 instances) Minimum metric <confidence>: 0.9 Number of cycles performed: 15 Generated sets of large itemsets: Size of set of large itemsets L(1): 5 Large Itemsets L(1): I1=t 6 I2=t 7 I3=t 6 I4=t 2 I5=t 2 Size of set of large itemsets L(2): 6 Large Itemsets L(2): I1=t I2=t 4 I1=t I3=t 4 I1=t I5=t 2 I2=t I3=t 4 I2=t I4=t 2 I2=t I5=t 2 Size of set of large itemsets L(3): 2 Large Itemsets L(3): I1=t I2=t I3=t 2 I1=t I2=t I5=t 2 Best rules found: 1. I5=t 2 ==> I1=t 2 conf:(1) lift:(1.5) lev:(0.07) [0] conv:(0.67) 2. I4=t 2 ==> I2=t 2 conf:(1) lift:(1.29) lev:(0.05) [0] conv:(0.44) 3. I5=t 2 ==> I2=t 2 conf:(1) lift:(1.29) lev:(0.05) [0] conv:(0.44) 4. I2=t I5=t 2 ==> I1=t 2 conf:(1) lift:(1.5) lev:(0.07) [0] conv:(0.67) 5. I1=t I5=t 2 ==> I2=t 2 conf:(1) lift:(1.29) lev:(0.05) [0] conv:(0.44) 6. I5=t 2 ==> I1=t I2=t 2 conf:(1) lift:(2.25) lev:(0.12) [1] conv:(1.11)请解释以上weka生成的内容
时间: 2023-06-24 22:03:37 浏览: 378
这是一个关联规则挖掘的结果,使用的是Apriori算法。数据集有9个实例和5个属性。最小支持度为0.25,最小置信度为0.9。算法执行了15次循环,生成了3组大项集。最好的6条规则如下:
1. 当I5=t时,I1=t也是真的,这个规则的置信度为1,支持度为2,提升度为1.5,表示当有I5=t时,I1=t的出现概率是I1=t出现概率的1.5倍。
2. 当I4=t时,I2=t也是真的,这个规则的置信度为1,支持度为2,提升度为1.29。
3. 当I5=t时,I2=t也是真的,这个规则的置信度为1,支持度为2,提升度为1.29。
4. 当I2=t和I5=t同时成立时,I1=t也是真的,这个规则的置信度为1,支持度为2,提升度为1.5。
5. 当I1=t和I5=t同时成立时,I2=t也是真的,这个规则的置信度为1,支持度为2,提升度为1.29。
6. 当I5=t时,同时I1=t和I2=t也是真的,这个规则的置信度为1,支持度为2,提升度为2.25,表示当有I5=t时,同时I1=t和I2=t的出现概率是I1=t和I2=t的出现概率的2.25倍。
相关问题
优化以下python代码:class Scheme_Merging(object): def __init__(self, scheme: dict, threshold): self.scheme = scheme self.thred = threshold self.result = self.get_merged() def get_merged(self): res = {} for k, v in self.scheme.items(): point = [] idxs = self.get_one(v) all_idxs = [i for i in range(len(v))] flat_list = list(set([item for sublist in idxs for item in sublist])) opp_idxs = [i for i in all_idxs if i not in flat_list] for idx in idxs: inter_point = v[idx[0]:idx[-1]+1] median_ = np.median(inter_point) if inter_point[-1] - inter_point[0] <= self.thred: point.append(median_) else: point.extend([inter_point[0], median_, inter_point[-1]]) point.extend(np.array(v)[opp_idxs].tolist()) point.extend([v[0], v[-1]]) res_ = list(set(point)) res_.sort(reverse=False) res[k] = res_ return res def get_one(self, points: list): idx1 = [] n = len(points) - 1 for i in range(n): if points[i + 1] - points[i] < self.thred: idx1.append([i, i + 1]) t = 0 idx3 = [] idx2 = [[i, i] for i in range(n + 1)] for j, ids in enumerate(idx1): if j < len(idx1) - 1: if ids[1] == idx1[j+1][0]: idx2[t].extend([ids[0], ids[1], idx1[j+1][1]]) else: idx3.append(ids) t += 1 continue final_id = [list(set(m[2:])) for m in idx2 if len(m) > 2] final_id.extend(idx3) return final_id
以下是优化后的代码:
import numpy as np
class Scheme_Merging(object):
def __init__(self, scheme: dict, threshold):
self.scheme = scheme
self.thred = threshold
self.result = self.get_merged()
def get_merged(self):
res = {}
for k, v in self.scheme.items():
point = []
idxs = self.get_one(v)
all_idxs = set(range(len(v)))
flat_list = set([item for sublist in idxs for item in sublist])
opp_idxs = all_idxs - flat_list
for idx in idxs:
inter_point = v[idx[]:idx[-1]+1]
median_ = np.median(inter_point)
if inter_point[-1] - inter_point[] <= self.thred:
point.append(median_)
else:
point.extend([inter_point[], median_, inter_point[-1]])
point.extend(np.array(v)[list(opp_idxs)].tolist())
point.extend([v[], v[-1]])
res_ = list(set(point))
res_.sort(reverse=False)
res[k] = res_
return res
def get_one(self, points: list):
idx1 = []
n = len(points) - 1
for i in range(n):
if points[i+1] - points[i] < self.thred:
idx1.append([i, i+1])
t =
idx3 = []
idx2 = [[i, i] for i in range(n-1)]
for j, ids in enumerate(idx1):
if j < len(idx1) - 1:
if ids[1] == idx1[j+1][]:
idx2[t].extend([ids[], ids[1], idx1[j+1][1]])
else:
idx3.append(ids)
t = 1
continue
final_id = [list(set(m[2:])) for m in idx2 if len(m) > 2]
final_id.extend(idx3)
return final_id
这个代码的优化主要包括以下几个方面:
1. 使用 set() 函数替代 list() 函数,提高了代码的效率。
2. 将一些重复计算的部分提前计算出来,避免了重复计算。
3. 将一些列表的操作改为集合的操作,提高了代码的效率。
4. 修改了一些语法错误,使代码更加规范。
W0710 01:02:53.399958 3385 initconfiguration.go:120] Usage of CRI endpoints without URL scheme is deprecate d and can cause kubelet errors in the future. Automatically prepending scheme "unix" to the "criSocket" with value "/var/run/dockershim.sock". Please update your configuration!failed to pull image "registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.27.0": output: E07 10 01:02:53.528709 3408 remote_image.go:171] "PullImage from image service failed" err="rpc error: code = Unavailable desc = connection error: desc = \"transport: Error while dialing dial unix /var/run/dockershim.sock: connect: connection refused\"" image="registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.27.0"time="2023-07-10T01:02:53+08:00" level=fatal msg="pulling image: rpc error: code = Unavailable desc = connecti on error: desc = \"transport: Error while dialing dial unix /var/run/dockershim.sock: connect: connection refused\"", error: exit status 1 To see the stack trace of this error execute with --v=5 or higher
根据您提供的错误信息,看起来是在拉取名为 "registry.cn-hangzhou.aliyuncs.com/google_containers/kube-apiserver:v1.27.0" 的容器镜像时遇到了问题。
错误信息中提到了关于 CRI(Container Runtime Interface)的警告和错误。警告信息表示在使用 CRI 端点时没有指定 URL 方案会被弃用,并建议在 "criSocket" 的值中自动添加 "unix" 方案。同时,错误信息显示在与容器运行时通信时遇到了连接错误。
根据错误信息,看起来是在与 dockershim.sock 通信时发生了连接拒绝的问题。可能原因是 dockershim.sock 文件不存在或没有正确的访问权限。
请确保 dockershim.sock 文件存在并且具有正确的访问权限。您可以尝试检查文件路径是否正确,并使用适当的权限设置来确保容器运行时可以访问该文件。
如果问题仍然存在,请提供更多的上下文和操作步骤,以便我能够更准确地帮助您解决问题。
阅读全文