Question: YOU MUST USE THESE FUNCTIONS PLEASE 1 ) A function make _ tfm _ model ( T ) which takes a parameter T ( a
YOU MUST USE THESE FUNCTIONS PLEASE A function maketfmmodelT which takes a parameter T a string with value either tcr or
antigen and returns a PyTorch object untrained subclass of nnModule that implements the
transformer model for the corresponding tcrantigen sequences.
A function makepredictmodelMantigen, Mtcr which takes two parameters: Mtcr is the
TCR transformer model and Mantigen is the antigen transformer model, and return the full
model that makes the prediction on the TCRantigen interaction.
A function pretraintfmmodelM D nepochs which takes a transformer model M and a
training data set D a list of sequences and pretrain the model M as specified above for
nepochs. At the end of each epoch, print out the average loss during that epoch.
A function trainmodelM Lantigen, Ltcr Interaction, nepochs which trains the full
prediction model M passed to it for nepochs using the following data: Lantigen, a list of
antigen sequences, Ltcr a list of TCR sequences, and Interaction, list of the numbers
indicating interaction or not. Clearly these three lists are of the same length. At the end of each
epoch, print out the average loss during that epoch.
A function loadtrainedmodel which should download your trained model saved somewhere
online and load it from the downloaded file. The function then returns the model. Do not train the
model from scratch in this function. Same as HW you should not upload the model file to
moodle. Instead, you should share it in your google drive or other online storage which can be
shared by link
A function predictM Lantigen, Ltcr which takes a full prediction model M and Lantigen,
a list of antigen sequences, Ltcr a list of TCR sequences. Again the two lists are of the same
length. For each corresponding pair of sequences in Lantigen and Ltcr the function should
use the model to make a prediction on their interaction. Return a list of the prediction results
In a comment section at the beginning of the py file, report the result from your fold cross
validations. For each foldrun report the accuracy of the trained model on the leftaside test data.
Also report the average of the folds total numbersmeasures for a model Report the
measures for both the model with and the one without pretraining. Show the performance gain by
pretraining and discuss briefly whether it meets your expectation.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
