Category : Keras

The popular initializers include RandomNormal distribution function, trancated normal distribution function, GlorotNormal function, HeNormal function and others. This example code show what are these functions and display the probability density functions of these initializers for my reference. Code: import numpy as np import matplotlib.pyplot as plt from scipy.stats import norm x = np.linspace(-10,10,500) #default RandomNormal(mean=0.0, ..

Read more

photograph of a frozen sparkling lake

Activation function is a very important component of machine learning and deep learning. There are three types of Activation Functions: Binary Step Function; Linear Activation Function and Non-Linear Activation Functions. Available activation functions in Keras include relu, sigmoid, softmax, softplus, softsign, tanh, selu, elu and exponential. In addition,user can also create custom activation function.Below is an ..

Read more

beautiful sprawling fantasy vast landscape

Sample code for reducing overfitting problems in deep learning.Answer the following questions: import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler # create range of monthly dates download_dates = pd.date_range(start=’2019-01-01′, end=’2020-01-01′, freq=’MS’) # URL from Chrome DevTools Console base_url = (“https://climate.weather.gc.ca/climate_data/bulk_data_e.html?format=csv&” “stationID=51442&Year={}&Month={}&Day=7&timeframe=1&submit=Download+Data”) # add format option to year ..

Read more

Example code for a regression model with multiple layers. In addition to the input of the first layer, it keeps adding new inputs to the later layers. Prepare data import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler # create range of monthly dates download_dates = pd.date_range(start=’2019-01-01′, end=’2020-01-01′, ..

Read more

deep ocean scape

Simple example code on hyperparameter optimization for DNN regression models. Prepare data import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler # create range of monthly dates download_dates = pd.date_range(start=’2019-01-01′, end=’2020-01-01′, freq=’MS’) # URL from Chrome DevTools Console base_url = (“https://climate.weather.gc.ca/climate_data/bulk_data_e.html?format=csv&” “stationID=51442&Year={}&Month={}&Day=7&timeframe=1&submit=Download+Data”) # add format option to year ..

Read more

trees in spring, summer, autumn and winter

Example code for developing a regression model with keras. It can also answer following questions: Prepare data Read data import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.model_selection import train_test_split # create range of monthly dates download_dates = pd.date_range(start=’2019-01-01′, end=’2020-01-01′, freq=’MS’) # URL from Chrome DevTools Console base_url = (“https://climate.weather.gc.ca/climate_data/bulk_data_e.html?format=csv&” ..

Read more