NLP Model for Sentiment Labelled Sentences Using TensorFlow Take 2

Template Credit: Adapted from a template made available by Dr. Jason Brownlee of Machine Learning Mastery.

SUMMARY: This project aims to construct a text classification model using a neural network and document the end-to-end steps using a template. The Sentiment Labelled Sentences dataset is a binary classification situation where we attempt to predict one of the two possible outcomes.

INTRODUCTION: This dataset was created for the research paper ‘From Group to Individual Labels using Deep Features,’ Kotzias et al., KDD 2015. The paper researchers randomly selected 500 positive and 500 negative sentences from a larger dataset of reviews for each website. The researcher also attempted to choose sentences with a positive or negative connotation as the goal was to avoid selecting neutral sentences.

From iteration Take1, we deployed a bag-of-words model to classify the Amazon dataset’s review comments. We also applied various sequence-to-matrix modes to evaluate the model’s performance.

In this Take2 iteration, we will deploy a word-embedding model to classify the Amazon dataset’s review comments. We will also apply various sequence-to-matrix modes to evaluate the model’s performance.

ANALYSIS: From iteration Take1, the bag-of-words model’s performance achieved an average accuracy score of 77.31% after 25 epochs with ten iterations of cross-validation. Furthermore, the final model processed the test dataset with an accuracy measurement of 71.00%.

In this Take2 iteration, the word-embedding model’s performance achieved an average accuracy score of 73.25% after 25 epochs with ten iterations of cross-validation. Furthermore, the final model processed the test dataset with an accuracy measurement of 67.00%.

CONCLUSION: In this modeling iteration, the word-embedding TensorFlow model did not do as well as the bag-of-words model. However, we should continue to experiment with both natural language processing techniques for further modeling.

Dataset Used: Sentiment Labelled Sentences

Dataset ML Model: Binary class text classification with text-oriented features

Dataset Reference: https://archive.ics.uci.edu/ml/datasets/Sentiment+Labelled+Sentences

The HTML formatted report can be found here on GitHub.

Annie Duke on How to Decide, Part 3

In her book, How to Decide: Simple Tools for Making Better Choices, Annie Duke discusses how to train our brains to combat our own bias and help ourselves make more confident and better decisions.

These are some of my favorite concepts and takeaways from reading the book.

Chapter 3 “The Decision Multiverse”

Experience is valuable for learning, but leveraging experience incorrectly can create traps that interfere with our learning. One example of such pitfalls is the paradox of experience bias.

We experience the paradox of experience when our past carries an extraordinary amount of influence on our future decision-making process.

The immense weight of our past is not unusual. After all, while we can easily imagine many possible futures for a given decision, there is only one past.

If our past is the only instance of experience we can learn about something, we don’t have too many other options to work with because our past is all we got.

To minimize the negative effect of the paradox of experience bias, we can use techniques to counter-act the trap. Viewing the outcome that occurred in the context of other potential consequences at the time of the decision can resolve the paradox.

By recreating a simplified decision tree that reflects the potential, plausible outcomes that could have happened, the decision tree can put the actual result in its proper context.

Exploring the other possible outcomes is a form of counterfactual thinking. Practicing counterfactual thinking can help us in our future decision-making and decision-evaluation exercises by putting the results in their proper context.

Our willingness to examine outcomes also must go both directions. While we are more eager to put bad outcomes in context, we must also be willing to do the same for the good outcomes.

It can be challenging to put the excellent outcomes in perspective, but becoming a better decision-maker requires us to do it regularly.

NLP Model for Sentiment Labelled Sentences Using TensorFlow Take 1

Template Credit: Adapted from a template made available by Dr. Jason Brownlee of Machine Learning Mastery.

SUMMARY: This project aims to construct a text classification model using a neural network and document the end-to-end steps using a template. The Sentiment Labelled Sentences dataset is a binary classification situation where we attempt to predict one of the two possible outcomes.

INTRODUCTION: This dataset was created for the research paper ‘From Group to Individual Labels using Deep Features,’ Kotzias et al., KDD 2015. The paper researchers randomly selected 500 positive and 500 negative sentences from a larger dataset of reviews for each website. The researcher also attempted to choose sentences with a positive or negative connotation as the goal was to avoid selecting neutral sentences.

In this Take1 iteration, we will deploy a bag-of-words model to classify the Amazon dataset’s review comments. We will also apply various sequence-to-matrix modes to evaluate the model’s performance.

ANALYSIS: In this Take1 iteration, the bag-of-words model’s performance achieved an average accuracy score of 77.31% after 25 epochs with ten iterations of cross-validation. Furthermore, the final model processed the test dataset with an accuracy measurement of 71.00%.

CONCLUSION: In this modeling iteration, the bag-of-words TensorFlow model appeared to be suitable for modeling this dataset. We should consider experimenting with TensorFlow for further modeling.

Dataset Used: Sentiment Labelled Sentences

Dataset ML Model: Binary class text classification with text-oriented features

Dataset Reference: https://archive.ics.uci.edu/ml/datasets/Sentiment+Labelled+Sentences

The HTML formatted report can be found here on GitHub.

Multi-Class Image Classification Deep Learning Model for Intel Image Classification Using TensorFlow Take 5

Template Credit: Adapted from a template made available by Dr. Jason Brownlee of Machine Learning Mastery.

SUMMARY: This project aims to construct a predictive model using a TensorFlow convolutional neural network (CNN) and document the end-to-end steps using a template. The Intel Image Classification dataset is a multi-class classification situation where we attempt to predict one of several (more than two) possible outcomes.

INTRODUCTION: This dataset contains over 17,000 images of size 150×150 distributed under six categories: buildings, forest, glacier, mountain, sea, and street. There are approximately 14,000 images in the training set and 3,000 in the test/validation set. This dataset was initially published on https://datahack.analyticsvidhya.com by Intel as part of a data science competition.

From iteration Take1, we constructed a simple three-layer CNN neural network as the baseline model. We plan to use this model’s performance as the baseline measurement for future iterations of modeling.

From iteration Take2, we constructed a VGG16 neural network as an alternate model. We also compared this model’s performance with the baseline model from iteration Take1.

From iteration Take3, we constructed an InceptionV3 neural network as an alternate model. We also compared this model’s performance with the baseline model from iteration Take1.

From iteration Take4, we constructed a ResNet50V2 neural network as an alternate model. We also compared this model’s performance with the baseline model from iteration Take1.

In this Take5 iteration, we will construct a DenseNet201 neural network as an alternate model. We will compare this model’s performance with the baseline model from iteration Take1.

ANALYSIS: From iteration Take1, the baseline model’s performance achieved an accuracy score of 88.62% after 30 epochs using the training images. The baseline model also processed the validation images with an accuracy score of 85.37%.

From iteration Take2, the VGG16 model’s performance achieved an accuracy score of 83.57% after 30 epochs using the training images. The VGG16 model also processed the validation images with an accuracy score of 79.53%.

From iteration Take3, the InceptionV3 model’s performance achieved an accuracy score of 91.24% after 30 epochs using the training images. The InceptionV3 model also processed the validation images with an accuracy score of 87.10%.

From iteration Take4, the ResNet50V2 model’s performance achieved an accuracy score of 88.93% after 30 epochs using the training images. The ResNet50V2 model also processed the validation images with an accuracy score of 87.17%.

In this Take5 iteration, the DenseNet201 model’s performance achieved an accuracy score of 91.44% after 30 epochs using the training images. The DenseNet201 model also processed the validation images with an accuracy score of 87.27%.

CONCLUSION: In this iteration, the TensorFlow CNN model appeared to be suitable for modeling this dataset. We should consider experimenting with TensorFlow for further modeling.

Dataset Used: Intel Image Classification Dataset

Dataset ML Model: Multi-class image classification with numerical attributes

Dataset Reference: https://www.kaggle.com/puneet6060/intel-image-classification

One potential source of performance benchmarks: https://www.kaggle.com/puneet6060/intel-image-classification

The HTML formatted report can be found here on GitHub.

Algorithmic Trading Model for Simple Trend-Following Strategy Using Python Take 5

NOTE: This script is for learning purposes only and does not constitute a recommendation for buying or selling any stock mentioned in this script.

SUMMARY: This project aims to construct and test an algorithmic trading model and document the end-to-end steps using a template.

INTRODUCTION: This algorithmic trading model examines a simple trend-following strategy for a stock. The model buys a stock when the price reaches the highest price for the last X number of days. The model will exit the position when the stock price crosses below the mean of the same window size.

From iteration Take1, we set up the models using one fixed window size for long trades only. The window size varied from 10 to 50 trading days at a 5-day increment.

From iteration Take2, we set up the models using one fixed window size for long trades only. The window size will vary from 10 to 50 trading days at a 5-day increment. The models also considered a volume indicator with its window size to confirm the buy/sell signal.

From iteration Take3, we set up the models using one fixed window size for long and short trades. The window size varied from 10 to 50 trading days at a 5-day increment.

From iteration Take4, we set up the models using one fixed window size for long and short trades. The window size will vary from 10 to 50 trading days at a 5-day increment. The models also considered a volume indicator with its window size to confirm the buy/sell signal.

In this Take5 iteration, we will set up the models using one fixed window size for long trades only. The window size will vary from 10 to 50 trading days at a 5-day increment. The models will also consider a volume indicator with a varying window size between 10 and 25 days to further confirm the buy/sell signal.

ANALYSIS: From iteration Take1, we analyzed the stock prices for Apple Inc. (AAPL) between January 1, 2019, and December 24, 2020. The trading model produced a profit of 81.49 dollars per share. The buy-and-hold approach yielded a gain of 92.60 dollars per share.

From iteration Take2, we analyzed the stock prices for Apple Inc. (AAPL) between January 1, 2019, and December 24, 2020. The trading model produced a profit of 82.47 dollars per share. The buy-and-hold approach yielded a gain of 92.60 dollars per share.

From iteration Take3, we analyzed the stock prices for Apple Inc. (AAPL) between January 1, 2019, and December 24, 2020. The trading model produced a profit of 79.95 dollars per share. The buy-and-hold approach yielded a gain of 92.60 dollars per share.

From iteration Take4, we analyzed the stock prices for Apple Inc. (AAPL) between January 1, 2019, and December 24, 2020. The trading model produced a profit of 74.70 dollars per share. The buy-and-hold approach yielded a gain of 92.60 dollars per share.

In this Take5 iteration, we analyzed the stock prices for Apple Inc. (AAPL) between January 1, 2019, and December 24, 2020. The trading model produced a profit of 83.39 dollars per share. The buy-and-hold approach yielded a gain of 92.60 dollars per share.

CONCLUSION: For the stock of AAPL during the modeling time frame, the trading strategy did not produce a better return than the buy-and-hold approach. We should consider modeling this stock further by experimenting with more variations of the strategy.

Dataset ML Model: Time series analysis with numerical attributes

Dataset Used: Quandl

The HTML formatted report can be found here on GitHub.

Multi-Class Image Classification Deep Learning Model for Intel Image Classification Using TensorFlow Take 4

Template Credit: Adapted from a template made available by Dr. Jason Brownlee of Machine Learning Mastery.

SUMMARY: This project aims to construct a predictive model using a TensorFlow convolutional neural network (CNN) and document the end-to-end steps using a template. The Intel Image Classification dataset is a multi-class classification situation where we attempt to predict one of several (more than two) possible outcomes.

INTRODUCTION: This dataset contains over 17,000 images of size 150×150 distributed under six categories: buildings, forest, glacier, mountain, sea, and street. There are approximately 14,000 images in the training set and 3,000 in the test/validation set. This dataset was initially published on https://datahack.analyticsvidhya.com by Intel as part of a data science competition.

From iteration Take1, we constructed a simple three-layer CNN neural network as the baseline model. We plan to use this model’s performance as the baseline measurement for future iterations of modeling.

From iteration Take2, we constructed a VGG16 neural network as an alternate model. We also compared this model’s performance with the baseline model from iteration Take1.

From iteration Take3, we constructed an InceptionV3 neural network as an alternate model. We also compared this model’s performance with the baseline model from iteration Take1.

In this Take4 iteration, we will construct a ResNet50V2 neural network as an alternate model. We will compare this model’s performance with the baseline model from iteration Take1.

ANALYSIS: From iteration Take1, the baseline model’s performance achieved an accuracy score of 88.62% after 30 epochs using the training images. The baseline model also processed the validation images with an accuracy score of 85.37%.

From iteration Take2, the VGG16 model’s performance achieved an accuracy score of 83.57% after 30 epochs using the training images. The VGG16 model also processed the validation images with an accuracy score of 79.53%.

From iteration Take3, the InceptionV3 model’s performance achieved an accuracy score of 91.24% after 30 epochs using the training images. The InceptionV3 model also processed the validation images with an accuracy score of 87.10%.

In this Take4 iteration, the ResNet50V2 model’s performance achieved an accuracy score of 88.93% after 30 epochs using the training images. The ResNet50V2 model also processed the validation images with an accuracy score of 87.17%.

CONCLUSION: In this iteration, the TensorFlow CNN model appeared to be suitable for modeling this dataset. We should consider experimenting with TensorFlow for further modeling.

Dataset Used: Intel Image Classification Dataset

Dataset ML Model: Multi-class image classification with numerical attributes

Dataset Reference: https://www.kaggle.com/puneet6060/intel-image-classification

One potential source of performance benchmarks: https://www.kaggle.com/puneet6060/intel-image-classification

The HTML formatted report can be found here on GitHub.

Multi-Class Image Classification Deep Learning Model for Intel Image Classification Using TensorFlow Take 3

Template Credit: Adapted from a template made available by Dr. Jason Brownlee of Machine Learning Mastery.

SUMMARY: This project aims to construct a predictive model using a TensorFlow convolutional neural network (CNN) and document the end-to-end steps using a template. The Intel Image Classification dataset is a multi-class classification situation where we attempt to predict one of several (more than two) possible outcomes.

INTRODUCTION: This dataset contains over 17,000 images of size 150×150 distributed under six categories: buildings, forest, glacier, mountain, sea, and street. There are approximately 14,000 images in the training set and 3,000 in the test/validation set. This dataset was initially published on https://datahack.analyticsvidhya.com by Intel as part of a data science competition.

From iteration Take1, we constructed a simple three-layer CNN neural network as the baseline model. We plan to use this model’s performance as the baseline measurement for future iterations of modeling.

From iteration Take2, we constructed a VGG16 neural network as an alternate model. We also compared this model’s performance with the baseline model from iteration Take1.

In this Take3 iteration, we will construct an InceptionV3 neural network as an alternate model. We will compare this model’s performance with the baseline model from iteration Take1.

ANALYSIS: From iteration Take1, the baseline model’s performance achieved an accuracy score of 88.62% after 30 epochs using the training images. The baseline model also processed the validation images with an accuracy score of 85.37%.

From iteration Take2, the VGG16 model’s performance achieved an accuracy score of 83.57% after 30 epochs using the training images. The VGG16 model also processed the validation images with an accuracy score of 79.53%.

In this Take3 iteration, the InceptionV3 model’s performance achieved an accuracy score of 91.24% after 30 epochs using the training images. The InceptionV3 model also processed the validation images with an accuracy score of 87.10%.

CONCLUSION: In this iteration, the TensorFlow CNN model appeared to be suitable for modeling this dataset. We should consider experimenting with TensorFlow for further modeling.

Dataset Used: Intel Image Classification Dataset

Dataset ML Model: Multi-class image classification with numerical attributes

Dataset Reference: https://www.kaggle.com/puneet6060/intel-image-classification

One potential source of performance benchmarks: https://www.kaggle.com/puneet6060/intel-image-classification

The HTML formatted report can be found here on GitHub.