https://github.com/r-m-n/sklearn-deltatfidf
DeltaTfidfVectorizer for scikit-learn
https://github.com/r-m-n/sklearn-deltatfidf
delta-tf-idf python scikit-learn sentiment-analysis sklearn tf-idf
Last synced: 9 months ago
JSON representation
DeltaTfidfVectorizer for scikit-learn
- Host: GitHub
- URL: https://github.com/r-m-n/sklearn-deltatfidf
- Owner: r-m-n
- License: mit
- Created: 2017-02-12T09:39:55.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-12-19T07:34:10.000Z (over 5 years ago)
- Last Synced: 2025-04-10T17:12:54.923Z (about 1 year ago)
- Topics: delta-tf-idf, python, scikit-learn, sentiment-analysis, sklearn, tf-idf
- Language: Python
- Size: 11.7 KB
- Stars: 10
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE.txt
Awesome Lists containing this project
README
=================
sklearn-deltatfidf
=================
|pypi| |downloads|
DeltaTfidfVectorizer for scikit-learn.
The Delta TFIDF is suggested in a article_ by Justin Martineau and Tim Finin, and usually associated with sentiment classification or polarity detection of text.
Usage
-----
.. code:: python
from sklearn_deltatfidf import DeltaTfidfVectorizer
v = DeltaTfidfVectorizer()
data = ['word1 word2', 'word2', 'word2 word3', 'word4']
labels = [1, -1, -1, 1]
v.fit_transform(data, labels)
# you can use it in pipelines as usual
pipe = Pipeline([
('vectorizer', DeltaTfidfVectorizer()),
('clf', svm.LinearSVC())
])
pipe.fit(data, labels)
Installation
------------
With ``pip``:
.. code-block:: console
$ pip install sklearn-deltatfidf
From source:
.. code-block:: console
$ git clone https://github.com/r-m-n/sklearn-deltatfidf.git
$ cd sklearn-deltatfidf
$ python setup.py install
.. _article: http://ebiquity.umbc.edu/_file_directory_/papers/446.pdf
.. |pypi| image:: https://img.shields.io/pypi/v/sklearn-deltatfidf
:alt: PyPI
.. |downloads| image:: https://img.shields.io/pypi/dm/sklearn-deltatfidf
:alt: PyPI - Downloads