Giter Site home page Giter Site logo

nlp-hw2's Introduction

Aspect-Based Sentiment Analysis

This is my solution for the second homework of the NLP 2021 course at Sapienza University of Rome.

Requirements

  • Ubuntu distribution
    • Either 19.10 or the current LTS are perfectly fine
    • If you do not have it installed, please use a virtual machine (or install it as your secondary OS). Plenty of tutorials online for this part
  • conda, a package and environment management system particularly used for Python in the ML community

Notes

Unless otherwise stated, all commands here are expected to be run from the root directory of this project

Setup Environment

As mentioned in the slides, differently from previous years, this year we will be using Docker to remove any issue pertaining your code runnability. If test.sh runs on your machine (and you do not edit any uneditable file), it will run on ours as well; we cannot stress enough this point.

Please note that, if it turns out it does not run on our side, and yet you claim it run on yours, the only explanation would be that you edited restricted files, messing up with the environment reproducibility: regardless of whether or not your code actually runs on your machine, if it does not run on ours, you will be failed automatically. Only edit the allowed files.

To run test.sh, we need to perform two additional steps:

  • Install Docker
  • Setup a client

For those interested, test.sh essentially setups a server exposing your model through a REST Api and then queries this server, evaluating your model.

Install Docker

curl -fsSL get.docker.com -o get-docker.sh
sudo sh get-docker.sh
rm get-docker.sh
sudo usermod -aG docker $USER

Unfortunately, for the latter command to have effect, you need to logout and re-login. Do it before proceeding. For those who might be unsure what logout means, simply reboot your Ubuntu OS.

Setup Client

Your model will be exposed through a REST server. In order to call it, we need a client. The client has already been written (the evaluation script) but it needs some dependecies to run. We will be using conda to create the environment for this client.

conda create -n nlp2021-hw2 python=3.7
conda activate nlp2021-hw2
pip install -r requirements.txt

Run

test.sh is a simple bash script. To run it:

conda activate nlp2021-hw2
bash test.sh data/restaurants_dev.json

Actually, you can replace data/dev.jsonl to point to a different file, as far as the target file has the same format.

If you hadn't changed hw2/stud/model.py yet when you run test.sh, the scores you just saw describe how a random baseline behaves. To have test.sh evaluate your model, follow the instructions in the slide.

nlp-hw2's People

Contributors

mikcnt avatar

Stargazers

 avatar  avatar

Watchers

 avatar

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.