Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cocoa-ai/SentimentCoreMLDemo

😃 iOS11 demo application for sentiment polarity analysis.
https://github.com/cocoa-ai/SentimentCoreMLDemo

coreml coreml-models ios machine-learning nlp sentiment-analysis sentiment-polarity swift swift4

Last synced: about 2 months ago
JSON representation

😃 iOS11 demo application for sentiment polarity analysis.

Awesome Lists containing this project

README

        

# Sentiment Polarity CoreML Demo

A Demo application using `CoreML` framework for sentiment polarity analysis.


SentimentCoreMLDemo

## Model

[CoreML model](https://github.com/cocoa-ai/SentimentCoreMLDemo/blob/master/SentimentPolarity/Resources/SentimentPolarity.mlmodel)
was converted from [Scikit-learn Pipeline](http://scikit-learn.org/stable/modules/generated/sklearn.pipeline.Pipeline.html)
using [coremltools](https://pypi.python.org/pypi/coremltools) python package.

The model is based on [LinearSVC](http://scikit-learn.org/stable/modules/generated/sklearn.svm.LinearSVC.html) classifier and is able to distinguish between
positive and negative sentences with **best CV score = 0.801013024602**. It was
trained using [Epinions.com](http://epinions.com) dataset with reviews of
products and services. Accuracy can be improved by using
[TfidfVectorizer](http://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.TfidfVectorizer.html) for feature extraction, but it's not supported by [coremltools](https://pypi.python.org/pypi/coremltools)
at the moment.

## Requirements

- Xcode 9
- iOS 11

## Installation

```sh
git clone https://github.com/cocoa-ai/SentimentCoreMLDemo.git
cd SentimentCoreMLDemo
open SentimentPolarity.xcodeproj/
```

Build the project and run it on a simulator or a device with iOS 11.

## Conversion

```sh
cd Convert
python sentiment.py
```

## Author

Vadym Markov, [email protected]

## Credits

- Dataset with [Epinions.com](http://epinions.com) reviews was taken from
[HW3: Sentiment Analysis ](http://boston.lti.cs.cmu.edu/classes/95-865-K/HW/HW3/)

## References
- [scikit-learn](http://scikit-learn.org/stable/)
- [Apple Machine Learning](https://developer.apple.com/machine-learning/)
- [CoreML Framework](https://developer.apple.com/documentation/coreml)
- [coremltools](https://pypi.python.org/pypi/coremltools)