Multi-Class Image Classification Model for Robusta Coffee Leaf Images 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 Robusta Coffee Leaf Images dataset is a multi-class classification situation where we attempt to predict one of several (more than two) possible outcomes.

INTRODUCTION: The dataset contains 1560 Robusta coffee leaf images with visible mites and spots for infection cases and images without such appearance for healthy cases. Also, the dataset includes labels regarding the health state (healthy and unhealthy) and the severity of the disease (leaf area with spots).

In iteration Take1, we constructed a CNN model using a simple three-block VGG architecture and tested the model’s performance using a validation dataset (20%) set aside from the training images.

In iteration Take2, we constructed a CNN model using the DenseNet121 architecture and tested the model’s performance using a validation dataset (20%) set aside from the training images.

In this Take3 iteration, we will construct a CNN model using the InceptionV3 architecture and test the model’s performance using a validation dataset (20%) set aside from the training images.

ANALYSIS: In iteration Take1, the baseline model’s performance achieved an accuracy score of 98.16% on the training dataset after 15 epochs. Furthermore, the final model achieved an accuracy score of 51.28% on the validation dataset.

In iteration Take2, the DenseNet121 model’s performance achieved an accuracy score of 97.61% on the training dataset after 15 epochs. Furthermore, the final model achieved an accuracy score of 73.08% on the validation dataset.

In this Take3 iteration, the InceptionV3 model’s performance achieved an accuracy score of 97.84% on the training dataset after 15 epochs. Furthermore, the final model achieved an accuracy score of 71.15% on the validation dataset.

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

Dataset Used: Robusta Coffee Leaf Images

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

Dataset Reference: Parraga-Alava, Jorge; Cusme, Kevin; Loor, Angélica; Santander, Esneider (2019), “RoCoLe: A robusta coffee leaf images dataset”, Mendeley Data, V2, doi: 10.17632/c5yvn32dzg.2 http://dx.doi.org/10.17632/c5yvn32dzg.2

A potential source of performance benchmarks: https://data.mendeley.com/datasets/c5yvn32dzg/2

The HTML formatted report can be found here on GitHub.

Algorithmic Trading Model for Mean-Reversion with Relative Strength Indicator Using Python Take 1

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 mean-reversion strategy for a stock. The model enters a position when the price reaches either the upper or lower Relative Strength Indicator thresholds for the last X number of days. The model will exit the trade when the stock price crosses the upper or the lower RSI line for the same window size.

In this Take1 iteration, we will set up the models using an RSI window size for long trades only. The window size will vary from 10 to 50 trading days at a 5-day increment.

ANALYSIS: In this Take1 iteration, we analyzed the stock prices for Costco Wholesale (COST) between January 1, 2016, and April 23, 2021. The top trading model produced a profit of 143.51 dollars per share. The buy-and-hold approach yielded a gain of 211.45 dollars per share.

CONCLUSION: For the stock of COST during the modeling time frame, the simple long-only 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 Model for Robusta Coffee Leaf Images 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 predictive model using a TensorFlow convolutional neural network (CNN) and document the end-to-end steps using a template. The Robusta Coffee Leaf Images dataset is a multi-class classification situation where we attempt to predict one of several (more than two) possible outcomes.

INTRODUCTION: The dataset contains 1560 Robusta coffee leaf images with visible mites and spots for infection cases and images without such appearance for healthy cases. Also, the dataset includes labels regarding the health state (healthy and unhealthy) and the severity of the disease (leaf area with spots).

In iteration Take1, we constructed a CNN model using a simple three-block VGG architecture and tested the model’s performance using a validation dataset (20%) set aside from the training images.

In this Take2 iteration, we will construct a CNN model using the DenseNet121 architecture and test the model’s performance using a validation dataset (20%) set aside from the training images.

ANALYSIS: In iteration Take1, the baseline model’s performance achieved an accuracy score of 98.16% on the training dataset after 15 epochs. Furthermore, the final model achieved an accuracy score of 51.28% on the validation dataset.

In this Take2 iteration, the DenseNet121 model’s performance achieved an accuracy score of 97.61% on the training dataset after 15 epochs. Furthermore, the final model achieved an accuracy score of 73.08% on the validation dataset.

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

Dataset Used: Robusta Coffee Leaf Images

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

Dataset Reference: Parraga-Alava, Jorge; Cusme, Kevin; Loor, Angélica; Santander, Esneider (2019), “RoCoLe: A robusta coffee leaf images dataset”, Mendeley Data, V2, doi: 10.17632/c5yvn32dzg.2 http://dx.doi.org/10.17632/c5yvn32dzg.2

A potential source of performance benchmarks: https://data.mendeley.com/datasets/c5yvn32dzg/2

The HTML formatted report can be found here on GitHub.

Multi-Class Image Classification Model for Robusta Coffee Leaf Images 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 predictive model using a TensorFlow convolutional neural network (CNN) and document the end-to-end steps using a template. The Robusta Coffee Leaf Images dataset is a multi-class classification situation where we attempt to predict one of several (more than two) possible outcomes.

INTRODUCTION: The dataset contains 1560 Robusta coffee leaf images with visible mites and spots for infection cases and images without such appearance for healthy cases. Also, the dataset includes labels regarding the health state (healthy and unhealthy) and the severity of the disease (leaf area with spots).

In this Take1 iteration, we will construct a CNN model using a simple three-block VGG architecture and test the model’s performance using a validation dataset (20%) set aside from the training images.

ANALYSIS: In this Take1 iteration, the baseline model’s performance achieved an accuracy score of 98.16% on the training dataset after 15 epochs. Furthermore, the final model achieved an accuracy score of 51.28% on the validation dataset.

CONCLUSION: In this iteration, the simple three-block VGG CNN model appeared to be suitable for modeling this dataset. We should consider experimenting with more CNN architectures for further modeling.

Dataset Used: Robusta Coffee Leaf Images

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

Dataset Reference: Parraga-Alava, Jorge; Cusme, Kevin; Loor, Angélica; Santander, Esneider (2019), “RoCoLe: A robusta coffee leaf images dataset”, Mendeley Data, V2, doi: 10.17632/c5yvn32dzg.2 http://dx.doi.org/10.17632/c5yvn32dzg.2

A potential source of performance benchmarks: https://data.mendeley.com/datasets/c5yvn32dzg/2

The HTML formatted report can be found here on GitHub.

Seth Godin’s Akimbo: Lazy Capitalism

In his Akimbo podcast, Seth Godin teaches us how to adopt a posture of possibility, change the culture, and choose to make a difference. Here are my takeaways from the episode.

In this podcast, Seth discusses the standard measurement used by capitalism and how it impacts our culture.

Capitalism is the simple idea of finding a market with a need, selling something for less than it is worth to the person in that market, and repeating the process. Throughout the last couple of hundreds of years, capitalism has been the primary force that changes the world in many ways.

Capitalism also works like a ratchet. It is a ratchet because people in the market will always try to seek solutions with a better value. A key metric in capitalism is the return on investment. The desire for seeking a better return usually goes in one direction, so it is like a ratchet that can only turn one direction.

Capitalism can also be said to be lazy. It is easy to be lazy when the participants in the market think about winning at capitalism with just one measurement. It is the return against the investment. If we put money into this venture, how much can we get back from the investment?

When we have just one measurement to track when practicing capitalism, it can lead to some problems. It is human nature where if there is just one number to pay attention to, people will develop ways to make that number go up. In many situations, just making one number go up can push people to do things that diminish other factors that also matter in our lives.

Because we do not live in such a simple world anymore, everything we do have side effects somewhere. The ratchet of constantly improving the return can pressure us to ignore everything that does not directly contribute to the return.

Unfortunately, no single solution can solve all problems, and there is no one perfect model. There are only a messy series of choices we have to make if we will be in the business of changing the market, changing the culture, or changing people’s lives.

The alternative is to figure out what is the smallest viable audience that we can serve or influence. What do they care about so I can adapt it to come up with the metrics for that audience? Knowing what the metrics are, how will we scale our creation to make the change we want to make and in a way that we are proud of?

As we can see, whatever practical solution we develop will involve a series of messy and complicated decisions with no one having the right answer. However, this is a beautiful opportunity to make the change we seek to make in the world and do it in a way that makes a difference.

We are not lazy capitalists – we are humans. That means one thing we can do is thinking hard about how we can become agents of change. We can become an agent of change by building something and figuring out how to make something better.

你到底是誰?

(從我一個尊敬的作家,賽斯·高汀

我們有一種慶祝“真實”自我的願望。

但是也許我們的自尊心才是我們真正的自我,當我們盡力做到一致,慷慨和專業時就會表現出來。 那種當我們感到疲倦,壓力大或忙碌時所發出的聲音,只是從我們不完整和次要形式的身份來的。

我們的自我是選擇創建的互動和做出的更改的總和。

Algorithmic Trading Model for Mean-Reversion with Bollinger Bands Strategy Using Python Take 4

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 mean-reversion strategy for a stock. The model enters a position when the price reaches either the upper or lower Bollinger Bands for the last X number of days. The model will exit the trade when the stock price crosses the middle Bollinger Band of the same window size.

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

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

In iteration Take3, we experimented with different Bollinger Band factors from 1.0 to 3.0. The models still used a trend window size for long trades only. The window size varied from 10 to 50 trading days at a 5-day increment.

In this Take4 iteration, we will experiment with different Bollinger Band factors from 1.0 to 3.0. The models will still use a trend window size for long and short trades. The window size varied from 10 to 50 trading days at a 5-day increment.

ANALYSIS: In iteration Take1, we analyzed the stock prices for Costco Wholesale (COST) between January 1, 2016, and April 9, 2021. The top trading model produced a profit of 105.59 dollars per share. The buy-and-hold approach yielded a gain of 201.10 dollars per share.

In iteration Take2, we analyzed the stock prices for Costco Wholesale (COST) between January 1, 2016, and April 9, 2021. The top trading model produced a profit of 70.47 dollars per share. The buy-and-hold approach yielded a gain of 201.10 dollars per share.

In iteration Take3, we analyzed the stock prices for Costco Wholesale (COST) between January 1, 2016, and April 9, 2021. The top trading model produced a profit of 143.20 dollars per share. The buy-and-hold approach yielded a gain of 201.10 dollars per share.

In this Take4 iteration, we analyzed the stock prices for Costco Wholesale (COST) between January 1, 2016, and April 9, 2021. The top trading model produced a profit of 93.93 dollars per share. The buy-and-hold approach yielded a gain of 201.10 dollars per share.

CONCLUSION: For the stock of COST during the modeling time frame, the long-and-short trading strategy with variable Bollinger Band factors 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 Model for Land Use and Land Cover with Sentinel-2 Using TensorFlow Take 6

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 Land Use and Land Cover with Sentinel-2 dataset is a multi-class classification situation where we attempt to predict one of several (more than two) possible outcomes.

INTRODUCTION: This dataset is part of a research study that addresses the challenge of land use and land cover classification using Sentinel-2 satellite images. The research project presented a novel dataset based on Sentinel-2 satellite images covering 13 spectral bands and consisting out of 10 classes within a total of 27,000 labeled and geo-referenced images. The study project also provided benchmarks for this novel dataset with its spectral bands using deep Convolutional Neural Network (CNNs).

In iteration Take1, we constructed a CNN model using a simple three-block VGG architecture and tested the model’s performance using a validation dataset (20%) set aside from the training images.

In iteration Take2, we constructed a CNN model using the DenseNet121 architecture and tested the model’s performance using a validation dataset (20%) set aside from the training images.

In iteration Take3, we constructed a CNN model using the EfficientNetB0 architecture and tested the model’s performance using a validation dataset (20%) set aside from the training images.

In iteration Take4, we will construct a CNN model using the ResNet101 architecture and test the model’s performance using a validation dataset (20%) set aside from the training images.

In iteration Take4, we constructed a CNN model using the ResNet architecture and tested the model’s performance using a validation dataset (20%) set aside from the training images.

In iteration Take5, we constructed a CNN model using the VGG19 architecture and tested the model’s performance using a validation dataset (20%) set aside from the training images.

In this Take6 iteration, we will construct a CNN model using the MobileNetV3Large architecture and test the model’s performance using a validation dataset (20%) set aside from the training images.

ANALYSIS: In iteration Take1, the baseline model’s performance achieved an accuracy score of 98.83% on the training dataset after 20 epochs. Furthermore, the final model achieved an accuracy score of 86.06% on the validation dataset.

In iteration Take2, the DenseNet model’s performance achieved an accuracy score of 99.92% on the training dataset after 20 epochs. Furthermore, the final model achieved an accuracy score of 97.59% on the validation dataset.

In iteration Take3, the EfficientNet model’s performance achieved an accuracy score of 99.89% on the training dataset after 20 epochs. Furthermore, the final model achieved an accuracy score of 96.83% on the validation dataset.

In iteration Take4, the ResNet model’s performance achieved an accuracy score of 99.70% on the training dataset after 20 epochs. Furthermore, the final model achieved an accuracy score of 96.20% on the validation dataset.

In iteration Take5, the VGG19 model’s performance achieved an accuracy score of 99.96% on the training dataset after 20 epochs. Furthermore, the final model achieved an accuracy score of 97.74% on the validation dataset.

In this Take6 iteration, the MobileNetV3Large model’s performance achieved an accuracy score of 99.70% on the training dataset after 20 epochs. Furthermore, the final model achieved an accuracy score of 94.06% on the validation dataset.

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

Dataset Used: Land Use and Land Cover with Sentinel-2

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

Dataset Reference: https://github.com/phelber/eurosat

A potential source of performance benchmarks: https://github.com/phelber/eurosat

The HTML formatted report can be found here on GitHub.