1
$\begingroup$

So after you train your model with millions of rows of data, what is the model being saved in disk look like? Is it file with millions of weights and biases that would do the best predictions?

$\endgroup$
3
  • 1
    $\begingroup$ the question seems a bit general to me, may vary by model and implementation, and how it is pickled. $\endgroup$
    – Frankstr
    Commented Apr 10, 2018 at 7:21
  • 1
    $\begingroup$ Which deep learning model? All neural nets models do not have the same structure $\endgroup$
    – Dawny33
    Commented Apr 10, 2018 at 9:09
  • 1
    $\begingroup$ Just one example of any model is helpful. $\endgroup$
    – Andy
    Commented Apr 10, 2018 at 20:03

2 Answers 2

5
$\begingroup$

Yes you are right. It depends on which frameworks you are using for training the model.

For example, if you use tensorflow framework, the trained model will be saved into several files. You can save and load model into two ways:

  • Checkpoint
  • Savedmodel (freeze)

Please check this link. Here

In keras, Model weights are saved to HDF5 format. This is a grid format that is ideal for storing multi-dimensional arrays of numbers. you can save and load your model to file:

  1. Save Model to JSON.
  2. Save Model to YAML.

The JSON format of the model looks like the following:

    {  
   "keras_version":"2.0.2",
   "backend":"theano",
   "config":[  
      {  
     "config":{  
        "dtype":"float32",
        "bias_regularizer":null,
        "activation":"relu",
        "bias_constraint":null,
        "use_bias":true,
        "bias_initializer":{  
           "config":{  

           },
           "class_name":"Zeros"
        },
        "kernel_regularizer":null,
        "activity_regularizer":null,
        "kernel_constraint":null,
        "trainable":true,
        "name":"dense_1",
        "kernel_initializer":{  
           "config":{  
              "maxval":0.05,
              "minval":-0.05,
              "seed":null
           },
           "class_name":"RandomUniform"
        },
        "batch_input_shape":[  
           null,
           8
        ],
        "units":12
     },
     "class_name":"Dense"
  },
  {  
     "config":{  
        "kernel_regularizer":null,
        "bias_regularizer":null,
        "activation":"relu",
        "bias_constraint":null,
        "use_bias":true,
        "bias_initializer":{  
           "config":{  

           },
           "class_name":"Zeros"
        },
        "activity_regularizer":null,
        "kernel_constraint":null,
        "trainable":true,
        "name":"dense_2",
        "kernel_initializer":{  
           "config":{  
              "maxval":0.05,
              "minval":-0.05,
              "seed":null
           },
           "class_name":"RandomUniform"
        },
        "units":8
     },
     "class_name":"Dense"
  },
  {  
     "config":{  
        "kernel_regularizer":null,
        "bias_regularizer":null,
        "activation":"sigmoid",
        "bias_constraint":null,
        "use_bias":true,
        "bias_initializer":{  
           "config":{  

           },
           "class_name":"Zeros"
        },
        "activity_regularizer":null,
        "kernel_constraint":null,
        "trainable":true,
        "name":"dense_3",
        "kernel_initializer":{  
           "config":{  
              "maxval":0.05,
              "minval":-0.05,
              "seed":null
           },
           "class_name":"RandomUniform"
        },
        "units":1
     },
     "class_name":"Dense"
  }

   ],
   "class_name":"Sequential"
}
$\endgroup$
0
$\begingroup$

It depends, there is no general rule. Can be as simple as a List or a JSON File though.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.