Neural Networks - Language processing Python script
Budget: $30 – $250 USD
I need someone to write a Pytorch program for me that learns to read business reviews in a text format and predict a rating (positive or negative) associated with each review, as well as business category (0=Resturants, 1=Shopping, 2=Home Services, 3=Health & Medical, 4=Automotive).
I’ll also need a written outline of how the program works and explanation on how:
- The architecture, algorithms and enhancements were chosen
- How the cost function and optimiser was chosen
- How the dimensionality of the word vectors, metaparameter values and any data preprocessing used/not used was determined
- How the validation set was employed and any other steps to avoid overfitting not otherwise discussed
Only the student.py file provided should be completed so that it can be run in conjunction with the provided a3main.py by typing python3 a3main.py. The a3main.py file should not be modified.
The code should be backend-agnostic in the sense that it can be run on either a CPU or GPU.
Constraints
Free to create additional variables, functions, classes, etc., so long as the code runs correctly with a3main.py unmodified, and only the approved packages are used. These constraints must be adhered to:
- The model must be defined in a class named network.
- The savedModel.pth file must be generated by the student.py file
- The submission (including savedModel.pth) must be under 50MB and external assets cannot be loaded in the network class.
- If trained on a GPU, the model is able to be evaluated on a CPU.
- Restricted to using GloVe vectors 6B, but free to specify the value of dim (50, 100, 200 or 300).
- Must ensure that the code can be loaded tested. This will involve importing the student.py file, creating an instance of the network class, restoring the parameters from the savedModel.pth, loading my own test dataset, processing according to what is specified in the student.py file, and calculating accuracy and score.
- DO NOT download or load data other than what is provided – don’t train on external data
Approved Packages:
Here is a list of approved packages. If there is some other package you would like to use, let us know and we will consider adding it to the list.
• json
• math
• mlflow
• nltk*
• numpy
• os
• pandas
• random
• re
• sklearn
• spacy*
• string
• sys
• time
• torch
• torchtext
• unicodedata
* Note that, for packages like nltk and spacy, you are only allowed to use methods which do not try to download additional data at runtime from external sources. For example, if you used them to get an initial list of stop words, you should include the list explicitly in your code rather than downloading it again at run-time.
I’ll also need a written outline of how the program works and explanation on how:
- The architecture, algorithms and enhancements were chosen
- How the cost function and optimiser was chosen
- How the dimensionality of the word vectors, metaparameter values and any data preprocessing used/not used was determined
- How the validation set was employed and any other steps to avoid overfitting not otherwise discussed
Only the student.py file provided should be completed so that it can be run in conjunction with the provided a3main.py by typing python3 a3main.py. The a3main.py file should not be modified.
The code should be backend-agnostic in the sense that it can be run on either a CPU or GPU.
Constraints
Free to create additional variables, functions, classes, etc., so long as the code runs correctly with a3main.py unmodified, and only the approved packages are used. These constraints must be adhered to:
- The model must be defined in a class named network.
- The savedModel.pth file must be generated by the student.py file
- The submission (including savedModel.pth) must be under 50MB and external assets cannot be loaded in the network class.
- If trained on a GPU, the model is able to be evaluated on a CPU.
- Restricted to using GloVe vectors 6B, but free to specify the value of dim (50, 100, 200 or 300).
- Must ensure that the code can be loaded tested. This will involve importing the student.py file, creating an instance of the network class, restoring the parameters from the savedModel.pth, loading my own test dataset, processing according to what is specified in the student.py file, and calculating accuracy and score.
- DO NOT download or load data other than what is provided – don’t train on external data
Approved Packages:
Here is a list of approved packages. If there is some other package you would like to use, let us know and we will consider adding it to the list.
• json
• math
• mlflow
• nltk*
• numpy
• os
• pandas
• random
• re
• sklearn
• spacy*
• string
• sys
• time
• torch
• torchtext
• unicodedata
* Note that, for packages like nltk and spacy, you are only allowed to use methods which do not try to download additional data at runtime from external sources. For example, if you used them to get an initial list of stop words, you should include the list explicitly in your code rather than downloading it again at run-time.