configure the learning process by choosing loss functionan optimizerand some metrics to monitor iterate on your training data by calling the fit(method of your model there are two ways to define modelusing the sequential class (only for linear stacks of layerswhich is the most common network architecture by faror the functional api (for directed acyclic graphs of layerswhich lets you build completely arbitrary architecturesas refresherhere' two-layer model defined using the sequential class (note that we're passing the expected shape of the input data to the first layer)from keras import models from keras import layers model models sequential(model add(layers dense( activation='relu'input_shape=( ,))model add(layers dense( activation='softmax')and here' the same model defined using the functional apiinput_tensor layers input(shape=( ,) layers dense( activation='relu')(input_tensoroutput_tensor layers dense( activation='softmax')(xmodel models model(inputs=input_tensoroutputs=output_tensorwith the functional apiyou're manipulating the data tensors that the model processes and applying layers to this tensor as if they were functions detailed guide to what you can do with the functional api can be found in until we'll only be using the sequential class in our code examples note once your model architecture is definedit doesn' matter whether you used sequential model or the functional api all of the following steps are the same the learning process is configured in the compilation stepwhere you specify the optimizer and loss function(sthat the model should useas well as the metrics you want to monitor during training here' an example with single loss functionwhich is by far the most common casefrom keras import optimizers model compile(optimizer=optimizers rmsprop(lr= )loss='mse'metrics=['accuracy']finallythe learning process consists of passing numpy arrays of input data (and the corresponding target datato the model via the fit(methodsimilar to what you would do in scikit-learn and several other machine-learning librariesmodel fit(input_tensortarget_tensorbatch_size= epochs= licensed to