Giter Club home page Giter Club logo

sentiments_cared's Introduction

sentiments_cared

Introduction

The fourth week's programming assignment for the UCSanDiego online course covers the use of logistic regression in sentiment analysis.

Datasets

The dataset contains comments with their sentiment class labels from three websites. It is downloaded from here. Consult the README file in the data directory for more details.

Processing methods

Loading the dataset

We use a shuffle of the dataset from a fixed permutation.

The preprocessing on the dataset includes:

  • Removing digits
  • Removing punctuations
  • Lower-casing
  • Removing stop words

Next, we split the dataset into train and test sections including 2500 and 500 data entries respectively.

Finally, we remap the labels from "0 vs. 1" to "-1 vs. 1".

Creating the model

We use the scikit-learn package's linear model module to create a stochastic gradient descent classifier and fit it to data. This model is then used to predict the classes and probabilities of the test data.

Dependencies

This project uses Python 3.10.12 to run and for a list of requirements consult the requirements.txt list.

Run

To run the project, configure the conf.yaml with data about the preprocessing method and dataset features. Then run the entry point main.py.s

Results

We achieved average train and test errors of 0.0026 and 0.17 when fitting the model to train data.

Then we calculated the number of points beyond various margins, the error rate for each margin and the safe margin for each expected error rate. The results are illustrated in the following figure.

Results Figure

sentiments_cared's People

Contributors

amirint 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.