我在学Python。我不明白 岩芯样品掩模[db.core\样本\索引_]=正确 这个代码。core\u sample\u mask是一个0到1499的数组,我不明白squrebracket在这段代码中是什么意思,为什么后面跟着=True。你知道吗
#data prep, dbscn clustering
X, y = createDataPoints([[4,3], [2,-1], [-1,4]] , 1500, 0.5)
epsilon = 0.3
minimumSamples = 7
db = DBSCAN(eps=epsilon, min_samples=minimumSamples).fit(X)
labels = db.labels_
labels
#create an array of booleans using the labels from db (I dont understand what this means..)
core_samples_mask = np.zeros_like(db.labels_, dtype=bool)
core_samples_mask[db.core_sample_indices_] = True
core_samples_mask
这只是索引赋值。注意
arr
的哪些元素发生了变化:相同的操作,但使用整数dtype数组:
类似的列表分配:
相关问题 更多 >
编程相关推荐