Tag Archives: data science from scratch

Data Analytics – GGPLOT AXIS LIMITS AND SCALES

GGPLOT AXIS LIMITS AND SCALES   This article describes R functions for changing ggplot axis limits (or scales). We’ll describe how to specify the minimum and the maximum values of axes. Among the different functions available in ggplot2 for setting the axis range, the coord_cartesian() function is the most preferred, because it zoom the plot without clipping the data. In …

Learn Keras by Example – How to Visualize Loss History

Visualize Loss History Preliminaries /* Load libraries */ import numpy as np from keras.datasets import imdb from keras.preprocessing.text import Tokenizer from keras import models from keras import layers import matplotlib.pyplot as plt /* Set random seed */ np.random.seed(0) Using TensorFlow backend. Load Movie Review Data /* Set the number of features we want */ number_of_features …

Learn Keras by Example – Preprocessing Data For Neural Networks

Preprocessing Data For Neural Networks Typically, a neural network’s parameters are initialized (i.e. created) as small random numbers. Neural networks often behave poorly when the feature values much larger than parameter values. Furthermore, since an observation’s feature values will are combined as they pass through individual units, it is important that all features have the …

Learn Keras by Example – How to do Neural Network Weight Regularization

Neural Network Weight Regularization Preliminaries /* Load libraries */ import numpy as np from keras.datasets import imdb from keras.preprocessing.text import Tokenizer from keras import models from keras import layers from keras import regularizers /* Set random seed */ np.random.seed(0) Using TensorFlow backend. Load Movie Review Text Data /* Set the number of features we want …

Learn Keras by Example – How to do Neural Network Early Stopping

Neural Network Early Stopping Preliminaries /* Load libraries */ import numpy as np from keras.datasets import imdb from keras.preprocessing.text import Tokenizer from keras import models from keras import layers from keras.callbacks import EarlyStopping, ModelCheckpoint /* Set random seed */ np.random.seed(0) Using TensorFlow backend. Load Movie Review Text Data /* Set the number of features we …

Learn Keras by Example – How to Build LSTM Recurrent Neural Network

LSTM Recurrent Neural Network Oftentimes we have text data that we want to classify. While it is possible to use a type of convolutional network, we are going to focus on a more popular option: the recurrent neural network. The key feature of recurrent neural networks is that information loops back in the network. This …

Machine Learning for Beginners in Python: How to Build Feedforward Neural Networks For Regression

Feed forward Neural Networks For Regression Preliminaries /* Load libraries */ import numpy as np from keras.preprocessing.text import Tokenizer from keras import models from keras import layers from sklearn.datasets import make_regression from sklearn.model_selection import train_test_split from sklearn import preprocessing /* Set random seed */ np.random.seed(0) Using TensorFlow backend. Generate Training Data /* Generate features matrix …

Machine Learning for Beginners in Python: How to Build Feedforward Neural Network For Multiclass Classification

Feedforward Neural Network For Multiclass Classification Preliminaries /* Load libraries */ import numpy as np from keras.datasets import reuters from keras.utils.np_utils import to_categorical from keras.preprocessing.text import Tokenizer from keras import models from keras import layers /* Set random seed */ np.random.seed(0) Using TensorFlow backend. Load Movie Review Data /* Set the number of features we …

Machine Learning for Beginners in Python: How to Build Feedforward Neural Network For Binary Classification

Feedforward Neural Network For Binary Classification Preliminaries /* Load libraries */ import numpy as np from keras.datasets import imdb from keras.preprocessing.text import Tokenizer from keras import models from keras import layers /* Set random seed */ np.random.seed(0) Using TensorFlow backend. Load Movie Review Data /* Set the number of features we want */ number_of_features = …

Learn Keras by Example – How to Add Dropout Layers

Adding Dropout Preliminaries /* Load libraries */ import numpy as np from keras.datasets import imdb from keras.preprocessing.text import Tokenizer from keras import models from keras import layers /* Set random seed */ np.random.seed(0) Using TensorFlow backend. Load IMDB Movie Review Data /* Set the number of features we want */ number_of_features = 1000 /* Load …