Skip to main content

A machine learning tool to classify complex datasets based on ontologies

Project description


DeepOC is the core of BioModel Classifier - the python application to classify biomodels automatically using Deep Neural Network. DeepOC provides some very low level functions for classifying model based on ontology, which allow us to adapt to any other projects.


pip install deepoc


First, you need a ground truth dataset, which is a dict of model and list of it's corresponding ontologies

    "model_1": ["GO:00001", "GO:00003", "GO:00002"],
    "model_2: ["GO:00004", "GO:00002"]

To generate dataset and train DNN model:

ground_truth = ...
train_file = "path/to/your train csv file"
test_file = "path/to/your test csv file"
val_file = "path/to/your val csv file"
features = deepoc.build_features(ground_truth)

# Picking the first 300 features  
selected_features = [feature['feature'] for idx, feature in enumerate(features) if idx < 300]

train, test, val = deepoc.generate_dataset(ground_truth, features, classes)

# Writing dataset to file  
deepoc.write_dataset_to_file(train, train_file)  
deepoc.write_dataset_to_file(test, test_file)  
deepoc.write_dataset_to_file(val, val_file)

# Configure DNN model to use Gradient Descent optimizer, 1 hidden layer with 150 nodes, learning rate of 0.001 and dropout rate of 0.5
classifier = DeepOCClassifier(workspace, 'GD', [150], 0.001, train_file, test_file, classes, 0.5)
# Train the model with 3000 epoch, validate every 10 epochs and batch size of 16
classifier.train_dll_model(3000, 10, 16)

# Validate the result:
for record in val:
    model = record['model']
    predict_result = classifier.predict(record)'Model %s: %s', model, predict_result)

More examples can be found in tests folder.

Classify model based on any ontology other than Gene Ontology

To make this library work with other kind of ontology, implement the OntologyService according to your ontology and instantize your object at




Biological Model Classifier source code is distributed under the GNU Affero General Public License.
Please read license.txt for information on the software availability and distribution.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deepoc-1.1.4.tar.gz (10.1 kB view hashes)

Uploaded source

Built Distribution

deepoc-1.1.4-py3-none-any.whl (13.6 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page