This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trained_model = model.fit(X_train, y_train, epochs=1000, verbose=False) | |
| print("Finished training the model") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import matplotlib.pyplot as plt | |
| plt.xlabel('Epoch Number') | |
| plt.ylabel("Loss Magnitude") | |
| plt.plot(trained_model.history['loss']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print(model.predict([80.0])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| y_pred = model.predict(X_test) | |
| print('Actual Values\tPredicted Values') | |
| print(y_test,' ',y_pred.reshape(1,-1)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from sklearn.metrics import r2_score | |
| r2_score(y_test,y_pred) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| l_0 = tf.keras.layers.Dense(units=4, input_shape=[1]) | |
| l_1 = tf.keras.layers.Dense(units=5) | |
| l_2 = tf.keras.layers.Dense(units=1) | |
| model = tf.keras.Sequential([l_0, l_1, l_2]) | |
| model.compile(loss='mean_squared_error', optimizer=tf.keras.optimizers.Adam(0.1)) | |
| model.fit(X_train,y_train, epochs=2000,verbose=False) | |
| print('\n Finished training Model') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| print(model.predict([80])) | |
| y_pred=model.predict(X_test) | |
| print(r2_score(y_test,y_pred)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os, cv2, random | |
| import numpy as np | |
| import pandas as pd | |
| %pylab inline | |
| import matplotlib.pyplot as plt | |
| import matplotlib.image as mpimg | |
| from matplotlib import ticker | |
| import seaborn as sns | |
| %matplotlib inline |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # loading labels for each image from csv | |
| labels = pd.read_csv('results.csv') | |
| labels = labels.iloc[:,0:2] | |
| labels.head() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Separating male labels | |
| male_data = labels[labels['Gender'] == 0] | |
| male_data.head() |