Book Image

F# for Machine Learning Essentials

By : Sudipta Mukherjee
Book Image

F# for Machine Learning Essentials

By: Sudipta Mukherjee

Overview of this book

The F# functional programming language enables developers to write simple code to solve complex problems. With F#, developers create consistent and predictable programs that are easier to test and reuse, simpler to parallelize, and are less prone to bugs. If you want to learn how to use F# to build machine learning systems, then this is the book you want. Starting with an introduction to the several categories on machine learning, you will quickly learn to implement time-tested, supervised learning algorithms. You will gradually move on to solving problems on predicting housing pricing using Regression Analysis. You will then learn to use Accord.NET to implement SVM techniques and clustering. You will also learn to build a recommender system for your e-commerce site from scratch. Finally, you will dive into advanced topics such as implementing neural network algorithms while performing sentiment analysis on your data.
Table of Contents (16 chapters)
F# for Machine Learning Essentials
Credits
Foreword
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Handling negations


Sometimes, positive and negative polarities balance each other and a sentence for which you would expect to get a negative polarity ends up being an objective statement (meaning that the sentence doesn't have a polarity at all).

Consider the following sentence:

  • The camera of the phone was not good

The positive polarity of this sentence is calculated to be 0.625 (because of the word good) and the negative polarity of the sentence is calculated to be 0.625 (because of the word not). Thus, the overall polarity of this document is calculated to be zero; or in other words, the document is said to have no polarity at all. But as humans, we know that this phrase echoes a negative sentiment because the user is saying that the camera of the phone is not good.

In this section, we will see how we can tweak the above implementation to suit this type of sentence case.

The basic idea is to penalize a good word's positivity score with the value of the preceding negative words negative score...