ÎncepețiÎncepe gratuit

Abordarea de nivel scăzut cu exemple multiple

În acest exercițiu, vom aprofunda înțelegerea abordării de nivel scăzut construind primul strat ascuns dens pentru cazul în care avem mai multe exemple. Vom presupune că modelul este antrenat și că ponderile primului strat, weights1, și bias-ul, bias1, sunt disponibile. Vom efectua înmulțirea matriceală a tensorului borrower_features cu variabila weights1. Reamintim că tensorul borrower_features include educația, statutul marital și vârsta. În final, vom aplica funcția sigmoid elementelor din products1 + bias1, obținând dense1.

\(products1 = \begin{bmatrix} 3 & 3 & 23 \\ 2 & 1 & 24 \\ 1 & 1 & 49 \\ 1 & 1 & 49 \\ 2 & 1 & 29 \end{bmatrix} \begin{bmatrix} -0.6 & 0.6 \\ 0.8 & -0.3 \\ -0.09 & -0.08 \end{bmatrix}\)

Reține că matmul() și keras() au fost importate din tensorflow.

Acest exercițiu face parte din cursul

Introducere în TensorFlow în Python

Vezi cursul

Instrucțiuni pentru exercițiu

  • Calculează products1 înmulțind matriceal tensorul de caracteristici cu ponderile.
  • Aplică funcția de activare sigmoid pentru a transforma products1 + bias1.
  • Afișează formele tensorilor borrower_features, weights1, bias1 și dense1.

Exercițiu interactiv practic

Încearcă acest exercițiu completând acest cod de exemplu.

# Compute the product of borrower_features and weights1
products1 = ____

# Apply a sigmoid activation function to products1 + bias1
dense1 = ____

# Print the shapes of borrower_features, weights1, bias1, and dense1
print('\n shape of borrower_features: ', borrower_features.shape)
print('\n shape of weights1: ', ____.shape)
print('\n shape of bias1: ', ____.shape)
print('\n shape of dense1: ', ____.shape)
Editează și rulează codul