DEV Community

Junissen
Junissen

Posted on

Math + Python = Love

I recommende you, when creating a solution, think necessarily in context mathematical statement. Becouse of:

  1. It's easily save project boundaries, while you coding thought
  2. There're more opportunity for maneuver in space of programme

Image description

Cross-entropy for AI help train a neural network in best practice each era. Often used different Math construction, like stochastic descent method.

Image description

Weight coefficient map focus our characterictics neural network in a right way. For avoiding gross errors in the resulting values.

best_w = keras.callbacks.ModelCheckpoint('unet_best.h5', 
                                monitor='val_loss',
                                verbose=0,
                                save_best_only=True,
                                save_weights_only=True,
                                mode='auto',
                                period=1)

last_w = keras.callbacks.ModelCheckpoint('unet_last.h5',
                                monitor='val_loss',
                                verbose=0,
                                save_best_only=False,
                                save_weights_only=True,
                                mode='auto',
                                period=1)

callbacks = [best_w, last_w]

Enter fullscreen mode Exit fullscreen mode

It's better to create already 2 lists: best and last weights of model. This will be useful when calculating the error value.

Finish result looks, like:

Image description

Top comments (0)