Giter VIP home page Giter VIP logo

tcrpeg's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

wadwings

tcrpeg's Issues

Error when doing classification task

Hi,

I tried to used TCRpeg with your pre-trained model but when I did the classification task I've got the following error:

auc,aup,y_pres,y_trues = tcrpeg_c.evaluate(x_test=x_test,y_test=y_test,batch_size=10)
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
Cell In[49], line 1
----> 1 auc,aup,y_pres,y_trues = tcrpeg_c.evaluate(x_test=x_test,y_test=y_test,batch_size=10)

File ~\TCR_peg\TCRpeg-main\TCRpeg-main\tcrpeg\classification.py:241, in classification.evaluate(self, x_test, y_test, batch_size, record_path)
    239 y_batch = torch.FloatTensor(y_batch).to(self.device)
    240 batch_size_temp = len(x_batch)
--> 241 x_batch = self.emb_model.get_embedding(x_batch,last_layer  = self.last_layer)
    242 x_batch = torch.tensor(x_batch).to(self.device)
    244 y_pres = self.model(x_batch).view(batch_size_temp)

File ~\TCR_peg\TCRpeg-main\TCRpeg-main\tcrpeg\TCRpeg.py:718, in TCRpeg.get_embedding(self, seqs, last_layer)
    716 self.model.eval()
    717 with torch.no_grad():
--> 718     inputs,targets,lengths = self.aas2embs(seqs)
    719     inputs,targets,lengths = torch.LongTensor(inputs).to(self.device),torch.LongTensor(targets).to(self.device),torch.LongTensor(lengths).to(self.device)
    720     if self.vj:                

File ~\TCR_peg\TCRpeg-main\TCRpeg-main\tcrpeg\TCRpeg.py:138, in TCRpeg.aas2embs(self, seqs)
    132 def aas2embs(self, seqs):
    133     """
    134     @seqs: list of AAs
    135 
    136     #return [[1,2,3,0,0],[2,3,4,0].....], the padded 
    137     """
--> 138     seqs = [[self.aa2idx[k] + 1 for k in seq] for seq in seqs]
    139     # lengths = [len(seq)+2 for seq in seqs] #contains start and stop
    140     lengths = [len(seq) + 1 for seq in seqs]  # contains the start token

File ~\TCR_peg\TCRpeg-main\TCRpeg-main\tcrpeg\TCRpeg.py:138, in <listcomp>(.0)
    132 def aas2embs(self, seqs):
    133     """
    134     @seqs: list of AAs
    135 
    136     #return [[1,2,3,0,0],[2,3,4,0].....], the padded 
    137     """
--> 138     seqs = [[self.aa2idx[k] + 1 for k in seq] for seq in seqs]
    139     # lengths = [len(seq)+2 for seq in seqs] #contains start and stop
    140     lengths = [len(seq) + 1 for seq in seqs]  # contains the start token

File ~\TCR_peg\TCRpeg-main\TCRpeg-main\tcrpeg\TCRpeg.py:138, in <listcomp>(.0)
    132 def aas2embs(self, seqs):
    133     """
    134     @seqs: list of AAs
    135 
    136     #return [[1,2,3,0,0],[2,3,4,0].....], the padded 
    137     """
--> 138     seqs = [[self.aa2idx[k] + 1 for k in seq] for seq in seqs]
    139     # lengths = [len(seq)+2 for seq in seqs] #contains start and stop
    140     lengths = [len(seq) + 1 for seq in seqs]  # contains the start token

KeyError: 'X'

My file is composed of two columns : seq and label columns as yours. When I used your file (classification.csv), I do not have the error, the command line works fine.

Can you highlight me on the origine of this error ?!
If needed, I can send you my data file.

Best

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.