Model

Available models

[source]

KerasModel

kipoi.model.KerasModel(weights, arch=None, custom_objects=None, backend=None, image_dim_ordering=None)

Loads the serialized Keras model

Arguments

  • weights: File path to the hdf5 weights or the hdf5 Keras model
  • arch: Architecture json model. If None, weights is assumed to speficy the whole model
  • custom_objects: Python file defining the custom Keras objects in a OBJECTS dictionary
  • backend: Keras backend to use ('tensorflow', 'theano', ...)
  • image_dim_ordering: 'tf' or 'th': Whether to use 'tf' ('channels_last') or 'th' ('cannels_first') dimension ordering.

model.yml entry

- __Model__:
  - __type__: Keras
  - __args__:
    - __weights__: model.h5
    - __arch__: model.json
    - __custom_objects__: custom_keras_objects.py

[source]

PyTorchModel

kipoi.model.PyTorchModel(file=None, build_fn=None, weights=None, auto_use_cuda=True)

Loads a pytorch model.


[source]

SklearnModel

kipoi.model.SklearnModel(pkl_file, predict_method='predict')

Loads the serialized scikit learn model

Arguments

  • pkl_file: File path to the dumped sklearn file in the pickle format.

model.yml entry

- __Model__:
  - __type__: sklearn
  - __args__:
    - __pkl_file__: asd.pkl
    - __predict_method__: Which prediction method to use. Available options:
       'predict', 'predict_proba' or 'predict_log_proba'.

[source]

TensorFlowModel

kipoi.model.TensorFlowModel(input_nodes, target_nodes, checkpoint_path, const_feed_dict_pkl=None)

get_model

get_model(model, source='kipoi', with_dataloader=True)

Load the model from source, as well as the default dataloder to model.default_dataloder.

  • Args: model, str: model name source, str: source name with_dataloader, bool: if True, the default dataloader is loaded to model.default_dataloadera and the pipeline at model.pipeline enabled.