Do you want BuboFlash to help you learning these things? Click here to log in or create user.

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

r example: Use pandas get_dummies() function insurance_one_hot = pd.get_dummies(insurance,dtype="int32") #to avoid bool which generate problem with model fitting in TensorFlow insurance_one_hot <span># Create X and y values (features and labels) y = insurance_one_hot['charges'] X = insurance_one_hot.drop('charges', axis=1) #y = y.values # This is not necessary #X = X.values #X, y, X.shape, y.shape # Create training and test datasets #my way: from sklearn.model_selection import train_test_split X_train, X_

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

Preprocessing data ct = make_column_transformer((OneHotEncoder(dtype="int32"), ['Sex']), remainder="passthrough") #other columns unchangaed ct.fit(X_train) X_train_transformed = ct.transform(X_train) X_test_transformed = ct.transform(X_test)

Preprocessing data ct = make_column_transformer((OneHotEncoder(dtype="int32"), ['Sex']), remainder="passthrough") #other columns unchangaed ct.fit(X_train) X_train_transformed = ct.transform(X_train) X_test_transformed = ct.transform(X_test) Predictions valuation_predicts = model.predict(X_valuation_transformed) (array([[ 9.441547], [10.451973], [10.48082 ], ..., [10.401164], [13.13452 ], [ 8.081818]], dtype=float32), (6041

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

Take away: You should minimize the time between your experiments (that's way you should start with smaller models). The more experiments you do, the more things you figure out that don't work. <span>Tracking your experiments One really good habit is to track the results of your experiments. There are tools to help us! Resource: Try: Tensorboard - a component of Tensorflow library to help track modelling experiments Weights & Biases Saving and loading models Two formats: SavedModel format (including optimizer's step) HDF5 format What about TensorFlow Serving format? # Save the entire model using SavedModel model_3

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

Multiclass classification - a sample can be assigned to one label but from more than 2 label options

ms Three types of classification problems: binary classification multiclass multilabel Multilabel classification - a sample can be assigned to more than one label from more than 2 label options <span>Multiclass classification - a sample can be assigned to one label but from more than 2 label options Multiclass image classificaton: pizza, steak, sushi Input_shape = [None, 224, 224, 3] - single image Input shape = [32, 224, 224, 3] - common batch size of images 32 is a common batch s

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

MAE tf.keras.losses.MAE() tf.metrics.mean_absolute_error() great starter metrics for any regression problem

st_labels, c="green", label="Testing data") plt.scatter(test_data, predictions, c="red", label="Predictions") plt.legend(); Common regression evaluation metrics keyboard_arrow_down Introduction <span>For regression problems: MAE tf.keras.losses.MAE() tf.metrics.mean_absolute_error() great starter metrics for any regression problem MSE tf.keras.losses.MSE() tf.metrics.mean_square_error() when larger errors are more significant that smaller errors Huber tf.keras.losses.Huber() combintion of MSE and MAE less sensitive to outliers than MSE Take away: You should minimize the time between your experiments (that's way you should start with smaller models). The more experiments you do, the more things you figure out that don't work. Tracking your experiments One really good habit is to track the results of your experiments. There are tools to help us! Resource: Try: Tensorboard - a component of Tensorflow library t

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

How we can improve model (in the particular stage of the process)? # 2. Compiling: change optimizer or its parameters (eg. learning rate)

#### How we can improve model # 1. Creating model: add more layers, increase numbers of hidden neurons, change activation functions # 2. Compiling: change optimizer or its parameters (eg. learning rate) # 3. Fitting: more epochs, more data ### How? # from smaller model to larger model Evaluating models Typical workflow: build a model -> fit it -> evaulate -> tweak -> fit > evaluate -> .... Building model: experiment Evaluation model: visualize What

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

# Create X and y values (features and labels) y = insurance_one_hot['charges'] X = insurance_one_hot.drop('charges', axis=1)

r example: Use pandas get_dummies() function insurance_one_hot = pd.get_dummies(insurance,dtype="int32") #to avoid bool which generate problem with model fitting in TensorFlow insurance_one_hot <span># Create X and y values (features and labels) y = insurance_one_hot['charges'] X = insurance_one_hot.drop('charges', axis=1) #y = y.values # This is not necessary #X = X.values #X, y, X.shape, y.shape # Create training and test datasets #my way: from sklearn.model_selection import train_test_split X_train, X_

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

Saving and loading models Two formats: SavedModel format (including optimizer's step) HDF5 format

is to track the results of your experiments. There are tools to help us! Resource: Try: Tensorboard - a component of Tensorflow library to help track modelling experiments Weights & Biases <span>Saving and loading models Two formats: SavedModel format (including optimizer's step) HDF5 format What about TensorFlow Serving format? # Save the entire model using SavedModel model_3.save("best_model_3_SavedModel") # SavedModel is in principle protobuff)pb file # Save model in HDF5 format: model_3.save("best_model_3_HDF5.h5") Load model loaded_model_SM = tf.keras.models.load_model('/content/best_model_3_SavedModel') loaded_model_SM.summary() <span>

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

nsurance_one_hot # Create X and y values (features and labels) y = insurance_one_hot['charges'] X = insurance_one_hot.drop('charges', axis=1) #y = y.values # This is not necessary #X = X.values <span>#X, y, X.shape, y.shape # Create training and test datasets #my way: from sklearn.model_selection import train_test_split X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state=42) Preprocessing data (normalization and standardization) Preprocessing steps: Turn all data into numbers Make sure your tensors are in the right shape Scale features (normalize or standardize) Neural networks tend to pre

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

ape # Create training and test datasets #my way: from sklearn.model_selection import train_test_split X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state=42) <span>Preprocessing data (normalization and standardization) Preprocessing steps: Turn all data into numbers Make sure your tensors are in the right shape Scale features (normalize or standardize) Neural networks tend to prefer normalization. Normalization - adjusting values measured on different scales to a notionally common scale Normalization # Start from scratch import pandas as pd import matplotlib.pyplot as plt import tensorflow as tf ## Borrow a few classes from sci-kit learn from sklearn.compose import mak

status | not read | reprioritisations | ||
---|---|---|---|---|

last reprioritisation on | suggested re-reading day | |||

started reading on | finished reading on |

For regression problems: MAE tf.keras.losses.MAE() tf.metrics.mean_absolute_error() great starter metrics for any regression problem MSE tf.keras.losses.MSE() tf.metrics.mean_square_error() when larger errors are more significant that smaller errors Huber tf.keras.losses.Huber() combintion of MSE and MAE less sensitive to outliers than MSE Take away: You should minimize the time between your experiments (that's way you should start

st_labels, c="green", label="Testing data") plt.scatter(test_data, predictions, c="red", label="Predictions") plt.legend(); Common regression evaluation metrics keyboard_arrow_down Introduction <span>For regression problems: MAE tf.keras.losses.MAE() tf.metrics.mean_absolute_error() great starter metrics for any regression problem MSE tf.keras.losses.MSE() tf.metrics.mean_square_error() when larger errors are more significant that smaller errors Huber tf.keras.losses.Huber() combintion of MSE and MAE less sensitive to outliers than MSE Take away: You should minimize the time between your experiments (that's way you should start with smaller models). The more experiments you do, the more things you figure out that don't work. Tracking your experiments One really good habit is to track the results of your experiments. There are tools to help us! Resource: Try: Tensorboard - a component of Tensorflow library t

status | not learned | measured difficulty | 37% [default] | last interval [days] | |||
---|---|---|---|---|---|---|---|

repetition number in this series | 0 | memorised on | scheduled repetition | ||||

scheduled repetition interval | last repetition or drill |

Typical workflow: build a model -> fit it -> evaulate -> tweak -> fit > evaluate -> ....

activation functions # 2. Compiling: change optimizer or its parameters (eg. learning rate) # 3. Fitting: more epochs, more data ### How? # from smaller model to larger model Evaluating models <span>Typical workflow: build a model -> fit it -> evaulate -> tweak -> fit > evaluate -> .... Building model: experiment Evaluation model: visualize What can visualize? the data model itself the training of a model predictions ## The 3 sets (or actually 2 sets: training and test