Git Product home page Git Product logo

Comments (5)

LWayne-Liu avatar LWayne-Liu commented on August 26, 2024

I have the same question and look forward to the author's reply.

from cast.

6586744 avatar 6586744 commented on August 26, 2024

need help too.

from cast.

yutong-xia avatar yutong-xia commented on August 26, 2024

Thank you for your interest in our work. To generate the 'peacor_adj.npy' file, you can use the code provided below.

def get_peacor_adj(data_path, threshold, save=False):
    # Load the dataset
    data = np.load(data_path + 'train.npz')['data']
    print("Data shape:", data.shape)
    
    # Compute the Pearson correlation coefficient matrix
    peacor = torch.corrcoef(torch.Tensor(data[...,0]).permute(1, 0))
    
    # Apply threshold
    peacor[peacor < threshold] = 0
    peacor[torch.eye(peacor.shape[0], dtype=bool)] = 0

    # Normalize the coefficients
    nonzero_peacor = peacor[peacor != 0]
    p_min, p_max = nonzero_peacor.min(), nonzero_peacor.max()
    peacor[peacor != 0] = (nonzero_peacor - p_min) / (p_max - p_min)

    # Visualization
    plt.figure(dpi=100)
    sns.heatmap(peacor)
    plt.show()
    
    # Save the result
    if save:
        np.save(data_path + 'peacor_adj.npy', peacor)

For customization, you can also consider implementing your own method for creating the edge attribute, which can be an alternative to the Pearson correlation or the Time-delayed Dynamic Time Warping (DTW) method used in our paper.

from cast.

hczs avatar hczs commented on August 26, 2024

Thank you for your interest in our work. To generate the 'peacor_adj.npy' file, you can use the code provided below.

def get_peacor_adj(data_path, threshold, save=False):
    # Load the dataset
    data = np.load(data_path + 'train.npz')['data']
    print("Data shape:", data.shape)
    
    # Compute the Pearson correlation coefficient matrix
    peacor = torch.corrcoef(torch.Tensor(data[...,0]).permute(1, 0))
    
    # Apply threshold
    peacor[peacor < threshold] = 0
    peacor[torch.eye(peacor.shape[0], dtype=bool)] = 0

    # Normalize the coefficients
    nonzero_peacor = peacor[peacor != 0]
    p_min, p_max = nonzero_peacor.min(), nonzero_peacor.max()
    peacor[peacor != 0] = (nonzero_peacor - p_min) / (p_max - p_min)

    # Visualization
    plt.figure(dpi=100)
    sns.heatmap(peacor)
    plt.show()
    
    # Save the result
    if save:
        np.save(data_path + 'peacor_adj.npy', peacor)

For customization, you can also consider implementing your own method for creating the edge attribute, which can be an alternative to the Pearson correlation or the Time-delayed Dynamic Time Warping (DTW) method used in our paper.

Thank you very much for your work, but I have the same problem with this issue, that is, there are some other files, how do I get these files, or is there a python script that can generate these files?
Issue Address: #2
Need files: such as "adj_mx_pems08.pkl", "time_dalay_attr.pkl", "sparse_adj.npy", "peacor_adj.npy" and "dist_adj.npy".

from cast.

Dx3281101 avatar Dx3281101 commented on August 26, 2024

如何获取数据集(/pems8/dataset.npy,peacor_adj.npy ....)?

Excuse me for the interruption.
Have you successfully run this model? I want to run it, but I'm missing some necessary data files . Could you please share how you handled this issue?
I would greatly appreciate it.

from cast.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.