Temporary Advertisements:
Ad
Ad
Ad
HTB - AI Space Challenge
by Th3B4h0z - Wednesday July 3, 2024 at 02:39 PM
#1
Let's discuss the AI Space Challenge.
Reply
#2
Perform MDS on the distance matrix.
Thanks @paw for the rank!!
Reply
#3
thanks , it works
Reply
#4
import numpy as np
import matplotlib.pyplot as plt
from sklearn.manifold import MDS

def main():
    try:
        distance_matrix = np.load('distance_matrix.npy')
    except Exception as e:
        print(f"Error loading distance matrix: {e}")
        return

    print(f"Distance matrix shape: {distance_matrix.shape}")

    try:
        mds = MDS(n_components=2, dissimilarity='precomputed', random_state=42)
        points = mds.fit_transform(distance_matrix)
    except Exception as e:
        print(f"Error performing MDS: {e}")
        return

    plt.figure(figsize=(10, 8))
    plt.scatter(points[:, 0], points[:, 1])
    plt.title('MDS Projection of Distance Matrix')
    plt.xlabel('MDS Dimension 1')
    plt.ylabel('MDS Dimension 2')
   
    for i, point in enumerate(points):
        plt.annotate(str(i), (point[0], point[1]))

    plt.show()

if __name__ == "__main__":
    main()
Reply
#5
after i run the code code export the img , but img is not clear to read how fix it

This forum account is currently banned. Ban Length: Permanent (N/A Remaining)
Ban Reason: Compromised - Malware Logs
Reply
#6
(Jul 28, 2024, 12:15 PM)Januka Wrote: after i run the code code export the img , but img is not clear to read how fix it

You can change font size here:

plt.annotate(str(i), (point[0], point[1]), fontsize=6)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  HTB - ALL Challenges you Stuck in osamy7593 5 1,162 9 hours ago
Last Post: axiom4
  [FREE] HackTheBox Academy - CBBH CDSA CPTS All Modules Flags Techtom 109 13,879 Yesterday, 04:02 AM
Last Post: shia
  [FREE] HackTheBox Academy - CAPE Path Study Techtom 67 11,419 Oct 15, 2026, 12:09 PM
Last Post: ploufmeuhmeuh
  [FREE] CPTS 12 FLAGS pulsebreaker 167 19,053 Oct 15, 2026, 12:07 PM
Last Post: ploufmeuhmeuh
  [UPDATED] APT-Labs Prolabs Writeup z1ne99 52 9,153 Oct 15, 2026, 07:36 AM
Last Post: Neurotic

Forum Jump:


 Users browsing this forum: