Update RNN.ipynb
This commit is contained in:
parent
77d1f457e4
commit
b066534c6d
|
@ -50,7 +50,7 @@
|
||||||
"metadata": {}
|
"metadata": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "python",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"source": [
|
"source": [
|
||||||
"# import the whole modules\n",
|
"# import the whole modules\n",
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
"metadata": {}
|
"metadata": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "python",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"source": [
|
"source": [
|
||||||
"# Configuration file of model parameters\n",
|
"# Configuration file of model parameters\n",
|
||||||
|
@ -121,7 +121,7 @@
|
||||||
"metadata": {}
|
"metadata": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "python",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"source": [
|
"source": [
|
||||||
"# Word token builds a one hot dictionary, and then inputs it to the embedding layer to obtain the corresponding word information matrix\n",
|
"# Word token builds a one hot dictionary, and then inputs it to the embedding layer to obtain the corresponding word information matrix\n",
|
||||||
|
@ -187,7 +187,7 @@
|
||||||
"metadata": {}
|
"metadata": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "python",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"source": [
|
"source": [
|
||||||
"# Functions required for preprocessing\n",
|
"# Functions required for preprocessing\n",
|
||||||
|
@ -280,7 +280,7 @@
|
||||||
"metadata": {}
|
"metadata": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "python",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"source": [
|
"source": [
|
||||||
"# Preprocess\n",
|
"# Preprocess\n",
|
||||||
|
@ -349,7 +349,7 @@
|
||||||
"metadata": {}
|
"metadata": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "python",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"source": [
|
"source": [
|
||||||
"# pytorch construct Dataset\n",
|
"# pytorch construct Dataset\n",
|
||||||
|
@ -414,7 +414,7 @@
|
||||||
"metadata": {}
|
"metadata": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "python",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"source": [
|
"source": [
|
||||||
"# embedding layer\n",
|
"# embedding layer\n",
|
||||||
|
@ -462,7 +462,7 @@
|
||||||
"metadata": {}
|
"metadata": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "python",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"source": [
|
"source": [
|
||||||
"# Gelu activation function, specified by transformer, works better than relu\n",
|
"# Gelu activation function, specified by transformer, works better than relu\n",
|
||||||
|
@ -477,7 +477,7 @@
|
||||||
"metadata": {}
|
"metadata": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "python",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"source": [
|
"source": [
|
||||||
"#rnn model\n",
|
"#rnn model\n",
|
||||||
|
@ -554,7 +554,7 @@
|
||||||
"metadata": {}
|
"metadata": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "python",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"source": [
|
"source": [
|
||||||
"# p,r,f1 measurement\n",
|
"# p,r,f1 measurement\n",
|
||||||
|
@ -586,7 +586,7 @@
|
||||||
"metadata": {}
|
"metadata": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "python",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"source": [
|
"source": [
|
||||||
"# Iteration in training process\n",
|
"# Iteration in training process\n",
|
||||||
|
@ -652,7 +652,7 @@
|
||||||
"metadata": {}
|
"metadata": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "python",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"source": [
|
"source": [
|
||||||
"# Load dataset\n",
|
"# Load dataset\n",
|
||||||
|
@ -668,7 +668,7 @@
|
||||||
"metadata": {}
|
"metadata": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "python",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"source": [
|
"source": [
|
||||||
"# After the preprocessed data is loaded, vocab_size is known\n",
|
"# After the preprocessed data is loaded, vocab_size is known\n",
|
||||||
|
@ -680,7 +680,7 @@
|
||||||
"metadata": {}
|
"metadata": {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"cell_type": "python",
|
"cell_type": "code",
|
||||||
"execution_count": null,
|
"execution_count": null,
|
||||||
"source": [
|
"source": [
|
||||||
"# main entry, define optimization function, loss function and so on\n",
|
"# main entry, define optimization function, loss function and so on\n",
|
||||||
|
|
Loading…
Reference in New Issue