Ejemplo n.º 1
0
                X[a][b] = 0

    medians = []
    for x in range(0, 16):
        acceptable = []
        for z in range(0, 434):
            if (X[z][x] == 1) or (X[z][x] == 0):
                acceptable.append(X[z][x])
        med = np.median(acceptable)
        medians.append(int(med))

    for c in range(0, 434):
        for d in range(0, 16):
            if (X[c][d] != 1) and (X[c][d] != 0):
                X[c][d] = medians[d]
    X = X.astype(float)
    X = normalize(X)
    return X, y


x, y = original_clean()
model = Isomap(n_components=size, n_neighbors=45)  # 45 = 48%
out = model.fit_transform(x)
out = out[:, 0:2]
plt.scatter(out[:, 0], out[:, 1], c=y, marker='o')
plt.show()
model = DBSCAN()
predicted = model.fit_predict(out)
score = v_measure_score(predicted, y)
print(score)