{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Example : k times repetition with the list of k input files \n",
"\n",
"DeepBiome package takes microbiome abundance data as input and uses the phylogenetic taxonomy to guide the decision of the optimal number of layers and neurons in the deep learning architecture.\n",
"\n",
"To use DeepBiome, you can experiment (1) __k times repetition__ or (2) __k fold cross-validation__.\n",
"For each experiment, we asuume that the dataset is given by\n",
"- __A list of k input files for k times repetition.__\n",
"- __One input file for k fold cross-validation.__\n",
"\n",
"This notebook contains an example of (1) __k times repetition__ for the deep neural netowrk using deepbiome."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1. Load library\n",
"\n",
"First, we load the DeepBiome package. The DeepBiome package is built on the tensorflow and keras library"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Using TensorFlow backend.\n"
]
}
],
"source": [
"import os\n",
"import logging\n",
"import json\n",
"from pkg_resources import resource_filename\n",
"\n",
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"\n",
"pd.set_option('display.float_format', lambda x: '%.03f' % x)\n",
"np.set_printoptions(formatter={'float_kind':lambda x: '%.03f' % x})\n",
"\n",
"from deepbiome import deepbiome"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2. Prepare the dataset\n",
"\n",
"In this example, we assume that we have __a list of k input files for k times repetition.__\n",
"\n",
"DeepBiome needs 4 data files as follows:\n",
"1. __the tree information__\n",
"1. __the lists of the input files__ (each file has all sample's information for one repetition)\n",
"1. __the list of the names of input files__ \n",
"1. __y__\n",
"\n",
"In addition, we can set __the training index for each repetition__. If we set the index file, DeepBiome builds the training set for each repetition based on each column of the index file. If not, DeepBiome will generate the index file locally.\n",
"\n",
" \n",
"Each data should have the csv format as follow:"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Example of the tree information\n",
"\n",
"First we need a file about the phylogenetic tree information. This tree information file should have the format below:"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Genus | \n",
" Family | \n",
" Order | \n",
" Class | \n",
" Phylum | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" Streptococcus | \n",
" Streptococcaceae | \n",
" Lactobacillales | \n",
" Bacilli | \n",
" Firmicutes | \n",
"
\n",
" \n",
" 1 | \n",
" Tropheryma | \n",
" Cellulomonadaceae | \n",
" Actinomycetales | \n",
" Actinobacteria | \n",
" Actinobacteria | \n",
"
\n",
" \n",
" 2 | \n",
" Veillonella | \n",
" Veillonellaceae | \n",
" Selenomonadales | \n",
" Negativicutes | \n",
" Firmicutes | \n",
"
\n",
" \n",
" 3 | \n",
" Actinomyces | \n",
" Actinomycetaceae | \n",
" Actinomycetales | \n",
" Actinobacteria | \n",
" Actinobacteria | \n",
"
\n",
" \n",
" 4 | \n",
" Flavobacterium | \n",
" Flavobacteriaceae | \n",
" Flavobacteriales | \n",
" Flavobacteria | \n",
" Bacteroidetes | \n",
"
\n",
" \n",
" 5 | \n",
" Prevotella | \n",
" Prevotellaceae | \n",
" Bacteroidales | \n",
" Bacteroidia | \n",
" Bacteroidetes | \n",
"
\n",
" \n",
" 6 | \n",
" Porphyromonas | \n",
" Porphyromonadaceae | \n",
" Bacteroidales | \n",
" Bacteroidia | \n",
" Bacteroidetes | \n",
"
\n",
" \n",
" 7 | \n",
" Parvimonas | \n",
" Clostridiales_Incertae_Sedis_XI | \n",
" Clostridiales | \n",
" Clostridia | \n",
" Firmicutes | \n",
"
\n",
" \n",
" 8 | \n",
" Fusobacterium | \n",
" Fusobacteriaceae | \n",
" Fusobacteriales | \n",
" Fusobacteria | \n",
" Fusobacteria | \n",
"
\n",
" \n",
" 9 | \n",
" Propionibacterium | \n",
" Propionibacteriaceae | \n",
" Actinomycetales | \n",
" Actinobacteria | \n",
" Actinobacteria | \n",
"
\n",
" \n",
" 10 | \n",
" Gemella | \n",
" Bacillales_Incertae_Sedis_XI | \n",
" Bacillales | \n",
" Bacilli | \n",
" Firmicutes | \n",
"
\n",
" \n",
" 11 | \n",
" Rothia | \n",
" Micrococcaceae | \n",
" Actinomycetales | \n",
" Actinobacteria | \n",
" Actinobacteria | \n",
"
\n",
" \n",
" 12 | \n",
" Granulicatella | \n",
" Carnobacteriaceae | \n",
" Lactobacillales | \n",
" Bacilli | \n",
" Firmicutes | \n",
"
\n",
" \n",
" 13 | \n",
" Neisseria | \n",
" Neisseriaceae | \n",
" Neisseriales | \n",
" Betaproteobacteria | \n",
" Proteobacteria | \n",
"
\n",
" \n",
" 14 | \n",
" Lactobacillus | \n",
" Lactobacillaceae | \n",
" Lactobacillales | \n",
" Bacilli | \n",
" Firmicutes | \n",
"
\n",
" \n",
" 15 | \n",
" Megasphaera | \n",
" Veillonellaceae | \n",
" Selenomonadales | \n",
" Negativicutes | \n",
" Firmicutes | \n",
"
\n",
" \n",
" 16 | \n",
" Catonella | \n",
" Lachnospiraceae | \n",
" Clostridiales | \n",
" Clostridia | \n",
" Firmicutes | \n",
"
\n",
" \n",
" 17 | \n",
" Atopobium | \n",
" Coriobacteriaceae | \n",
" Coriobacteriales | \n",
" Actinobacteria | \n",
" Actinobacteria | \n",
"
\n",
" \n",
" 18 | \n",
" Campylobacter | \n",
" Campylobacteraceae | \n",
" Campylobacterales | \n",
" Epsilonproteobacteria | \n",
" Proteobacteria | \n",
"
\n",
" \n",
" 19 | \n",
" Capnocytophaga | \n",
" Flavobacteriaceae | \n",
" Flavobacteriales | \n",
" Flavobacteria | \n",
" Bacteroidetes | \n",
"
\n",
" \n",
" 20 | \n",
" Solobacterium | \n",
" Erysipelotrichaceae | \n",
" Erysipelotrichales | \n",
" Erysipelotrichia | \n",
" Firmicutes | \n",
"
\n",
" \n",
" 21 | \n",
" Moryella | \n",
" Lachnospiraceae | \n",
" Clostridiales | \n",
" Clostridia | \n",
" Firmicutes | \n",
"
\n",
" \n",
" 22 | \n",
" TM7_genera_incertae_sedis | \n",
" TM7_genera_incertae_sedis | \n",
" TM7_genera_incertae_sedis | \n",
" TM7_genera_incertae_sedis | \n",
" TM7 | \n",
"
\n",
" \n",
" 23 | \n",
" Staphylococcus | \n",
" Staphylococcaceae | \n",
" Bacillales | \n",
" Bacilli | \n",
" Firmicutes | \n",
"
\n",
" \n",
" 24 | \n",
" Filifactor | \n",
" Peptostreptococcaceae | \n",
" Clostridiales | \n",
" Clostridia | \n",
" Firmicutes | \n",
"
\n",
" \n",
" 25 | \n",
" Oribacterium | \n",
" Lachnospiraceae | \n",
" Clostridiales | \n",
" Clostridia | \n",
" Firmicutes | \n",
"
\n",
" \n",
" 26 | \n",
" Burkholderia | \n",
" Burkholderiaceae | \n",
" Burkholderiales | \n",
" Betaproteobacteria | \n",
" Proteobacteria | \n",
"
\n",
" \n",
" 27 | \n",
" Sneathia | \n",
" Leptotrichiaceae | \n",
" Fusobacteriales | \n",
" Fusobacteria | \n",
" Fusobacteria | \n",
"
\n",
" \n",
" 28 | \n",
" Treponema | \n",
" Spirochaetaceae | \n",
" Spirochaetales | \n",
" Spirochaetes | \n",
" Spirochaetes | \n",
"
\n",
" \n",
" 29 | \n",
" Moraxella | \n",
" Moraxellaceae | \n",
" Pseudomonadales | \n",
" Gammaproteobacteria | \n",
" Proteobacteria | \n",
"
\n",
" \n",
" 30 | \n",
" Haemophilus | \n",
" Pasteurellaceae | \n",
" Pasteurellales | \n",
" Gammaproteobacteria | \n",
" Proteobacteria | \n",
"
\n",
" \n",
" 31 | \n",
" Selenomonas | \n",
" Veillonellaceae | \n",
" Selenomonadales | \n",
" Negativicutes | \n",
" Firmicutes | \n",
"
\n",
" \n",
" 32 | \n",
" Corynebacterium | \n",
" Corynebacteriaceae | \n",
" Actinomycetales | \n",
" Actinobacteria | \n",
" Actinobacteria | \n",
"
\n",
" \n",
" 33 | \n",
" Rhizobium | \n",
" Rhizobiaceae | \n",
" Rhizobiales | \n",
" Alphaproteobacteria | \n",
" Proteobacteria | \n",
"
\n",
" \n",
" 34 | \n",
" Bradyrhizobium | \n",
" Bradyrhizobiaceae | \n",
" Rhizobiales | \n",
" Alphaproteobacteria | \n",
" Proteobacteria | \n",
"
\n",
" \n",
" 35 | \n",
" Methylobacterium | \n",
" Methylobacteriaceae | \n",
" Rhizobiales | \n",
" Alphaproteobacteria | \n",
" Proteobacteria | \n",
"
\n",
" \n",
" 36 | \n",
" OD1_genera_incertae_sedis | \n",
" OD1_genera_incertae_sedis | \n",
" OD1_genera_incertae_sedis | \n",
" OD1_genera_incertae_sedis | \n",
" OD1 | \n",
"
\n",
" \n",
" 37 | \n",
" Finegoldia | \n",
" Clostridiales_Incertae_Sedis_XI | \n",
" Clostridiales | \n",
" Clostridia | \n",
" Firmicutes | \n",
"
\n",
" \n",
" 38 | \n",
" Microbacterium | \n",
" Microbacteriaceae | \n",
" Actinomycetales | \n",
" Actinobacteria | \n",
" Actinobacteria | \n",
"
\n",
" \n",
" 39 | \n",
" Sphingomonas | \n",
" Sphingomonadaceae | \n",
" Sphingomonadales | \n",
" Alphaproteobacteria | \n",
" Proteobacteria | \n",
"
\n",
" \n",
" 40 | \n",
" Chryseobacterium | \n",
" Flavobacteriaceae | \n",
" Flavobacteriales | \n",
" Flavobacteria | \n",
" Bacteroidetes | \n",
"
\n",
" \n",
" 41 | \n",
" Bacteroides | \n",
" Bacteroidaceae | \n",
" Bacteroidales | \n",
" Bacteroidia | \n",
" Bacteroidetes | \n",
"
\n",
" \n",
" 42 | \n",
" Bdellovibrio | \n",
" Bdellovibrionaceae | \n",
" Bdellovibrionales | \n",
" Deltaproteobacteria | \n",
" Proteobacteria | \n",
"
\n",
" \n",
" 43 | \n",
" Streptophyta | \n",
" Chloroplast | \n",
" Chloroplast | \n",
" Chloroplast | \n",
" Cyanobacteria_Chloroplast | \n",
"
\n",
" \n",
" 44 | \n",
" Lachnospiracea_incertae_sedis | \n",
" Lachnospiraceae | \n",
" Clostridiales | \n",
" Clostridia | \n",
" Firmicutes | \n",
"
\n",
" \n",
" 45 | \n",
" Paracoccus | \n",
" Rhodobacteraceae | \n",
" Rhodobacterales | \n",
" Alphaproteobacteria | \n",
" Proteobacteria | \n",
"
\n",
" \n",
" 46 | \n",
" Fastidiosipila | \n",
" Ruminococcaceae | \n",
" Clostridiales | \n",
" Clostridia | \n",
" Firmicutes | \n",
"
\n",
" \n",
" 47 | \n",
" Pseudonocardia | \n",
" Pseudonocardiaceae | \n",
" Actinomycetales | \n",
" Actinobacteria | \n",
" Actinobacteria | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Genus Family \\\n",
"0 Streptococcus Streptococcaceae \n",
"1 Tropheryma Cellulomonadaceae \n",
"2 Veillonella Veillonellaceae \n",
"3 Actinomyces Actinomycetaceae \n",
"4 Flavobacterium Flavobacteriaceae \n",
"5 Prevotella Prevotellaceae \n",
"6 Porphyromonas Porphyromonadaceae \n",
"7 Parvimonas Clostridiales_Incertae_Sedis_XI \n",
"8 Fusobacterium Fusobacteriaceae \n",
"9 Propionibacterium Propionibacteriaceae \n",
"10 Gemella Bacillales_Incertae_Sedis_XI \n",
"11 Rothia Micrococcaceae \n",
"12 Granulicatella Carnobacteriaceae \n",
"13 Neisseria Neisseriaceae \n",
"14 Lactobacillus Lactobacillaceae \n",
"15 Megasphaera Veillonellaceae \n",
"16 Catonella Lachnospiraceae \n",
"17 Atopobium Coriobacteriaceae \n",
"18 Campylobacter Campylobacteraceae \n",
"19 Capnocytophaga Flavobacteriaceae \n",
"20 Solobacterium Erysipelotrichaceae \n",
"21 Moryella Lachnospiraceae \n",
"22 TM7_genera_incertae_sedis TM7_genera_incertae_sedis \n",
"23 Staphylococcus Staphylococcaceae \n",
"24 Filifactor Peptostreptococcaceae \n",
"25 Oribacterium Lachnospiraceae \n",
"26 Burkholderia Burkholderiaceae \n",
"27 Sneathia Leptotrichiaceae \n",
"28 Treponema Spirochaetaceae \n",
"29 Moraxella Moraxellaceae \n",
"30 Haemophilus Pasteurellaceae \n",
"31 Selenomonas Veillonellaceae \n",
"32 Corynebacterium Corynebacteriaceae \n",
"33 Rhizobium Rhizobiaceae \n",
"34 Bradyrhizobium Bradyrhizobiaceae \n",
"35 Methylobacterium Methylobacteriaceae \n",
"36 OD1_genera_incertae_sedis OD1_genera_incertae_sedis \n",
"37 Finegoldia Clostridiales_Incertae_Sedis_XI \n",
"38 Microbacterium Microbacteriaceae \n",
"39 Sphingomonas Sphingomonadaceae \n",
"40 Chryseobacterium Flavobacteriaceae \n",
"41 Bacteroides Bacteroidaceae \n",
"42 Bdellovibrio Bdellovibrionaceae \n",
"43 Streptophyta Chloroplast \n",
"44 Lachnospiracea_incertae_sedis Lachnospiraceae \n",
"45 Paracoccus Rhodobacteraceae \n",
"46 Fastidiosipila Ruminococcaceae \n",
"47 Pseudonocardia Pseudonocardiaceae \n",
"\n",
" Order Class \\\n",
"0 Lactobacillales Bacilli \n",
"1 Actinomycetales Actinobacteria \n",
"2 Selenomonadales Negativicutes \n",
"3 Actinomycetales Actinobacteria \n",
"4 Flavobacteriales Flavobacteria \n",
"5 Bacteroidales Bacteroidia \n",
"6 Bacteroidales Bacteroidia \n",
"7 Clostridiales Clostridia \n",
"8 Fusobacteriales Fusobacteria \n",
"9 Actinomycetales Actinobacteria \n",
"10 Bacillales Bacilli \n",
"11 Actinomycetales Actinobacteria \n",
"12 Lactobacillales Bacilli \n",
"13 Neisseriales Betaproteobacteria \n",
"14 Lactobacillales Bacilli \n",
"15 Selenomonadales Negativicutes \n",
"16 Clostridiales Clostridia \n",
"17 Coriobacteriales Actinobacteria \n",
"18 Campylobacterales Epsilonproteobacteria \n",
"19 Flavobacteriales Flavobacteria \n",
"20 Erysipelotrichales Erysipelotrichia \n",
"21 Clostridiales Clostridia \n",
"22 TM7_genera_incertae_sedis TM7_genera_incertae_sedis \n",
"23 Bacillales Bacilli \n",
"24 Clostridiales Clostridia \n",
"25 Clostridiales Clostridia \n",
"26 Burkholderiales Betaproteobacteria \n",
"27 Fusobacteriales Fusobacteria \n",
"28 Spirochaetales Spirochaetes \n",
"29 Pseudomonadales Gammaproteobacteria \n",
"30 Pasteurellales Gammaproteobacteria \n",
"31 Selenomonadales Negativicutes \n",
"32 Actinomycetales Actinobacteria \n",
"33 Rhizobiales Alphaproteobacteria \n",
"34 Rhizobiales Alphaproteobacteria \n",
"35 Rhizobiales Alphaproteobacteria \n",
"36 OD1_genera_incertae_sedis OD1_genera_incertae_sedis \n",
"37 Clostridiales Clostridia \n",
"38 Actinomycetales Actinobacteria \n",
"39 Sphingomonadales Alphaproteobacteria \n",
"40 Flavobacteriales Flavobacteria \n",
"41 Bacteroidales Bacteroidia \n",
"42 Bdellovibrionales Deltaproteobacteria \n",
"43 Chloroplast Chloroplast \n",
"44 Clostridiales Clostridia \n",
"45 Rhodobacterales Alphaproteobacteria \n",
"46 Clostridiales Clostridia \n",
"47 Actinomycetales Actinobacteria \n",
"\n",
" Phylum \n",
"0 Firmicutes \n",
"1 Actinobacteria \n",
"2 Firmicutes \n",
"3 Actinobacteria \n",
"4 Bacteroidetes \n",
"5 Bacteroidetes \n",
"6 Bacteroidetes \n",
"7 Firmicutes \n",
"8 Fusobacteria \n",
"9 Actinobacteria \n",
"10 Firmicutes \n",
"11 Actinobacteria \n",
"12 Firmicutes \n",
"13 Proteobacteria \n",
"14 Firmicutes \n",
"15 Firmicutes \n",
"16 Firmicutes \n",
"17 Actinobacteria \n",
"18 Proteobacteria \n",
"19 Bacteroidetes \n",
"20 Firmicutes \n",
"21 Firmicutes \n",
"22 TM7 \n",
"23 Firmicutes \n",
"24 Firmicutes \n",
"25 Firmicutes \n",
"26 Proteobacteria \n",
"27 Fusobacteria \n",
"28 Spirochaetes \n",
"29 Proteobacteria \n",
"30 Proteobacteria \n",
"31 Firmicutes \n",
"32 Actinobacteria \n",
"33 Proteobacteria \n",
"34 Proteobacteria \n",
"35 Proteobacteria \n",
"36 OD1 \n",
"37 Firmicutes \n",
"38 Actinobacteria \n",
"39 Proteobacteria \n",
"40 Bacteroidetes \n",
"41 Bacteroidetes \n",
"42 Proteobacteria \n",
"43 Cyanobacteria_Chloroplast \n",
"44 Firmicutes \n",
"45 Proteobacteria \n",
"46 Firmicutes \n",
"47 Actinobacteria "
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"tree_information = pd.read_csv(resource_filename('deepbiome', 'tests/data/genus48_dic.csv'))\n",
"tree_information"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This file has `.csv` format below:"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Genus,Family,Order,Class,Phylum\n",
"Streptococcus,Streptococcaceae,Lactobacillales,Bacilli,Firmicutes\n",
"Tropheryma,Cellulomonadaceae,Actinomycetales,Actinobacteria,Actinobacteria\n",
"Veillonella,Veillonellaceae,Selenomonadales,Negativicutes,Firmicutes\n",
"Actinomyces,Actinomycetaceae,Actinomycetales,Actinobacteria,Actinobacteria\n",
"Flavobacterium,Flavobacteriaceae,Flavobacteriales,Flavobacteria,Bacteroidetes\n",
"Prevotella,Prevotellaceae,Bacteroidales,Bacteroidia,Bacteroidetes\n",
"Porphyromonas,Porphyromonadaceae,Bacteroidales,Bacteroidia,Bacteroidetes\n",
"Parvimonas,Clostridiales_Incertae_Sedis_XI,Clostridiales,Clostridia,Firmicutes\n",
"Fusobacterium,Fusobacteriaceae,Fusobacteriales,Fusobacteria,Fusobacteria\n",
"Propionibacterium,Propionibacteriaceae,Actinomycetales,Actinobacteria,Actinobacteria\n",
"Gemella,Bacillales_Incertae_Sedis_XI,Bacillales,Bacilli,Firmicutes\n",
"Rothia,Micrococcaceae,Actinomycetales,Actinobacteria,Actinobacteria\n",
"Granulicatella,Carnobacteriaceae,Lactobacillales,Bacilli,Firmicutes\n",
"Neisseria,Neisseriaceae,Neisseriales,Betaproteobacteria,Proteobacteria\n",
"Lactobacillus,Lactobacillaceae,Lactobacillales,Bacilli,Firmicutes\n",
"Megasphaera,Veillonellaceae,Selenomonadales,Negativicutes,Firmicutes\n",
"Catonella,Lachnospiraceae,Clostridiales,Clostridia,Firmicutes\n",
"Atopobium,Coriobacteriaceae,Coriobacteriales,Actinobacteria,Actinobacteria\n",
"Campylobacter,Campylobacteraceae,Campylobacterales,Epsilonproteobacteria,Proteobacteria\n",
"Capnocytophaga,Flavobacteriaceae,Flavobacteriales,Flavobacteria,Bacteroidetes\n",
"Solobacterium,Erysipelotrichaceae,Erysipelotrichales,Erysipelotrichia,Firmicutes\n",
"Moryella,Lachnospiraceae,Clostridiales,Clostridia,Firmicutes\n",
"TM7_genera_incertae_sedis,TM7_genera_incertae_sedis,TM7_genera_incertae_sedis,TM7_genera_incertae_sedis,TM7\n",
"Staphylococcus,Staphylococcaceae,Bacillales,Bacilli,Firmicutes\n",
"Filifactor,Peptostreptococcaceae,Clostridiales,Clostridia,Firmicutes\n",
"Oribacterium,Lachnospiraceae,Clostridiales,Clostridia,Firmicutes\n",
"Burkholderia,Burkholderiaceae,Burkholderiales,Betaproteobacteria,Proteobacteria\n",
"Sneathia,Leptotrichiaceae,Fusobacteriales,Fusobacteria,Fusobacteria\n",
"Treponema,Spirochaetaceae,Spirochaetales,Spirochaetes,Spirochaetes\n",
"Moraxella,Moraxellaceae,Pseudomonadales,Gammaproteobacteria,Proteobacteria\n",
"Haemophilus,Pasteurellaceae,Pasteurellales,Gammaproteobacteria,Proteobacteria\n",
"Selenomonas,Veillonellaceae,Selenomonadales,Negativicutes,Firmicutes\n",
"Corynebacterium,Corynebacteriaceae,Actinomycetales,Actinobacteria,Actinobacteria\n",
"Rhizobium,Rhizobiaceae,Rhizobiales,Alphaproteobacteria,Proteobacteria\n",
"Bradyrhizobium,Bradyrhizobiaceae,Rhizobiales,Alphaproteobacteria,Proteobacteria\n",
"Methylobacterium,Methylobacteriaceae,Rhizobiales,Alphaproteobacteria,Proteobacteria\n",
"OD1_genera_incertae_sedis,OD1_genera_incertae_sedis,OD1_genera_incertae_sedis,OD1_genera_incertae_sedis,OD1\n",
"Finegoldia,Clostridiales_Incertae_Sedis_XI,Clostridiales,Clostridia,Firmicutes\n",
"Microbacterium,Microbacteriaceae,Actinomycetales,Actinobacteria,Actinobacteria\n",
"Sphingomonas,Sphingomonadaceae,Sphingomonadales,Alphaproteobacteria,Proteobacteria\n",
"Chryseobacterium,Flavobacteriaceae,Flavobacteriales,Flavobacteria,Bacteroidetes\n",
"Bacteroides,Bacteroidaceae,Bacteroidales,Bacteroidia,Bacteroidetes\n",
"Bdellovibrio,Bdellovibrionaceae,Bdellovibrionales,Deltaproteobacteria,Proteobacteria\n",
"Streptophyta,Chloroplast,Chloroplast,Chloroplast,Cyanobacteria_Chloroplast\n",
"Lachnospiracea_incertae_sedis,Lachnospiraceae,Clostridiales,Clostridia,Firmicutes\n",
"Paracoccus,Rhodobacteraceae,Rhodobacterales,Alphaproteobacteria,Proteobacteria\n",
"Fastidiosipila,Ruminococcaceae,Clostridiales,Clostridia,Firmicutes\n",
"Pseudonocardia,Pseudonocardiaceae,Actinomycetales,Actinobacteria,Actinobacteria\n",
"\n"
]
}
],
"source": [
"with open(resource_filename('deepbiome', 'tests/data/genus48_dic.csv')) as f:\n",
" print(f.read())"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Example of the list of the name of input files\n",
"\n",
"In this example. we assume that input is given by the lists of files. Each file has all sample's information for one repeatition.\n",
"If we want to use the list of the input files, we need to make a list of the names of each input file. Below is an example file for `k=3` repetition."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" 0 | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" gcount_0001.csv | \n",
"
\n",
" \n",
" 1 | \n",
" gcount_0002.csv | \n",
"
\n",
" \n",
" 2 | \n",
" gcount_0003.csv | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" 0\n",
"0 gcount_0001.csv\n",
"1 gcount_0002.csv\n",
"2 gcount_0003.csv"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"list_of_input_files = pd.read_csv(resource_filename('deepbiome', 'tests/data/gcount_list.csv'))\n",
"list_of_input_files"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Example of the lists of the input files\n",
"\n",
"Below is an example of each input file. This example has 1000 samples as rows, and the abandunces of each microbiomes as columns. Below is an example file for `k=3` repetition. This example is `gcount_0001.csv` for the first repetition in the list of the names of input files above. This file has the 1000 samples' microbiome abandunce. __The order of the microbiome should be same as the order of the microbiome in the Genus level in the tree information above.__"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Streptococcus | \n",
" Tropheryma | \n",
" Veillonella | \n",
" Actinomyces | \n",
" Flavobacterium | \n",
" Prevotella | \n",
" Porphyromonas | \n",
" Parvimonas | \n",
" Fusobacterium | \n",
" Propionibacterium | \n",
" ... | \n",
" Microbacterium | \n",
" Sphingomonas | \n",
" Chryseobacterium | \n",
" Bacteroides | \n",
" Bdellovibrio | \n",
" Streptophyta | \n",
" Lachnospiracea_incertae_sedis | \n",
" Paracoccus | \n",
" Fastidiosipila | \n",
" Pseudonocardia | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 841 | \n",
" 0 | \n",
" 813 | \n",
" 505 | \n",
" 5 | \n",
" 3224 | \n",
" 0 | \n",
" 362 | \n",
" 11 | \n",
" 65 | \n",
" ... | \n",
" 0 | \n",
" 87 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 2133 | \n",
"
\n",
" \n",
" 1 | \n",
" 1445 | \n",
" 0 | \n",
" 1 | \n",
" 573 | \n",
" 0 | \n",
" 1278 | \n",
" 82 | \n",
" 85 | \n",
" 69 | \n",
" 154 | \n",
" ... | \n",
" 0 | \n",
" 1 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 3638 | \n",
"
\n",
" \n",
" 2 | \n",
" 1259 | \n",
" 0 | \n",
" 805 | \n",
" 650 | \n",
" 0 | \n",
" 1088 | \n",
" 0 | \n",
" 0 | \n",
" 74 | \n",
" 0 | \n",
" ... | \n",
" 0 | \n",
" 2 | \n",
" 8 | \n",
" 1 | \n",
" 39 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 3445 | \n",
"
\n",
" \n",
" 3 | \n",
" 982 | \n",
" 0 | \n",
" 327 | \n",
" 594 | \n",
" 0 | \n",
" 960 | \n",
" 81 | \n",
" 19 | \n",
" 9 | \n",
" 0 | \n",
" ... | \n",
" 157 | \n",
" 1 | \n",
" 0 | \n",
" 4 | \n",
" 60 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 3507 | \n",
"
\n",
" \n",
" 4 | \n",
" 1162 | \n",
" 0 | \n",
" 130 | \n",
" 969 | \n",
" 163 | \n",
" 1515 | \n",
" 167 | \n",
" 4 | \n",
" 162 | \n",
" 3 | \n",
" ... | \n",
" 0 | \n",
" 9 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 60 | \n",
" 0 | \n",
" 0 | \n",
" 3945 | \n",
"
\n",
" \n",
"
\n",
"
5 rows × 48 columns
\n",
"
"
],
"text/plain": [
" Streptococcus Tropheryma Veillonella Actinomyces Flavobacterium \\\n",
"0 841 0 813 505 5 \n",
"1 1445 0 1 573 0 \n",
"2 1259 0 805 650 0 \n",
"3 982 0 327 594 0 \n",
"4 1162 0 130 969 163 \n",
"\n",
" Prevotella Porphyromonas Parvimonas Fusobacterium Propionibacterium \\\n",
"0 3224 0 362 11 65 \n",
"1 1278 82 85 69 154 \n",
"2 1088 0 0 74 0 \n",
"3 960 81 19 9 0 \n",
"4 1515 167 4 162 3 \n",
"\n",
" ... Microbacterium Sphingomonas Chryseobacterium Bacteroides \\\n",
"0 ... 0 87 0 0 \n",
"1 ... 0 1 2 0 \n",
"2 ... 0 2 8 1 \n",
"3 ... 157 1 0 4 \n",
"4 ... 0 9 0 0 \n",
"\n",
" Bdellovibrio Streptophyta Lachnospiracea_incertae_sedis Paracoccus \\\n",
"0 0 0 0 0 \n",
"1 0 0 0 0 \n",
"2 39 0 0 0 \n",
"3 60 0 0 0 \n",
"4 0 0 60 0 \n",
"\n",
" Fastidiosipila Pseudonocardia \n",
"0 0 2133 \n",
"1 0 3638 \n",
"2 0 3445 \n",
"3 0 3507 \n",
"4 0 3945 \n",
"\n",
"[5 rows x 48 columns]"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x_1 = pd.read_csv(resource_filename('deepbiome', 'tests/data/count/%s' % list_of_input_files.iloc[0,0]))\n",
"x_1.head()"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Streptococcus | \n",
" Tropheryma | \n",
" Veillonella | \n",
" Actinomyces | \n",
" Flavobacterium | \n",
" Prevotella | \n",
" Porphyromonas | \n",
" Parvimonas | \n",
" Fusobacterium | \n",
" Propionibacterium | \n",
" ... | \n",
" Microbacterium | \n",
" Sphingomonas | \n",
" Chryseobacterium | \n",
" Bacteroides | \n",
" Bdellovibrio | \n",
" Streptophyta | \n",
" Lachnospiracea_incertae_sedis | \n",
" Paracoccus | \n",
" Fastidiosipila | \n",
" Pseudonocardia | \n",
"
\n",
" \n",
" \n",
" \n",
" 995 | \n",
" 1401 | \n",
" 4 | \n",
" 30 | \n",
" 526 | \n",
" 0 | \n",
" 923 | \n",
" 25 | \n",
" 0 | \n",
" 127 | \n",
" 0 | \n",
" ... | \n",
" 0 | \n",
" 0 | \n",
" 7 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 4470 | \n",
"
\n",
" \n",
" 996 | \n",
" 2655 | \n",
" 6 | \n",
" 106 | \n",
" 74 | \n",
" 0 | \n",
" 952 | \n",
" 76 | \n",
" 13 | \n",
" 158 | \n",
" 125 | \n",
" ... | \n",
" 0 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 2826 | \n",
"
\n",
" \n",
" 997 | \n",
" 335 | \n",
" 0 | \n",
" 71 | \n",
" 259 | \n",
" 67 | \n",
" 718 | \n",
" 1 | \n",
" 4 | \n",
" 4 | \n",
" 167 | \n",
" ... | \n",
" 0 | \n",
" 246 | \n",
" 0 | \n",
" 0 | \n",
" 6 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 6527 | \n",
"
\n",
" \n",
" 998 | \n",
" 649 | \n",
" 69 | \n",
" 966 | \n",
" 1227 | \n",
" 0 | \n",
" 508 | \n",
" 2 | \n",
" 30 | \n",
" 550 | \n",
" 0 | \n",
" ... | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 6 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 4402 | \n",
"
\n",
" \n",
" 999 | \n",
" 1258 | \n",
" 0 | \n",
" 0 | \n",
" 1119 | \n",
" 0 | \n",
" 2348 | \n",
" 25 | \n",
" 0 | \n",
" 137 | \n",
" 176 | \n",
" ... | \n",
" 0 | \n",
" 2 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" 2585 | \n",
"
\n",
" \n",
"
\n",
"
5 rows × 48 columns
\n",
"
"
],
"text/plain": [
" Streptococcus Tropheryma Veillonella Actinomyces Flavobacterium \\\n",
"995 1401 4 30 526 0 \n",
"996 2655 6 106 74 0 \n",
"997 335 0 71 259 67 \n",
"998 649 69 966 1227 0 \n",
"999 1258 0 0 1119 0 \n",
"\n",
" Prevotella Porphyromonas Parvimonas Fusobacterium Propionibacterium \\\n",
"995 923 25 0 127 0 \n",
"996 952 76 13 158 125 \n",
"997 718 1 4 4 167 \n",
"998 508 2 30 550 0 \n",
"999 2348 25 0 137 176 \n",
"\n",
" ... Microbacterium Sphingomonas Chryseobacterium Bacteroides \\\n",
"995 ... 0 0 7 0 \n",
"996 ... 0 2 0 0 \n",
"997 ... 0 246 0 0 \n",
"998 ... 0 0 0 0 \n",
"999 ... 0 2 0 0 \n",
"\n",
" Bdellovibrio Streptophyta Lachnospiracea_incertae_sedis Paracoccus \\\n",
"995 0 0 0 0 \n",
"996 0 0 0 0 \n",
"997 6 0 0 0 \n",
"998 0 6 0 0 \n",
"999 0 0 0 0 \n",
"\n",
" Fastidiosipila Pseudonocardia \n",
"995 0 4470 \n",
"996 0 2826 \n",
"997 0 6527 \n",
"998 0 4402 \n",
"999 0 2585 \n",
"\n",
"[5 rows x 48 columns]"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x_1.tail()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This file has .csv format below:"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\"Streptococcus\",\"Tropheryma\",\"Veillonella\",\"Actinomyces\",\"Flavobacterium\",\"Prevotella\",\"Porphyromonas\",\"Parvimonas\",\"Fusobacterium\",\"Propionibacterium\",\"Gemella\",\"Rothia\",\"Granulicatella\",\"Neisseria\",\"Lactobacillus\",\"Megasphaera\",\"Catonella\",\"Atopobium\",\"Campylobacter\",\"Capnocytophaga\",\"Solobacterium\",\"Moryella\",\"TM7_genera_incertae_sedis\",\"Staphylococcus\",\"Filifactor\",\"Oribacterium\",\"Burkholderia\",\"Sneathia\",\"Treponema\",\"Moraxella\",\"Haemophilus\",\"Selenomonas\",\"Corynebacterium\",\"Rhizobium\",\"Bradyrhizobium\",\"Methylobacterium\",\"OD1_genera_incertae_sedis\",\"Finegoldia\",\"Microbacterium\",\"Sphingomonas\",\"Chryseobacterium\",\"Bacteroides\",\"Bdellovibrio\",\"Streptophyta\",\"Lachnospiracea_incertae_sedis\",\"Paracoccus\",\"Fastidiosipila\",\"Pseudonocardia\"\n",
"\n",
"841,0,813,505,5,3224,0,362,11,65,156,1,55,0,1,20,382,1,333,24,80,43,309,2,3,4,0,1,32,0,2,4,382,0,0,96,23,0,0,87,0,0,0,0,0,0,0,2133\n",
"\n",
"1445,0,1,573,0,1278,82,85,69,154,436,3,0,61,440,0,394,83,33,123,0,49,414,0,0,37,0,0,42,0,0,384,27,0,0,0,146,0,0,1,2,0,0,0,0,0,0,3638\n",
"\n",
"1259,0,805,650,0,1088,0,0,74,0,155,228,430,765,0,0,11,102,68,90,77,83,322,10,0,7,0,122,76,0,1,25,0,0,0,44,13,0,0,2,8,1,39,0,0,0,0,3445\n",
"\n",
"982,0,327,594,0,960,81,19,9,0,45,457,1049,0,3,450,19,170,388,147,0,0,41,63,0,1,0,0,121,0,0,1,0,0,0,0,344,0,157,1,0,4,60,0,0,0,0,3507\n",
"\n",
"1162,0,130,969,163,1515,167,4,162,3,12,0,48,73,93,259,52,0,201,85,14,14,434,2,0,0,0,0,187,0,0,188,45,0,0,0,4,0,0,9,0,0,0,0,60,0,0,3945\n",
"\n",
"1956,37,41,661,47,1555,374,7,142,19,61,226,0,30,52,0,6,480,142,148,9,575,12,0,0,0,0,3,168,0,56,50,0,0,0,98,989,0,0,12,0,0,0,0,0,0,0,2044\n",
"\n",
"1037,14,83,1595,132,305,103,174,1195,0,410,224,1,320,26,0,476,0,7,37,46,61,20,0,0,0,0,0,226,0,239,8,1,0,0,0,0,188,0,20,4,0,4,0,0,0,0,3044\n",
"\n",
"641,0,172,179,0,1312,84,9,81,376,128,223,160,0,532,155,89,355,1,282,0,0,25,0,0,43,0,9,311,0,0,0,0,0,0,0,845,0,0,8,0,0,0,0,0,0,0,3980\n",
"\n",
"852,146,504,99,2,376,116,152,67,0,120,3,23,2,34,0,127,75,240,60,42,0,9,0,15,0,62,0,13,0,197,187,396,0,0,20,51,0,0,3,0,0,0,0,0,0,0,6007\n",
"\n"
]
}
],
"source": [
"with open(resource_filename('deepbiome', 'tests/data/count/%s' % list_of_input_files.iloc[0,0])) as f:\n",
" x_csv = f.readlines()\n",
" _ = [print(l) for l in x_csv[:10]]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Example of the Y (regression)\n",
"\n",
"This is an example of the output file for regression problem. One column contains outputs of the samples for one repetition. \n",
"Below example file has 1000 samples in rows, `k=3` repetitions in columns."
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" x1 | \n",
" x2 | \n",
" x3 | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 4.997 | \n",
" 5.492 | \n",
" 5.474 | \n",
"
\n",
" \n",
" 1 | \n",
" 5.004 | \n",
" 1.500 | \n",
" 4.640 | \n",
"
\n",
" \n",
" 2 | \n",
" 5.485 | \n",
" 4.187 | \n",
" 5.491 | \n",
"
\n",
" \n",
" 3 | \n",
" 5.490 | \n",
" 4.863 | \n",
" 1.500 | \n",
"
\n",
" \n",
" 4 | \n",
" 1.500 | \n",
" 5.481 | \n",
" 5.490 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" x1 x2 x3\n",
"0 4.997 5.492 5.474\n",
"1 5.004 1.500 4.640\n",
"2 5.485 4.187 5.491\n",
"3 5.490 4.863 1.500\n",
"4 1.500 5.481 5.490"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y = pd.read_csv(resource_filename('deepbiome', 'tests/data/regression_y.csv'))\n",
"y.head()"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" x1 | \n",
" x2 | \n",
" x3 | \n",
"
\n",
" \n",
" \n",
" \n",
" 995 | \n",
" 2.610 | \n",
" 5.491 | \n",
" 3.319 | \n",
"
\n",
" \n",
" 996 | \n",
" 5.489 | \n",
" 3.740 | \n",
" 5.489 | \n",
"
\n",
" \n",
" 997 | \n",
" 3.498 | \n",
" 4.250 | \n",
" 5.488 | \n",
"
\n",
" \n",
" 998 | \n",
" 5.486 | \n",
" 1.917 | \n",
" 5.415 | \n",
"
\n",
" \n",
" 999 | \n",
" 5.320 | \n",
" 5.483 | \n",
" 1.500 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" x1 x2 x3\n",
"995 2.610 5.491 3.319\n",
"996 5.489 3.740 5.489\n",
"997 3.498 4.250 5.488\n",
"998 5.486 1.917 5.415\n",
"999 5.320 5.483 1.500"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y.tail()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For one repetition, the DeepBiome will use the one column."
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"0 4.997\n",
"1 5.004\n",
"2 5.485\n",
"3 5.490\n",
"4 1.500\n",
"Name: x1, dtype: float64"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y.iloc[:,0].head()"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"995 2.610\n",
"996 5.489\n",
"997 3.498\n",
"998 5.486\n",
"999 5.320\n",
"Name: x1, dtype: float64"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y.iloc[:,0].tail()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Example of the Y (classification)\n",
"\n",
"This is an example of the output file for classification problem. Below example file has 1000 samples in rows, 3 repetitions in columns."
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" V1 | \n",
" V2 | \n",
" V3 | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
"
\n",
" \n",
" 1 | \n",
" 1 | \n",
" 1 | \n",
" 1 | \n",
"
\n",
" \n",
" 2 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
"
\n",
" \n",
" 3 | \n",
" 0 | \n",
" 1 | \n",
" 1 | \n",
"
\n",
" \n",
" 4 | \n",
" 1 | \n",
" 1 | \n",
" 0 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" V1 V2 V3\n",
"0 1 0 1\n",
"1 1 1 1\n",
"2 0 1 0\n",
"3 0 1 1\n",
"4 1 1 0"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y = pd.read_csv(resource_filename('deepbiome', 'tests/data/classification_y.csv'))\n",
"y.head()"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" V1 | \n",
" V2 | \n",
" V3 | \n",
"
\n",
" \n",
" \n",
" \n",
" 995 | \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
"
\n",
" \n",
" 996 | \n",
" 0 | \n",
" 1 | \n",
" 0 | \n",
"
\n",
" \n",
" 997 | \n",
" 1 | \n",
" 1 | \n",
" 0 | \n",
"
\n",
" \n",
" 998 | \n",
" 0 | \n",
" 1 | \n",
" 1 | \n",
"
\n",
" \n",
" 999 | \n",
" 1 | \n",
" 1 | \n",
" 1 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" V1 V2 V3\n",
"995 1 0 1\n",
"996 0 1 0\n",
"997 1 1 0\n",
"998 0 1 1\n",
"999 1 1 1"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y.tail()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For one repetition, the DeepBiome will use the one column."
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"0 1\n",
"1 1\n",
"2 0\n",
"3 0\n",
"4 1\n",
"Name: V1, dtype: int64"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y.iloc[:,0].head()"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"995 1\n",
"996 0\n",
"997 1\n",
"998 0\n",
"999 1\n",
"Name: V1, dtype: int64"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"y.iloc[:,0].tail()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Exmple of the training index file for repetition\n",
"\n",
"For each repetition, we have to set the training and test set. If the index file is given, DeepBiome sets the training set and test set based on the index file. Below is the example of the index file. Each column has the training indexs for each repetition. The DeepBiome will only use the samples in this index set for training."
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" V1 | \n",
" V2 | \n",
" V3 | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 490 | \n",
" 690 | \n",
" 62 | \n",
"
\n",
" \n",
" 1 | \n",
" 498 | \n",
" 968 | \n",
" 123 | \n",
"
\n",
" \n",
" 2 | \n",
" 389 | \n",
" 999 | \n",
" 335 | \n",
"
\n",
" \n",
" 3 | \n",
" 51 | \n",
" 139 | \n",
" 843 | \n",
"
\n",
" \n",
" 4 | \n",
" 592 | \n",
" 83 | \n",
" 204 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" V1 V2 V3\n",
"0 490 690 62\n",
"1 498 968 123\n",
"2 389 999 335\n",
"3 51 139 843\n",
"4 592 83 204"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"idxs = pd.read_csv(resource_filename('deepbiome', 'tests/data/regression_idx.csv'), dtype=np.int)\n",
"idxs.head()"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" V1 | \n",
" V2 | \n",
" V3 | \n",
"
\n",
" \n",
" \n",
" \n",
" 745 | \n",
" 599 | \n",
" 824 | \n",
" 997 | \n",
"
\n",
" \n",
" 746 | \n",
" 720 | \n",
" 633 | \n",
" 821 | \n",
"
\n",
" \n",
" 747 | \n",
" 80 | \n",
" 268 | \n",
" 661 | \n",
"
\n",
" \n",
" 748 | \n",
" 570 | \n",
" 32 | \n",
" 750 | \n",
"
\n",
" \n",
" 749 | \n",
" 440 | \n",
" 589 | \n",
" 607 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" V1 V2 V3\n",
"745 599 824 997\n",
"746 720 633 821\n",
"747 80 268 661\n",
"748 570 32 750\n",
"749 440 589 607"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"idxs.tail()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Below is the index set for 1st repetition. From 1000 samples above, it uses 750 samples for training."
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"scrolled": true
},
"outputs": [
{
"data": {
"text/plain": [
"0 490\n",
"1 498\n",
"2 389\n",
"3 51\n",
"4 592\n",
"Name: V1, dtype: int64"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"idxs.iloc[:,0].head()"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"745 599\n",
"746 720\n",
"747 80\n",
"748 570\n",
"749 440\n",
"Name: V1, dtype: int64"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"idxs.iloc[:,0].tail()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3. Prepare the configuration\n",
"\n",
"For detailed configuration, we can build the configuration information for the network training by:\n",
"1. the python dictionary format\n",
"1. the configufation file (.cfg).\n",
"\n",
"In this notebook, we show the python dictionary format configuration.\n",
"\n",
"Please check the detailed information about each option in the [documantation](https://young-won.github.io/deepbiome/prerequisites.html#configuration)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### For preparing the configuration about the network information (`network_info`)\n",
"\n",
"To give the information about the training process, we provide a dictionary of configurations to the `netowrk_info` field.\n",
"Your configuration for the network training should include the information about:"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"network_info = {\n",
" 'architecture_info': {\n",
" 'batch_normalization': 'False',\n",
" 'drop_out': '0',\n",
" 'weight_initial': 'glorot_uniform',\n",
" 'weight_l1_penalty':'0.',\n",
" 'weight_decay': 'phylogenetic_tree',\n",
" },\n",
" 'model_info': {\n",
" 'lr': '0.01',\n",
" 'decay': '0.001',\n",
" 'loss': 'binary_crossentropy',\n",
" 'metrics': 'binary_accuracy, sensitivity, specificity, gmeasure, auc',\n",
" 'taxa_selection_metrics': 'sensitivity, specificity, gmeasure, accuracy',\n",
" 'network_class': 'DeepBiomeNetwork',\n",
" 'optimizer': 'adam',\n",
" 'reader_class': 'MicroBiomeClassificationReader',\n",
" 'normalizer': 'normalize_minmax',\n",
" },\n",
" 'training_info': {\n",
" 'batch_size': '50', \n",
" 'epochs': '10',\n",
" 'callbacks': 'ModelCheckpoint',\n",
" 'monitor': 'val_loss',\n",
" 'mode' : 'min',\n",
" 'min_delta': '1e-7',\n",
" },\n",
" 'validation_info': {\n",
" 'batch_size': 'None', \n",
" 'validation_size': '0.2'\n",
" },\n",
" 'test_info': {\n",
" 'batch_size': 'None'\n",
" }\n",
"}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### For preparing the configuration about the path information (`path_info`)\n",
"\n",
"To give the information about the path of dataset, paths for saving the trained weights and the evaluation results, we provide a dictionary of configurations to the `path_info` field.\n",
"Your configuration for the network training should include the information about:"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"path_info = {\n",
" 'data_info': {\n",
" 'count_list_path': resource_filename('deepbiome', 'tests/data/gcount_list.csv'),\n",
" 'count_path': resource_filename('deepbiome', 'tests/data/count'),\n",
" 'data_path': resource_filename('deepbiome', 'tests/data'),\n",
" 'idx_path': resource_filename('deepbiome', 'tests/data/classification_idx.csv'),\n",
" 'tree_info_path': resource_filename('deepbiome', 'tests/data/genus48_dic.csv'),\n",
" 'x_path': '',\n",
" 'y_path': 'classification_y.csv'\n",
" },\n",
" 'model_info': {\n",
" 'evaluation': 'eval.npy',\n",
" 'history': 'hist.json',\n",
" 'model_dir': './example_result/',\n",
" 'weight': 'weight.h5'\n",
" }\n",
"}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 4. DeepBiome Training\n",
"\n",
"Now we can train the DeepBiome network based on the configurations."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"For logging, we use the python logging library."
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"logging.basicConfig(format = '[%(name)-8s|%(levelname)s|%(filename)s:%(lineno)s] %(message)s',\n",
" level=logging.DEBUG)\n",
"log = logging.getLogger()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The deeobiome_train function provide the test evaluation, train evaluation and the deepbiome network instance.\n",
"\n",
"If we set `number_of_fold`, then DeepBiome performs cross-validation based on that value. If not, DeepBiome package performs cross-validation based on the index file. If both `number_of_fold` option and the index file are missing, then the library performs leave-one-out-cross-validation (LOOCV)."
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|deepbiome.py:115] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:153] -------1 simulation start!----------------------------------\n",
"[root |INFO|readers.py:58] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:59] Construct Dataset\n",
"[root |INFO|readers.py:60] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:61] Load data\n",
"[root |INFO|deepbiome.py:164] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:165] Build network for 1 simulation\n",
"[root |INFO|build_network.py:521] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:522] Read phylogenetic tree information from /DATA/home/muha/github_repos/deepbiome/deepbiome/tests/data/genus48_dic.csv\n",
"[root |INFO|build_network.py:528] Phylogenetic tree level list: ['Genus', 'Family', 'Order', 'Class', 'Phylum']\n",
"[root |INFO|build_network.py:529] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:537] Genus: 48\n",
"[root |INFO|build_network.py:537] Family: 40\n",
"[root |INFO|build_network.py:537] Order: 23\n",
"[root |INFO|build_network.py:537] Class: 17\n",
"[root |INFO|build_network.py:537] Phylum: 9\n",
"[root |INFO|build_network.py:546] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:547] Phylogenetic_tree_dict info: ['Phylum', 'Order', 'Family', 'Class', 'Number', 'Genus']\n",
"[root |INFO|build_network.py:548] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Genus, Family]\n",
"[root |INFO|build_network.py:558] Build edge weights between [Family, Order]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Order, Class]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Class, Phylum]\n",
"[root |INFO|build_network.py:571] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:586] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:587] Build network based on phylogenetic tree information\n",
"[root |INFO|build_network.py:588] ------------------------------------------------------------------------------------------\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"WARNING:tensorflow:From /usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/resource_variable_ops.py:432: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.\n",
"Instructions for updating:\n",
"Colocations handled automatically by placer.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[tensorflow|WARNING|deprecation.py:328] From /usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/resource_variable_ops.py:432: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.\n",
"Instructions for updating:\n",
"Colocations handled automatically by placer.\n",
"[root |INFO|build_network.py:670] ------------------------------------------------------------------------------------------\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Model: \"model_1\"\n",
"_________________________________________________________________\n",
"Layer (type) Output Shape Param # \n",
"=================================================================\n",
"input (InputLayer) (None, 48) 0 \n",
"_________________________________________________________________\n",
"l1_dense (Dense_with_tree) (None, 40) 1960 \n",
"_________________________________________________________________\n",
"l1_activation (Activation) (None, 40) 0 \n",
"_________________________________________________________________\n",
"l2_dense (Dense_with_tree) (None, 23) 943 \n",
"_________________________________________________________________\n",
"l2_activation (Activation) (None, 23) 0 \n",
"_________________________________________________________________\n",
"l3_dense (Dense_with_tree) (None, 17) 408 \n",
"_________________________________________________________________\n",
"l3_activation (Activation) (None, 17) 0 \n",
"_________________________________________________________________\n",
"l4_dense (Dense_with_tree) (None, 9) 162 \n",
"_________________________________________________________________\n",
"l4_activation (Activation) (None, 9) 0 \n",
"_________________________________________________________________\n",
"last_dense_h (Dense) (None, 1) 10 \n",
"_________________________________________________________________\n",
"p_hat (Activation) (None, 1) 0 \n",
"=================================================================\n",
"Total params: 3,483\n",
"Trainable params: 3,483\n",
"Non-trainable params: 0\n",
"_________________________________________________________________\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:61] Build Network\n",
"[root |INFO|build_network.py:62] Optimizer = adam\n",
"[root |INFO|build_network.py:63] Loss = binary_crossentropy\n",
"[root |INFO|build_network.py:64] Metrics = binary_accuracy, sensitivity, specificity, gmeasure, auc\n",
"[root |INFO|deepbiome.py:176] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:177] 1 fold computing start!----------------------------------\n",
"[root |INFO|build_network.py:137] Training start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"WARNING:tensorflow:From /usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/math_ops.py:2862: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.\n",
"Instructions for updating:\n",
"Use tf.cast instead.\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[tensorflow|WARNING|deprecation.py:328] From /usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/math_ops.py:2862: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.\n",
"Instructions for updating:\n",
"Use tf.cast instead.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Train on 600 samples, validate on 150 samples\n",
"Epoch 1/10\n",
"600/600 [==============================] - 1s 1ms/step - loss: 0.6743 - binary_accuracy: 0.6517 - sensitivity: 0.9212 - specificity: 0.0833 - gmeasure: 0.0194 - auc: 0.4725 - val_loss: 0.6409 - val_binary_accuracy: 0.7000 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.5159\n",
"Epoch 2/10\n",
"600/600 [==============================] - 0s 223us/step - loss: 0.6310 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.7404 - val_loss: 0.6117 - val_binary_accuracy: 0.7000 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.7595\n",
"Epoch 3/10\n",
"600/600 [==============================] - 0s 199us/step - loss: 0.6206 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.8101 - val_loss: 0.6110 - val_binary_accuracy: 0.7000 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.7792\n",
"Epoch 4/10\n",
"600/600 [==============================] - 0s 225us/step - loss: 0.6214 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.8168 - val_loss: 0.6108 - val_binary_accuracy: 0.7000 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.7948\n",
"Epoch 5/10\n",
"600/600 [==============================] - 0s 217us/step - loss: 0.6204 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.8246 - val_loss: 0.6112 - val_binary_accuracy: 0.7000 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.8087\n",
"Epoch 6/10\n",
"600/600 [==============================] - 0s 237us/step - loss: 0.6205 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.8379 - val_loss: 0.6113 - val_binary_accuracy: 0.7000 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.8203\n",
"Epoch 7/10\n",
"600/600 [==============================] - 0s 238us/step - loss: 0.6220 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.8410 - val_loss: 0.6123 - val_binary_accuracy: 0.7000 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.8255\n",
"Epoch 8/10\n",
"600/600 [==============================] - 0s 205us/step - loss: 0.6196 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.8492 - val_loss: 0.6103 - val_binary_accuracy: 0.7000 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.8313\n",
"Epoch 9/10\n",
"600/600 [==============================] - 0s 219us/step - loss: 0.6202 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.8526 - val_loss: 0.6098 - val_binary_accuracy: 0.7000 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.8407\n",
"Epoch 10/10\n",
"600/600 [==============================] - 0s 195us/step - loss: 0.6204 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.8572 - val_loss: 0.6092 - val_binary_accuracy: 0.7000 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.8457\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:87] Load trained model weight at ./example_result/weight_0.h5 \n",
"[root |INFO|build_network.py:147] Training end with time 4.45297384262085!\n",
"[root |INFO|build_network.py:83] Saved trained model weight at ./example_result/weight_0.h5 \n",
"[root |DEBUG|deepbiome.py:185] Save weight at ./example_result/weight_0.h5\n",
"[root |DEBUG|deepbiome.py:188] Save history at ./example_result/hist_0.json\n",
"[root |INFO|build_network.py:173] Evaluation start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r",
"750/750 [==============================] - 0s 7us/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:178] Evaluation end with time 0.011869668960571289!\n",
"[root |INFO|build_network.py:179] Evaluation: [0.6164737343788147, 0.690666675567627, 1.0, 0.0, 0.0, 0.8536480069160461]\n",
"[root |INFO|build_network.py:173] Evaluation start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r",
"250/250 [==============================] - 0s 18us/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:178] Evaluation end with time 0.01761341094970703!\n",
"[root |INFO|build_network.py:179] Evaluation: [0.6278528571128845, 0.6759999990463257, 1.0, 0.0, 0.0, 0.8606910705566406]\n",
"[root |INFO|deepbiome.py:199] Compute time : 5.686180830001831\n",
"[root |INFO|deepbiome.py:200] 1 fold computing end!---------------------------------------------\n",
"[root |INFO|deepbiome.py:153] -------2 simulation start!----------------------------------\n",
"[root |INFO|readers.py:58] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:59] Construct Dataset\n",
"[root |INFO|readers.py:60] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:61] Load data\n",
"[root |INFO|deepbiome.py:164] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:165] Build network for 2 simulation\n",
"[root |INFO|build_network.py:521] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:522] Read phylogenetic tree information from /DATA/home/muha/github_repos/deepbiome/deepbiome/tests/data/genus48_dic.csv\n",
"[root |INFO|build_network.py:528] Phylogenetic tree level list: ['Genus', 'Family', 'Order', 'Class', 'Phylum']\n",
"[root |INFO|build_network.py:529] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:537] Genus: 48\n",
"[root |INFO|build_network.py:537] Family: 40\n",
"[root |INFO|build_network.py:537] Order: 23\n",
"[root |INFO|build_network.py:537] Class: 17\n",
"[root |INFO|build_network.py:537] Phylum: 9\n",
"[root |INFO|build_network.py:546] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:547] Phylogenetic_tree_dict info: ['Phylum', 'Order', 'Family', 'Class', 'Number', 'Genus']\n",
"[root |INFO|build_network.py:548] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Genus, Family]\n",
"[root |INFO|build_network.py:558] Build edge weights between [Family, Order]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Order, Class]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Class, Phylum]\n",
"[root |INFO|build_network.py:571] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:586] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:587] Build network based on phylogenetic tree information\n",
"[root |INFO|build_network.py:588] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:670] ------------------------------------------------------------------------------------------\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Model: \"model_1\"\n",
"_________________________________________________________________\n",
"Layer (type) Output Shape Param # \n",
"=================================================================\n",
"input (InputLayer) (None, 48) 0 \n",
"_________________________________________________________________\n",
"l1_dense (Dense_with_tree) (None, 40) 1960 \n",
"_________________________________________________________________\n",
"l1_activation (Activation) (None, 40) 0 \n",
"_________________________________________________________________\n",
"l2_dense (Dense_with_tree) (None, 23) 943 \n",
"_________________________________________________________________\n",
"l2_activation (Activation) (None, 23) 0 \n",
"_________________________________________________________________\n",
"l3_dense (Dense_with_tree) (None, 17) 408 \n",
"_________________________________________________________________\n",
"l3_activation (Activation) (None, 17) 0 \n",
"_________________________________________________________________\n",
"l4_dense (Dense_with_tree) (None, 9) 162 \n",
"_________________________________________________________________\n",
"l4_activation (Activation) (None, 9) 0 \n",
"_________________________________________________________________\n",
"last_dense_h (Dense) (None, 1) 10 \n",
"_________________________________________________________________\n",
"p_hat (Activation) (None, 1) 0 \n",
"=================================================================\n",
"Total params: 3,483\n",
"Trainable params: 3,483\n",
"Non-trainable params: 0\n",
"_________________________________________________________________\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:61] Build Network\n",
"[root |INFO|build_network.py:62] Optimizer = adam\n",
"[root |INFO|build_network.py:63] Loss = binary_crossentropy\n",
"[root |INFO|build_network.py:64] Metrics = binary_accuracy, sensitivity, specificity, gmeasure, auc\n",
"[root |INFO|deepbiome.py:176] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:177] 2 fold computing start!----------------------------------\n",
"[root |INFO|build_network.py:137] Training start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Train on 600 samples, validate on 150 samples\n",
"Epoch 1/10\n",
"600/600 [==============================] - 1s 1ms/step - loss: 0.6452 - binary_accuracy: 0.7067 - sensitivity: 0.9363 - specificity: 0.0677 - gmeasure: 0.0364 - auc: 0.4412 - val_loss: 0.6043 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.5880\n",
"Epoch 2/10\n",
"600/600 [==============================] - 0s 613us/step - loss: 0.5917 - binary_accuracy: 0.7283 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.5369 - val_loss: 0.5893 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.6307\n",
"Epoch 3/10\n",
"600/600 [==============================] - 0s 289us/step - loss: 0.5877 - binary_accuracy: 0.7283 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.6219 - val_loss: 0.5875 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.6821\n",
"Epoch 4/10\n",
"600/600 [==============================] - 0s 621us/step - loss: 0.5869 - binary_accuracy: 0.7283 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.6838 - val_loss: 0.5867 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.7095\n",
"Epoch 5/10\n",
"600/600 [==============================] - 0s 335us/step - loss: 0.5855 - binary_accuracy: 0.7283 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.7137 - val_loss: 0.5867 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.7346\n",
"Epoch 6/10\n",
"600/600 [==============================] - 0s 597us/step - loss: 0.5860 - binary_accuracy: 0.7283 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.7500 - val_loss: 0.5866 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.7710\n",
"Epoch 7/10\n",
"600/600 [==============================] - 0s 223us/step - loss: 0.5852 - binary_accuracy: 0.7283 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.7697 - val_loss: 0.5867 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.7906\n",
"Epoch 8/10\n",
"600/600 [==============================] - 0s 452us/step - loss: 0.5855 - binary_accuracy: 0.7283 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.8008 - val_loss: 0.5869 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.8195\n",
"Epoch 9/10\n",
"600/600 [==============================] - 0s 471us/step - loss: 0.5878 - binary_accuracy: 0.7283 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.8200 - val_loss: 0.5871 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.8315\n",
"Epoch 10/10\n",
"600/600 [==============================] - 0s 390us/step - loss: 0.5874 - binary_accuracy: 0.7283 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.8272 - val_loss: 0.5868 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.8467\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:87] Load trained model weight at ./example_result/weight_1.h5 \n",
"[root |INFO|build_network.py:147] Training end with time 4.857975244522095!\n",
"[root |INFO|build_network.py:83] Saved trained model weight at ./example_result/weight_1.h5 \n",
"[root |DEBUG|deepbiome.py:185] Save weight at ./example_result/weight_1.h5\n",
"[root |DEBUG|deepbiome.py:188] Save history at ./example_result/hist_1.json\n",
"[root |INFO|build_network.py:173] Evaluation start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r",
"750/750 [==============================] - 0s 18us/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:178] Evaluation end with time 0.028972148895263672!\n",
"[root |INFO|build_network.py:179] Evaluation: [0.5853651762008667, 0.7279999852180481, 1.0, 0.0, 0.0, 0.7630988359451294]\n",
"[root |INFO|build_network.py:173] Evaluation start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r",
"250/250 [==============================] - 0s 48us/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:178] Evaluation end with time 0.02693629264831543!\n",
"[root |INFO|build_network.py:179] Evaluation: [0.6156458258628845, 0.6959999799728394, 1.0, 0.0, 0.0, 0.782667875289917]\n",
"[root |INFO|deepbiome.py:199] Compute time : 5.397497892379761\n",
"[root |INFO|deepbiome.py:200] 2 fold computing end!---------------------------------------------\n",
"[root |INFO|deepbiome.py:153] -------3 simulation start!----------------------------------\n",
"[root |INFO|readers.py:58] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:59] Construct Dataset\n",
"[root |INFO|readers.py:60] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:61] Load data\n",
"[root |INFO|deepbiome.py:164] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:165] Build network for 3 simulation\n",
"[root |INFO|build_network.py:521] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:522] Read phylogenetic tree information from /DATA/home/muha/github_repos/deepbiome/deepbiome/tests/data/genus48_dic.csv\n",
"[root |INFO|build_network.py:528] Phylogenetic tree level list: ['Genus', 'Family', 'Order', 'Class', 'Phylum']\n",
"[root |INFO|build_network.py:529] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:537] Genus: 48\n",
"[root |INFO|build_network.py:537] Family: 40\n",
"[root |INFO|build_network.py:537] Order: 23\n",
"[root |INFO|build_network.py:537] Class: 17\n",
"[root |INFO|build_network.py:537] Phylum: 9\n",
"[root |INFO|build_network.py:546] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:547] Phylogenetic_tree_dict info: ['Phylum', 'Order', 'Family', 'Class', 'Number', 'Genus']\n",
"[root |INFO|build_network.py:548] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Genus, Family]\n",
"[root |INFO|build_network.py:558] Build edge weights between [Family, Order]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Order, Class]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Class, Phylum]\n",
"[root |INFO|build_network.py:571] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:586] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:587] Build network based on phylogenetic tree information\n",
"[root |INFO|build_network.py:588] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:670] ------------------------------------------------------------------------------------------\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Model: \"model_1\"\n",
"_________________________________________________________________\n",
"Layer (type) Output Shape Param # \n",
"=================================================================\n",
"input (InputLayer) (None, 48) 0 \n",
"_________________________________________________________________\n",
"l1_dense (Dense_with_tree) (None, 40) 1960 \n",
"_________________________________________________________________\n",
"l1_activation (Activation) (None, 40) 0 \n",
"_________________________________________________________________\n",
"l2_dense (Dense_with_tree) (None, 23) 943 \n",
"_________________________________________________________________\n",
"l2_activation (Activation) (None, 23) 0 \n",
"_________________________________________________________________\n",
"l3_dense (Dense_with_tree) (None, 17) 408 \n",
"_________________________________________________________________\n",
"l3_activation (Activation) (None, 17) 0 \n",
"_________________________________________________________________\n",
"l4_dense (Dense_with_tree) (None, 9) 162 \n",
"_________________________________________________________________\n",
"l4_activation (Activation) (None, 9) 0 \n",
"_________________________________________________________________\n",
"last_dense_h (Dense) (None, 1) 10 \n",
"_________________________________________________________________\n",
"p_hat (Activation) (None, 1) 0 \n",
"=================================================================\n",
"Total params: 3,483\n",
"Trainable params: 3,483\n",
"Non-trainable params: 0\n",
"_________________________________________________________________\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:61] Build Network\n",
"[root |INFO|build_network.py:62] Optimizer = adam\n",
"[root |INFO|build_network.py:63] Loss = binary_crossentropy\n",
"[root |INFO|build_network.py:64] Metrics = binary_accuracy, sensitivity, specificity, gmeasure, auc\n",
"[root |INFO|deepbiome.py:176] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:177] 3 fold computing start!----------------------------------\n",
"[root |INFO|build_network.py:137] Training start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Train on 600 samples, validate on 150 samples\n",
"Epoch 1/10\n",
"600/600 [==============================] - 1s 1ms/step - loss: 0.6592 - binary_accuracy: 0.6867 - sensitivity: 0.9821 - specificity: 0.0189 - gmeasure: 0.0352 - auc: 0.5518 - val_loss: 0.6501 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.5313\n",
"Epoch 2/10\n",
"600/600 [==============================] - 0s 203us/step - loss: 0.6245 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.5300 - val_loss: 0.6511 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.5359\n",
"Epoch 3/10\n",
"600/600 [==============================] - 0s 186us/step - loss: 0.6232 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.5332 - val_loss: 0.6529 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.5422\n",
"Epoch 4/10\n",
"600/600 [==============================] - 0s 211us/step - loss: 0.6226 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.5512 - val_loss: 0.6460 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.5510\n",
"Epoch 5/10\n",
"600/600 [==============================] - 0s 183us/step - loss: 0.6222 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.5571 - val_loss: 0.6485 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.5556\n",
"Epoch 6/10\n",
"600/600 [==============================] - 0s 179us/step - loss: 0.6216 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.5725 - val_loss: 0.6475 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.5648\n",
"Epoch 7/10\n",
"600/600 [==============================] - 0s 224us/step - loss: 0.6206 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.5685 - val_loss: 0.6468 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.5722\n",
"Epoch 8/10\n",
"600/600 [==============================] - 0s 214us/step - loss: 0.6201 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.5792 - val_loss: 0.6481 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.5773\n",
"Epoch 9/10\n",
"600/600 [==============================] - 0s 239us/step - loss: 0.6203 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.5836 - val_loss: 0.6475 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.5862\n",
"Epoch 10/10\n",
"600/600 [==============================] - 0s 171us/step - loss: 0.6205 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - auc: 0.5945 - val_loss: 0.6487 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00 - val_auc: 0.5951\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:87] Load trained model weight at ./example_result/weight_2.h5 \n",
"[root |INFO|build_network.py:147] Training end with time 3.4070072174072266!\n",
"[root |INFO|build_network.py:83] Saved trained model weight at ./example_result/weight_2.h5 \n",
"[root |DEBUG|deepbiome.py:185] Save weight at ./example_result/weight_2.h5\n",
"[root |DEBUG|deepbiome.py:188] Save history at ./example_result/hist_2.json\n",
"[root |INFO|build_network.py:173] Evaluation start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r",
"750/750 [==============================] - 0s 9us/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:178] Evaluation end with time 0.016149044036865234!\n",
"[root |INFO|build_network.py:179] Evaluation: [0.6257709264755249, 0.6813333630561829, 1.0, 0.0, 0.0, 0.5530750155448914]\n",
"[root |INFO|build_network.py:173] Evaluation start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r",
"250/250 [==============================] - 0s 24us/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:178] Evaluation end with time 0.014859676361083984!\n",
"[root |INFO|build_network.py:179] Evaluation: [0.6038214564323425, 0.7120000123977661, 1.0, 0.0, 0.0, 0.47752809524536133]\n",
"[root |INFO|deepbiome.py:199] Compute time : 4.102193593978882\n",
"[root |INFO|deepbiome.py:200] 3 fold computing end!---------------------------------------------\n",
"[root |INFO|deepbiome.py:211] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:212] Train Evaluation : ['loss' 'binary_accuracy' 'sensitivity' 'specificity' 'gmeasure' 'auc']\n",
"[root |INFO|deepbiome.py:213] mean : [0.609 0.700 1.000 0.000 0.000 0.723]\n",
"[root |INFO|deepbiome.py:214] std : [0.017 0.020 0.000 0.000 0.000 0.126]\n",
"[root |INFO|deepbiome.py:215] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:216] Test Evaluation : ['loss' 'binary_accuracy' 'sensitivity' 'specificity' 'gmeasure' 'auc']\n",
"[root |INFO|deepbiome.py:217] mean : [0.616 0.695 1.000 0.000 0.000 0.707]\n",
"[root |INFO|deepbiome.py:218] std : [0.010 0.015 0.000 0.000 0.000 0.165]\n",
"[root |INFO|deepbiome.py:219] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:230] Total Computing Ended\n",
"[root |INFO|deepbiome.py:231] -----------------------------------------------------------------\n"
]
}
],
"source": [
"test_evaluation, train_evaluation, network = deepbiome.deepbiome_train(log, network_info, path_info, number_of_fold=None)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The `deepbiome_train` saves the trained model weights, evaluation results and history based on the path information from the configuration."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Lets check the history files."
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEKCAYAAADjDHn2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzt3Xt8VPWd//HXZyaTC7kQLuGWBDIq\nyEUEwhS1SBSt/tS2XoEVdVvtr/Jbt/bm1t/abh9t190+HnZ//lzbLo/+qt3atauyKIWyFaW7ruu1\nKgERhCgiFwkXCQFCLuQyk8/vj3OSTEKSCcmcnFw+z8djHjNzzplzPhnxvOd8v+d8j6gqxhhjTHcC\nfhdgjDFm4LOwMMYYk5CFhTHGmIQsLIwxxiRkYWGMMSYhCwtjjDEJWVgYY4xJyMLCGGNMQhYWxhhj\nEkrxu4BkGTt2rBYVFfldhjHGDCqbN28+pqp5iZYbMmFRVFREaWmp32UYY8ygIiL7e7KcNUMZY4xJ\nyMLCGGNMQhYWxhhjEhoyfRbGmKGjqamJ8vJy6uvr/S5lyEhPT6egoIBQKNSrz1tYGGMGnPLycrKz\nsykqKkJE/C5n0FNVKisrKS8vJxwO92od1gxljBlw6uvrGTNmjAVFkogIY8aM6dORmoWFMWZAsqBI\nrr5+nxYWdcfhv38Ch9/zuxJjjBmwLCwCQXjlISj7g9+VGGMGiMWLF7Nx48Z20x599FHuueeeLj+T\nlZUFwKFDh1iyZEmny1x++eUJLx5+9NFHqaura31/3XXXcfLkyZ6W7hkLi/SRMGke7HvN70qMMQPE\n8uXLWbVqVbtpq1atYvny5Qk/O2nSJJ577rleb7tjWGzYsIHc3Nxery9ZLCwAwiVQvgkaa/2uxBgz\n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U5ErkJggg==\n",
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"with open('./%s/hist_0.json' % path_info['model_info']['model_dir'], 'r') as f:\n",
" history = json.load(f)\n",
" \n",
"plt.plot(history['val_loss'], label='Validation')\n",
"plt.plot(history['loss'], label='Training')\n",
"plt.legend()\n",
"plt.xlabel('Epochs')\n",
"plt.ylabel('Loss')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Test evauation and train evauation is the numpy array of the shape (number of repetitions, number of evaluation measures)."
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[0.628, 0.676, 1.000, 0.000, 0.000, 0.861],\n",
" [0.616, 0.696, 1.000, 0.000, 0.000, 0.783],\n",
" [0.604, 0.712, 1.000, 0.000, 0.000, 0.478]])"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"test_evaluation"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[0.616, 0.691, 1.000, 0.000, 0.000, 0.854],\n",
" [0.585, 0.728, 1.000, 0.000, 0.000, 0.763],\n",
" [0.626, 0.681, 1.000, 0.000, 0.000, 0.553]])"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"train_evaluation"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 5. Load the pre-trained network for training\n",
"\n",
"If you have a pre-trianed model, you warm_start next training using the pre-trained weights by setting the `warm_start` option in `training_info` to `True`. The file path of the pre-trained weights passed in the `warm_start_model` option. Below is the example:"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"warm_start_network_info = {\n",
" 'architecture_info': {\n",
" 'batch_normalization': 'False',\n",
" 'drop_out': '0',\n",
" 'weight_initial': 'glorot_uniform',\n",
" 'weight_l1_penalty':'0.',\n",
" 'weight_decay': 'phylogenetic_tree',\n",
" },\n",
" 'model_info': {\n",
" 'decay': '0.001',\n",
" 'loss': 'binary_crossentropy',\n",
" 'lr': '0.01',\n",
" 'metrics': 'binary_accuracy, sensitivity, specificity, gmeasure',\n",
" 'network_class': 'DeepBiomeNetwork',\n",
" 'normalizer': 'normalize_minmax',\n",
" 'optimizer': 'adam',\n",
" 'reader_class': 'MicroBiomeClassificationReader',\n",
" 'taxa_selection_metrics': 'sensitivity, specificity, gmeasure, accuracy',\n",
" },\n",
" 'training_info': {\n",
" 'warm_start':'True',\n",
" 'warm_start_model':'./example_result/weight.h5',\n",
" 'batch_size': '50',\n",
" 'epochs': '10',\n",
" 'callbacks': 'ModelCheckpoint',\n",
" 'monitor': 'val_loss',\n",
" 'mode' : 'min',\n",
" 'min_delta': '1e-7',\n",
" },\n",
" 'validation_info': {\n",
" 'batch_size': 'None', \n",
" 'validation_size': '0.2'\n",
" },\n",
" 'test_info': {\n",
" 'batch_size': 'None'\n",
" }\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|deepbiome.py:115] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:153] -------1 simulation start!----------------------------------\n",
"[root |INFO|readers.py:58] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:59] Construct Dataset\n",
"[root |INFO|readers.py:60] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:61] Load data\n",
"[root |INFO|deepbiome.py:164] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:165] Build network for 1 simulation\n",
"[root |INFO|build_network.py:521] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:522] Read phylogenetic tree information from /DATA/home/muha/github_repos/deepbiome/deepbiome/tests/data/genus48_dic.csv\n",
"[root |INFO|build_network.py:528] Phylogenetic tree level list: ['Genus', 'Family', 'Order', 'Class', 'Phylum']\n",
"[root |INFO|build_network.py:529] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:537] Genus: 48\n",
"[root |INFO|build_network.py:537] Family: 40\n",
"[root |INFO|build_network.py:537] Order: 23\n",
"[root |INFO|build_network.py:537] Class: 17\n",
"[root |INFO|build_network.py:537] Phylum: 9\n",
"[root |INFO|build_network.py:546] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:547] Phylogenetic_tree_dict info: ['Phylum', 'Order', 'Family', 'Class', 'Number', 'Genus']\n",
"[root |INFO|build_network.py:548] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Genus, Family]\n",
"[root |INFO|build_network.py:558] Build edge weights between [Family, Order]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Order, Class]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Class, Phylum]\n",
"[root |INFO|build_network.py:571] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:586] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:587] Build network based on phylogenetic tree information\n",
"[root |INFO|build_network.py:588] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:670] ------------------------------------------------------------------------------------------\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Model: \"model_1\"\n",
"_________________________________________________________________\n",
"Layer (type) Output Shape Param # \n",
"=================================================================\n",
"input (InputLayer) (None, 48) 0 \n",
"_________________________________________________________________\n",
"l1_dense (Dense_with_tree) (None, 40) 1960 \n",
"_________________________________________________________________\n",
"l1_activation (Activation) (None, 40) 0 \n",
"_________________________________________________________________\n",
"l2_dense (Dense_with_tree) (None, 23) 943 \n",
"_________________________________________________________________\n",
"l2_activation (Activation) (None, 23) 0 \n",
"_________________________________________________________________\n",
"l3_dense (Dense_with_tree) (None, 17) 408 \n",
"_________________________________________________________________\n",
"l3_activation (Activation) (None, 17) 0 \n",
"_________________________________________________________________\n",
"l4_dense (Dense_with_tree) (None, 9) 162 \n",
"_________________________________________________________________\n",
"l4_activation (Activation) (None, 9) 0 \n",
"_________________________________________________________________\n",
"last_dense_h (Dense) (None, 1) 10 \n",
"_________________________________________________________________\n",
"p_hat (Activation) (None, 1) 0 \n",
"=================================================================\n",
"Total params: 3,483\n",
"Trainable params: 3,483\n",
"Non-trainable params: 0\n",
"_________________________________________________________________\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:61] Build Network\n",
"[root |INFO|build_network.py:62] Optimizer = adam\n",
"[root |INFO|build_network.py:63] Loss = binary_crossentropy\n",
"[root |INFO|build_network.py:64] Metrics = binary_accuracy, sensitivity, specificity, gmeasure\n",
"[root |INFO|build_network.py:87] Load trained model weight at ./example_result/weight_0.h5 \n",
"[root |INFO|deepbiome.py:176] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:177] 1 fold computing start!----------------------------------\n",
"[root |INFO|build_network.py:137] Training start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Train on 600 samples, validate on 150 samples\n",
"Epoch 1/10\n",
"600/600 [==============================] - 0s 797us/step - loss: 0.6207 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.6080 - val_binary_accuracy: 0.7000 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 2/10\n",
"600/600 [==============================] - 0s 123us/step - loss: 0.6181 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.6089 - val_binary_accuracy: 0.7000 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 3/10\n",
"600/600 [==============================] - 0s 107us/step - loss: 0.6151 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.6033 - val_binary_accuracy: 0.7000 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 4/10\n",
"600/600 [==============================] - 0s 118us/step - loss: 0.6123 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.5989 - val_binary_accuracy: 0.7000 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 5/10\n",
"600/600 [==============================] - 0s 126us/step - loss: 0.6060 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.5929 - val_binary_accuracy: 0.7000 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 6/10\n",
"600/600 [==============================] - 0s 149us/step - loss: 0.5992 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.5807 - val_binary_accuracy: 0.7000 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 7/10\n",
"600/600 [==============================] - 0s 144us/step - loss: 0.5838 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.5654 - val_binary_accuracy: 0.7000 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 8/10\n",
"600/600 [==============================] - 0s 165us/step - loss: 0.5646 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.5402 - val_binary_accuracy: 0.7000 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 9/10\n",
"600/600 [==============================] - 0s 158us/step - loss: 0.5396 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.5113 - val_binary_accuracy: 0.7000 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 10/10\n",
"600/600 [==============================] - 0s 136us/step - loss: 0.5159 - binary_accuracy: 0.7067 - sensitivity: 0.9975 - specificity: 0.0588 - gmeasure: 0.0983 - val_loss: 0.4866 - val_binary_accuracy: 0.7467 - val_sensitivity: 0.9447 - val_specificity: 0.2790 - val_gmeasure: 0.5111\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:87] Load trained model weight at ./example_result/weight_0.h5 \n",
"[root |INFO|build_network.py:147] Training end with time 2.830467700958252!\n",
"[root |INFO|build_network.py:83] Saved trained model weight at ./example_result/weight_0.h5 \n",
"[root |DEBUG|deepbiome.py:185] Save weight at ./example_result/weight_0.h5\n",
"[root |DEBUG|deepbiome.py:188] Save history at ./example_result/hist_0.json\n",
"[root |INFO|build_network.py:173] Evaluation start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r",
"750/750 [==============================] - 0s 3us/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:178] Evaluation end with time 0.009613752365112305!\n",
"[root |INFO|build_network.py:179] Evaluation: [0.4993871748447418, 0.7493333220481873, 0.9517374634742737, 0.29741379618644714, 0.5320336818695068]\n",
"[root |INFO|build_network.py:173] Evaluation start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r",
"250/250 [==============================] - 0s 8us/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:178] Evaluation end with time 0.008378982543945312!\n",
"[root |INFO|build_network.py:179] Evaluation: [0.5000216364860535, 0.7480000257492065, 0.9585798978805542, 0.3086419701576233, 0.543928325176239]\n",
"[root |INFO|deepbiome.py:199] Compute time : 3.409234046936035\n",
"[root |INFO|deepbiome.py:200] 1 fold computing end!---------------------------------------------\n",
"[root |INFO|deepbiome.py:153] -------2 simulation start!----------------------------------\n",
"[root |INFO|readers.py:58] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:59] Construct Dataset\n",
"[root |INFO|readers.py:60] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:61] Load data\n",
"[root |INFO|deepbiome.py:164] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:165] Build network for 2 simulation\n",
"[root |INFO|build_network.py:521] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:522] Read phylogenetic tree information from /DATA/home/muha/github_repos/deepbiome/deepbiome/tests/data/genus48_dic.csv\n",
"[root |INFO|build_network.py:528] Phylogenetic tree level list: ['Genus', 'Family', 'Order', 'Class', 'Phylum']\n",
"[root |INFO|build_network.py:529] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:537] Genus: 48\n",
"[root |INFO|build_network.py:537] Family: 40\n",
"[root |INFO|build_network.py:537] Order: 23\n",
"[root |INFO|build_network.py:537] Class: 17\n",
"[root |INFO|build_network.py:537] Phylum: 9\n",
"[root |INFO|build_network.py:546] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:547] Phylogenetic_tree_dict info: ['Phylum', 'Order', 'Family', 'Class', 'Number', 'Genus']\n",
"[root |INFO|build_network.py:548] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Genus, Family]\n",
"[root |INFO|build_network.py:558] Build edge weights between [Family, Order]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Order, Class]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Class, Phylum]\n",
"[root |INFO|build_network.py:571] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:586] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:587] Build network based on phylogenetic tree information\n",
"[root |INFO|build_network.py:588] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:670] ------------------------------------------------------------------------------------------\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Model: \"model_1\"\n",
"_________________________________________________________________\n",
"Layer (type) Output Shape Param # \n",
"=================================================================\n",
"input (InputLayer) (None, 48) 0 \n",
"_________________________________________________________________\n",
"l1_dense (Dense_with_tree) (None, 40) 1960 \n",
"_________________________________________________________________\n",
"l1_activation (Activation) (None, 40) 0 \n",
"_________________________________________________________________\n",
"l2_dense (Dense_with_tree) (None, 23) 943 \n",
"_________________________________________________________________\n",
"l2_activation (Activation) (None, 23) 0 \n",
"_________________________________________________________________\n",
"l3_dense (Dense_with_tree) (None, 17) 408 \n",
"_________________________________________________________________\n",
"l3_activation (Activation) (None, 17) 0 \n",
"_________________________________________________________________\n",
"l4_dense (Dense_with_tree) (None, 9) 162 \n",
"_________________________________________________________________\n",
"l4_activation (Activation) (None, 9) 0 \n",
"_________________________________________________________________\n",
"last_dense_h (Dense) (None, 1) 10 \n",
"_________________________________________________________________\n",
"p_hat (Activation) (None, 1) 0 \n",
"=================================================================\n",
"Total params: 3,483\n",
"Trainable params: 3,483\n",
"Non-trainable params: 0\n",
"_________________________________________________________________\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:61] Build Network\n",
"[root |INFO|build_network.py:62] Optimizer = adam\n",
"[root |INFO|build_network.py:63] Loss = binary_crossentropy\n",
"[root |INFO|build_network.py:64] Metrics = binary_accuracy, sensitivity, specificity, gmeasure\n",
"[root |INFO|build_network.py:87] Load trained model weight at ./example_result/weight_1.h5 \n",
"[root |INFO|deepbiome.py:176] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:177] 2 fold computing start!----------------------------------\n",
"[root |INFO|build_network.py:137] Training start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Train on 600 samples, validate on 150 samples\n",
"Epoch 1/10\n",
"600/600 [==============================] - 0s 830us/step - loss: 0.5858 - binary_accuracy: 0.7283 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.5866 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 2/10\n",
"600/600 [==============================] - 0s 159us/step - loss: 0.5853 - binary_accuracy: 0.7283 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.5865 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 3/10\n",
"600/600 [==============================] - 0s 148us/step - loss: 0.5857 - binary_accuracy: 0.7283 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.5867 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 4/10\n",
"600/600 [==============================] - 0s 126us/step - loss: 0.5862 - binary_accuracy: 0.7283 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.5869 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 5/10\n",
"600/600 [==============================] - 0s 124us/step - loss: 0.5852 - binary_accuracy: 0.7283 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.5865 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 6/10\n",
"600/600 [==============================] - 0s 108us/step - loss: 0.5853 - binary_accuracy: 0.7283 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.5864 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 7/10\n",
"600/600 [==============================] - 0s 126us/step - loss: 0.5851 - binary_accuracy: 0.7283 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.5863 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 8/10\n",
"600/600 [==============================] - 0s 117us/step - loss: 0.5853 - binary_accuracy: 0.7283 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.5862 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 9/10\n",
"600/600 [==============================] - 0s 158us/step - loss: 0.5854 - binary_accuracy: 0.7283 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.5862 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 10/10\n",
"600/600 [==============================] - 0s 112us/step - loss: 0.5848 - binary_accuracy: 0.7283 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.5860 - val_binary_accuracy: 0.7267 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:87] Load trained model weight at ./example_result/weight_1.h5 \n",
"[root |INFO|build_network.py:147] Training end with time 2.74385929107666!\n",
"[root |INFO|build_network.py:83] Saved trained model weight at ./example_result/weight_1.h5 \n",
"[root |DEBUG|deepbiome.py:185] Save weight at ./example_result/weight_1.h5\n",
"[root |DEBUG|deepbiome.py:188] Save history at ./example_result/hist_1.json\n",
"[root |INFO|build_network.py:173] Evaluation start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r",
"750/750 [==============================] - 0s 5us/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:178] Evaluation end with time 0.01107335090637207!\n",
"[root |INFO|build_network.py:179] Evaluation: [0.5847012400627136, 0.7279999852180481, 1.0, 0.0, 0.0]\n",
"[root |INFO|build_network.py:173] Evaluation start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r",
"250/250 [==============================] - 0s 10us/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:178] Evaluation end with time 0.009724140167236328!\n",
"[root |INFO|build_network.py:179] Evaluation: [0.617382287979126, 0.6959999799728394, 1.0, 0.0, 0.0]\n",
"[root |INFO|deepbiome.py:199] Compute time : 3.649474859237671\n",
"[root |INFO|deepbiome.py:200] 2 fold computing end!---------------------------------------------\n",
"[root |INFO|deepbiome.py:153] -------3 simulation start!----------------------------------\n",
"[root |INFO|readers.py:58] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:59] Construct Dataset\n",
"[root |INFO|readers.py:60] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:61] Load data\n",
"[root |INFO|deepbiome.py:164] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:165] Build network for 3 simulation\n",
"[root |INFO|build_network.py:521] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:522] Read phylogenetic tree information from /DATA/home/muha/github_repos/deepbiome/deepbiome/tests/data/genus48_dic.csv\n",
"[root |INFO|build_network.py:528] Phylogenetic tree level list: ['Genus', 'Family', 'Order', 'Class', 'Phylum']\n",
"[root |INFO|build_network.py:529] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:537] Genus: 48\n",
"[root |INFO|build_network.py:537] Family: 40\n",
"[root |INFO|build_network.py:537] Order: 23\n",
"[root |INFO|build_network.py:537] Class: 17\n",
"[root |INFO|build_network.py:537] Phylum: 9\n",
"[root |INFO|build_network.py:546] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:547] Phylogenetic_tree_dict info: ['Phylum', 'Order', 'Family', 'Class', 'Number', 'Genus']\n",
"[root |INFO|build_network.py:548] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Genus, Family]\n",
"[root |INFO|build_network.py:558] Build edge weights between [Family, Order]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Order, Class]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Class, Phylum]\n",
"[root |INFO|build_network.py:571] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:586] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:587] Build network based on phylogenetic tree information\n",
"[root |INFO|build_network.py:588] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:670] ------------------------------------------------------------------------------------------\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Model: \"model_1\"\n",
"_________________________________________________________________\n",
"Layer (type) Output Shape Param # \n",
"=================================================================\n",
"input (InputLayer) (None, 48) 0 \n",
"_________________________________________________________________\n",
"l1_dense (Dense_with_tree) (None, 40) 1960 \n",
"_________________________________________________________________\n",
"l1_activation (Activation) (None, 40) 0 \n",
"_________________________________________________________________\n",
"l2_dense (Dense_with_tree) (None, 23) 943 \n",
"_________________________________________________________________\n",
"l2_activation (Activation) (None, 23) 0 \n",
"_________________________________________________________________\n",
"l3_dense (Dense_with_tree) (None, 17) 408 \n",
"_________________________________________________________________\n",
"l3_activation (Activation) (None, 17) 0 \n",
"_________________________________________________________________\n",
"l4_dense (Dense_with_tree) (None, 9) 162 \n",
"_________________________________________________________________\n",
"l4_activation (Activation) (None, 9) 0 \n",
"_________________________________________________________________\n",
"last_dense_h (Dense) (None, 1) 10 \n",
"_________________________________________________________________\n",
"p_hat (Activation) (None, 1) 0 \n",
"=================================================================\n",
"Total params: 3,483\n",
"Trainable params: 3,483\n",
"Non-trainable params: 0\n",
"_________________________________________________________________\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:61] Build Network\n",
"[root |INFO|build_network.py:62] Optimizer = adam\n",
"[root |INFO|build_network.py:63] Loss = binary_crossentropy\n",
"[root |INFO|build_network.py:64] Metrics = binary_accuracy, sensitivity, specificity, gmeasure\n",
"[root |INFO|build_network.py:87] Load trained model weight at ./example_result/weight_2.h5 \n",
"[root |INFO|deepbiome.py:176] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:177] 3 fold computing start!----------------------------------\n",
"[root |INFO|build_network.py:137] Training start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Train on 600 samples, validate on 150 samples\n",
"Epoch 1/10\n",
"600/600 [==============================] - 1s 1ms/step - loss: 0.6220 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.6461 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 2/10\n",
"600/600 [==============================] - 0s 451us/step - loss: 0.6220 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.6533 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 3/10\n",
"600/600 [==============================] - 0s 377us/step - loss: 0.6229 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.6460 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 4/10\n",
"600/600 [==============================] - 0s 134us/step - loss: 0.6208 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.6482 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 5/10\n",
"600/600 [==============================] - 0s 388us/step - loss: 0.6204 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.6482 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 6/10\n",
"600/600 [==============================] - 0s 454us/step - loss: 0.6198 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.6467 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 7/10\n",
"600/600 [==============================] - 0s 149us/step - loss: 0.6202 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.6470 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 8/10\n",
"600/600 [==============================] - 0s 127us/step - loss: 0.6199 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.6466 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 9/10\n",
"600/600 [==============================] - 0s 295us/step - loss: 0.6196 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.6454 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n",
"Epoch 10/10\n",
"600/600 [==============================] - 0s 529us/step - loss: 0.6201 - binary_accuracy: 0.6883 - sensitivity: 1.0000 - specificity: 0.0000e+00 - gmeasure: 0.0000e+00 - val_loss: 0.6478 - val_binary_accuracy: 0.6533 - val_sensitivity: 1.0000 - val_specificity: 0.0000e+00 - val_gmeasure: 0.0000e+00\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:87] Load trained model weight at ./example_result/weight_2.h5 \n",
"[root |INFO|build_network.py:147] Training end with time 4.314647912979126!\n",
"[root |INFO|build_network.py:83] Saved trained model weight at ./example_result/weight_2.h5 \n",
"[root |DEBUG|deepbiome.py:185] Save weight at ./example_result/weight_2.h5\n",
"[root |DEBUG|deepbiome.py:188] Save history at ./example_result/hist_2.json\n",
"[root |INFO|build_network.py:173] Evaluation start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r",
"750/750 [==============================] - 0s 3us/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:178] Evaluation end with time 0.009068727493286133!\n",
"[root |INFO|build_network.py:179] Evaluation: [0.6245588660240173, 0.6813333630561829, 1.0, 0.0, 0.0]\n",
"[root |INFO|build_network.py:173] Evaluation start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r",
"250/250 [==============================] - 0s 11us/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:178] Evaluation end with time 0.008772611618041992!\n",
"[root |INFO|build_network.py:179] Evaluation: [0.6026607751846313, 0.7120000123977661, 1.0, 0.0, 0.0]\n",
"[root |INFO|deepbiome.py:199] Compute time : 4.939546346664429\n",
"[root |INFO|deepbiome.py:200] 3 fold computing end!---------------------------------------------\n",
"[root |INFO|deepbiome.py:211] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:212] Train Evaluation : ['loss' 'binary_accuracy' 'sensitivity' 'specificity' 'gmeasure']\n",
"[root |INFO|deepbiome.py:213] mean : [0.570 0.720 0.984 0.099 0.177]\n",
"[root |INFO|deepbiome.py:214] std : [0.052 0.028 0.023 0.140 0.251]\n",
"[root |INFO|deepbiome.py:215] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:216] Test Evaluation : ['loss' 'binary_accuracy' 'sensitivity' 'specificity' 'gmeasure']\n",
"[root |INFO|deepbiome.py:217] mean : [0.573 0.719 0.986 0.103 0.181]\n",
"[root |INFO|deepbiome.py:218] std : [0.052 0.022 0.020 0.145 0.256]\n",
"[root |INFO|deepbiome.py:219] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:230] Total Computing Ended\n",
"[root |INFO|deepbiome.py:231] -----------------------------------------------------------------\n"
]
}
],
"source": [
"test_evaluation, train_evaluation, network = deepbiome.deepbiome_train(log, warm_start_network_info, path_info, \n",
" number_of_fold=None)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Let's check the history plot again."
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEKCAYAAADjDHn2AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMS4yLCBo\ndHRwOi8vbWF0cGxvdGxpYi5vcmcvNQv5yAAAIABJREFUeJzt3Xl8VNXdx/HPL5N9hSysCSRAWGVN\nDMqiIiqgAi6IIqCgiNIq1bZWan2s2vrUqvXBrVZkEXABhCJqRUSloqJAQEB2wh7CEgIkBELW8/xx\nb0LAQCJk5k6S3/v1ui9m7tw782PEfHPOufccMcaglFJKnY+P0wUopZTyfhoWSimlKqVhoZRSqlIa\nFkoppSqlYaGUUqpSGhZKKaUqpWGhlFKqUhoWSimlKqVhoZRSqlK+ThdQXaKjo018fLzTZSilVI2y\natWqw8aYmMqOqzVhER8fT2pqqtNlKKVUjSIiu6tynHZDKaWUqpSGhVJKqUppWCillKpUrRmzUErV\nHoWFhaSnp3Pq1CmnS6k1AgMDiY2Nxc/P74LO17BQSnmd9PR0wsLCiI+PR0ScLqfGM8aQlZVFeno6\nCQkJF/Qe2g2llPI6p06dIioqSoOimogIUVFRF9VSc2tYiEh/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uv5xSVaF3cCtVCRHJNcaEVrB/F3C1MWaHPQHjAWNMlIgcBhobYwrt/fuNMdEi\nkgnEGmPyy71HPLDYGJNoP38M8DPG/FVEPgNygQ+BD40xuW7+qyp1TtqyUOrimHM8/iXyyz0u5vRY\n4g1YKzl2A1bai+wo5QgNC6Uuzu3l/vzefryM00tsDge+sR9/CYyDsrW9I871piLiA8QZY5YAjwER\nwM9aN0p5iv6molTlgsrNwgvWOtSll8/WF5F1WK2DYfa+h7BWlHsUa3W50tlZfwNMEpF7sVoQ47BW\nWauIC3jHDhQBXtFlTJWTdMxCqQtkj1kkG2MOO12LUu6m3VBKKaUqpS0LpZRSldKWhVJKqUppWCil\nlKqUhoVSSqlKaVgopZSqlIaFUkqpSmlYKKWUqtT/A4y8RdqoXiVHAAAAAElFTkSuQmCC\n",
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"with open('./%s/hist_0.json' % path_info['model_info']['model_dir'], 'r') as f:\n",
" history = json.load(f)\n",
" \n",
"plt.plot(history['val_loss'], label='Validation')\n",
"plt.plot(history['loss'], label='Training')\n",
"plt.legend()\n",
"plt.xlabel('Epochs')\n",
"plt.ylabel('Loss')\n",
"plt.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 6. Load the pre-trained network for testing\n",
"\n",
"To test the trained model, we can use the `deepbiome_test` function. \n",
"\n",
"If you use the index file (`idx_path`), this function provides the evaluation using the test index (index set not included in the index file) for each fold. If not, this function provides the evaluation using the whole samples. \n",
"\n",
"If `number_of_fold` is set to `k`, the function will test the model only with first `k` repetitions.\n",
"\n",
"We can use the testing metrics different with the training. In the example below, we additionally used `AUC` metric."
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"test_network_info = {\n",
" 'architecture_info': {\n",
" 'batch_normalization': 'False',\n",
" 'drop_out': '0',\n",
" 'weight_initial': 'glorot_uniform',\n",
" 'weight_l1_penalty':'0.',\n",
" 'weight_decay': 'phylogenetic_tree',\n",
" },\n",
" 'model_info': {\n",
" 'lr': '0.01',\n",
" 'decay': '0.001',\n",
" 'loss': 'binary_crossentropy',\n",
" 'metrics': 'binary_accuracy, sensitivity, specificity, gmeasure, auc',\n",
" 'taxa_selection_metrics': 'sensitivity, specificity, gmeasure, accuracy',\n",
" 'network_class': 'DeepBiomeNetwork',\n",
" 'optimizer': 'adam',\n",
" 'reader_class': 'MicroBiomeClassificationReader',\n",
" 'normalizer': 'normalize_minmax',\n",
" },\n",
" 'test_info': {\n",
" 'batch_size': 'None'\n",
" }\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"test_path_info = {\n",
" 'data_info': {\n",
" 'count_list_path': resource_filename('deepbiome', 'tests/data/gcount_list.csv'),\n",
" 'count_path': resource_filename('deepbiome', 'tests/data/count'),\n",
" 'data_path': resource_filename('deepbiome', 'tests/data'),\n",
" 'idx_path': resource_filename('deepbiome', 'tests/data/classification_idx.csv'),\n",
" 'tree_info_path': resource_filename('deepbiome', 'tests/data/genus48_dic.csv'),\n",
" 'x_path': '',\n",
" 'y_path': 'classification_y.csv'\n",
" },\n",
" 'model_info': {\n",
" 'evaluation': 'eval.npy',\n",
" 'model_dir': './example_result/',\n",
" 'weight': 'weight.h5'\n",
" }\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|deepbiome.py:293] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:325] Test Evaluation : ['loss' 'binary_accuracy' 'sensitivity' 'specificity' 'gmeasure' 'auc']\n",
"[root |INFO|deepbiome.py:327] -------1 fold test start!----------------------------------\n",
"[root |INFO|readers.py:58] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:59] Construct Dataset\n",
"[root |INFO|readers.py:60] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:61] Load data\n",
"[root |INFO|deepbiome.py:338] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:339] Build network for 1 fold testing\n",
"[root |INFO|build_network.py:521] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:522] Read phylogenetic tree information from /DATA/home/muha/github_repos/deepbiome/deepbiome/tests/data/genus48_dic.csv\n",
"[root |INFO|build_network.py:528] Phylogenetic tree level list: ['Genus', 'Family', 'Order', 'Class', 'Phylum']\n",
"[root |INFO|build_network.py:529] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:537] Genus: 48\n",
"[root |INFO|build_network.py:537] Family: 40\n",
"[root |INFO|build_network.py:537] Order: 23\n",
"[root |INFO|build_network.py:537] Class: 17\n",
"[root |INFO|build_network.py:537] Phylum: 9\n",
"[root |INFO|build_network.py:546] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:547] Phylogenetic_tree_dict info: ['Phylum', 'Order', 'Family', 'Class', 'Number', 'Genus']\n",
"[root |INFO|build_network.py:548] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Genus, Family]\n",
"[root |INFO|build_network.py:558] Build edge weights between [Family, Order]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Order, Class]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Class, Phylum]\n",
"[root |INFO|build_network.py:571] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:586] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:587] Build network based on phylogenetic tree information\n",
"[root |INFO|build_network.py:588] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:670] ------------------------------------------------------------------------------------------\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Model: \"model_1\"\n",
"_________________________________________________________________\n",
"Layer (type) Output Shape Param # \n",
"=================================================================\n",
"input (InputLayer) (None, 48) 0 \n",
"_________________________________________________________________\n",
"l1_dense (Dense_with_tree) (None, 40) 1960 \n",
"_________________________________________________________________\n",
"l1_activation (Activation) (None, 40) 0 \n",
"_________________________________________________________________\n",
"l2_dense (Dense_with_tree) (None, 23) 943 \n",
"_________________________________________________________________\n",
"l2_activation (Activation) (None, 23) 0 \n",
"_________________________________________________________________\n",
"l3_dense (Dense_with_tree) (None, 17) 408 \n",
"_________________________________________________________________\n",
"l3_activation (Activation) (None, 17) 0 \n",
"_________________________________________________________________\n",
"l4_dense (Dense_with_tree) (None, 9) 162 \n",
"_________________________________________________________________\n",
"l4_activation (Activation) (None, 9) 0 \n",
"_________________________________________________________________\n",
"last_dense_h (Dense) (None, 1) 10 \n",
"_________________________________________________________________\n",
"p_hat (Activation) (None, 1) 0 \n",
"=================================================================\n",
"Total params: 3,483\n",
"Trainable params: 3,483\n",
"Non-trainable params: 0\n",
"_________________________________________________________________\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:61] Build Network\n",
"[root |INFO|build_network.py:62] Optimizer = adam\n",
"[root |INFO|build_network.py:63] Loss = binary_crossentropy\n",
"[root |INFO|build_network.py:64] Metrics = binary_accuracy, sensitivity, specificity, gmeasure, auc\n",
"[root |INFO|build_network.py:87] Load trained model weight at ./example_result/weight_0.h5 \n",
"[root |INFO|deepbiome.py:350] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:351] 1 fold computing start!----------------------------------\n",
"[root |INFO|build_network.py:173] Evaluation start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r",
"250/250 [==============================] - 0s 352us/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:178] Evaluation end with time 0.2729969024658203!\n",
"[root |INFO|build_network.py:179] Evaluation: [0.5000216364860535, 0.7480000257492065, 0.9585798978805542, 0.3086419701576233, 0.543928325176239, 0.8766162395477295]\n",
"[root |INFO|deepbiome.py:356] \n",
"[root |INFO|deepbiome.py:357] Compute time : 0.9056384563446045\n",
"[root |INFO|deepbiome.py:358] 1 fold computing end!---------------------------------------------\n",
"[root |INFO|deepbiome.py:327] -------2 fold test start!----------------------------------\n",
"[root |INFO|readers.py:58] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:59] Construct Dataset\n",
"[root |INFO|readers.py:60] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:61] Load data\n",
"[root |INFO|deepbiome.py:338] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:339] Build network for 2 fold testing\n",
"[root |INFO|build_network.py:521] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:522] Read phylogenetic tree information from /DATA/home/muha/github_repos/deepbiome/deepbiome/tests/data/genus48_dic.csv\n",
"[root |INFO|build_network.py:528] Phylogenetic tree level list: ['Genus', 'Family', 'Order', 'Class', 'Phylum']\n",
"[root |INFO|build_network.py:529] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:537] Genus: 48\n",
"[root |INFO|build_network.py:537] Family: 40\n",
"[root |INFO|build_network.py:537] Order: 23\n",
"[root |INFO|build_network.py:537] Class: 17\n",
"[root |INFO|build_network.py:537] Phylum: 9\n",
"[root |INFO|build_network.py:546] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:547] Phylogenetic_tree_dict info: ['Phylum', 'Order', 'Family', 'Class', 'Number', 'Genus']\n",
"[root |INFO|build_network.py:548] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Genus, Family]\n",
"[root |INFO|build_network.py:558] Build edge weights between [Family, Order]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Order, Class]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Class, Phylum]\n",
"[root |INFO|build_network.py:571] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:586] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:587] Build network based on phylogenetic tree information\n",
"[root |INFO|build_network.py:588] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:670] ------------------------------------------------------------------------------------------\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Model: \"model_1\"\n",
"_________________________________________________________________\n",
"Layer (type) Output Shape Param # \n",
"=================================================================\n",
"input (InputLayer) (None, 48) 0 \n",
"_________________________________________________________________\n",
"l1_dense (Dense_with_tree) (None, 40) 1960 \n",
"_________________________________________________________________\n",
"l1_activation (Activation) (None, 40) 0 \n",
"_________________________________________________________________\n",
"l2_dense (Dense_with_tree) (None, 23) 943 \n",
"_________________________________________________________________\n",
"l2_activation (Activation) (None, 23) 0 \n",
"_________________________________________________________________\n",
"l3_dense (Dense_with_tree) (None, 17) 408 \n",
"_________________________________________________________________\n",
"l3_activation (Activation) (None, 17) 0 \n",
"_________________________________________________________________\n",
"l4_dense (Dense_with_tree) (None, 9) 162 \n",
"_________________________________________________________________\n",
"l4_activation (Activation) (None, 9) 0 \n",
"_________________________________________________________________\n",
"last_dense_h (Dense) (None, 1) 10 \n",
"_________________________________________________________________\n",
"p_hat (Activation) (None, 1) 0 \n",
"=================================================================\n",
"Total params: 3,483\n",
"Trainable params: 3,483\n",
"Non-trainable params: 0\n",
"_________________________________________________________________\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:61] Build Network\n",
"[root |INFO|build_network.py:62] Optimizer = adam\n",
"[root |INFO|build_network.py:63] Loss = binary_crossentropy\n",
"[root |INFO|build_network.py:64] Metrics = binary_accuracy, sensitivity, specificity, gmeasure, auc\n",
"[root |INFO|build_network.py:87] Load trained model weight at ./example_result/weight_1.h5 \n",
"[root |INFO|deepbiome.py:350] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:351] 2 fold computing start!----------------------------------\n",
"[root |INFO|build_network.py:173] Evaluation start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r",
"250/250 [==============================] - 0s 353us/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:178] Evaluation end with time 0.25853705406188965!\n",
"[root |INFO|build_network.py:179] Evaluation: [0.617382287979126, 0.6959999799728394, 1.0, 0.0, 0.0, 0.8632410764694214]\n",
"[root |INFO|deepbiome.py:356] \n",
"[root |INFO|deepbiome.py:357] Compute time : 0.8716459274291992\n",
"[root |INFO|deepbiome.py:358] 2 fold computing end!---------------------------------------------\n",
"[root |INFO|deepbiome.py:327] -------3 fold test start!----------------------------------\n",
"[root |INFO|readers.py:58] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:59] Construct Dataset\n",
"[root |INFO|readers.py:60] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:61] Load data\n",
"[root |INFO|deepbiome.py:338] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:339] Build network for 3 fold testing\n",
"[root |INFO|build_network.py:521] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:522] Read phylogenetic tree information from /DATA/home/muha/github_repos/deepbiome/deepbiome/tests/data/genus48_dic.csv\n",
"[root |INFO|build_network.py:528] Phylogenetic tree level list: ['Genus', 'Family', 'Order', 'Class', 'Phylum']\n",
"[root |INFO|build_network.py:529] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:537] Genus: 48\n",
"[root |INFO|build_network.py:537] Family: 40\n",
"[root |INFO|build_network.py:537] Order: 23\n",
"[root |INFO|build_network.py:537] Class: 17\n",
"[root |INFO|build_network.py:537] Phylum: 9\n",
"[root |INFO|build_network.py:546] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:547] Phylogenetic_tree_dict info: ['Phylum', 'Order', 'Family', 'Class', 'Number', 'Genus']\n",
"[root |INFO|build_network.py:548] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Genus, Family]\n",
"[root |INFO|build_network.py:558] Build edge weights between [Family, Order]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Order, Class]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Class, Phylum]\n",
"[root |INFO|build_network.py:571] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:586] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:587] Build network based on phylogenetic tree information\n",
"[root |INFO|build_network.py:588] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:670] ------------------------------------------------------------------------------------------\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Model: \"model_1\"\n",
"_________________________________________________________________\n",
"Layer (type) Output Shape Param # \n",
"=================================================================\n",
"input (InputLayer) (None, 48) 0 \n",
"_________________________________________________________________\n",
"l1_dense (Dense_with_tree) (None, 40) 1960 \n",
"_________________________________________________________________\n",
"l1_activation (Activation) (None, 40) 0 \n",
"_________________________________________________________________\n",
"l2_dense (Dense_with_tree) (None, 23) 943 \n",
"_________________________________________________________________\n",
"l2_activation (Activation) (None, 23) 0 \n",
"_________________________________________________________________\n",
"l3_dense (Dense_with_tree) (None, 17) 408 \n",
"_________________________________________________________________\n",
"l3_activation (Activation) (None, 17) 0 \n",
"_________________________________________________________________\n",
"l4_dense (Dense_with_tree) (None, 9) 162 \n",
"_________________________________________________________________\n",
"l4_activation (Activation) (None, 9) 0 \n",
"_________________________________________________________________\n",
"last_dense_h (Dense) (None, 1) 10 \n",
"_________________________________________________________________\n",
"p_hat (Activation) (None, 1) 0 \n",
"=================================================================\n",
"Total params: 3,483\n",
"Trainable params: 3,483\n",
"Non-trainable params: 0\n",
"_________________________________________________________________\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:61] Build Network\n",
"[root |INFO|build_network.py:62] Optimizer = adam\n",
"[root |INFO|build_network.py:63] Loss = binary_crossentropy\n",
"[root |INFO|build_network.py:64] Metrics = binary_accuracy, sensitivity, specificity, gmeasure, auc\n",
"[root |INFO|build_network.py:87] Load trained model weight at ./example_result/weight_2.h5 \n",
"[root |INFO|deepbiome.py:350] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:351] 3 fold computing start!----------------------------------\n",
"[root |INFO|build_network.py:173] Evaluation start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r",
"250/250 [==============================] - 0s 381us/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:178] Evaluation end with time 0.28519654273986816!\n",
"[root |INFO|build_network.py:179] Evaluation: [0.6026607751846313, 0.7120000123977661, 1.0, 0.0, 0.0, 0.5095973610877991]\n",
"[root |INFO|deepbiome.py:356] \n",
"[root |INFO|deepbiome.py:357] Compute time : 0.8778982162475586\n",
"[root |INFO|deepbiome.py:358] 3 fold computing end!---------------------------------------------\n",
"[root |INFO|deepbiome.py:367] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:368] Test Evaluation : ['loss' 'binary_accuracy' 'sensitivity' 'specificity' 'gmeasure' 'auc']\n",
"[root |INFO|deepbiome.py:369] mean : [0.573 0.719 0.986 0.103 0.181 0.750]\n",
"[root |INFO|deepbiome.py:370] std : [0.052 0.022 0.020 0.145 0.256 0.170]\n",
"[root |INFO|deepbiome.py:371] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:372] Total Computing Ended\n",
"[root |INFO|deepbiome.py:373] -----------------------------------------------------------------\n"
]
}
],
"source": [
"evaluation = deepbiome.deepbiome_test(log, test_network_info, test_path_info, number_of_fold=None)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This function provides the evaluation result as a numpy array with a shape of (number of repetition, number of evaluation measures)."
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" loss binary_accuracy sensitivity specificity gmeasure auc\n",
"Mean: 0.573 0.719 0.986 0.103 0.181 0.750\n",
"Std : 0.052 0.022 0.020 0.145 0.256 0.170\n"
]
}
],
"source": [
"print(' %s' % ''.join(['%16s'%'loss']+ ['%16s'%s.strip() for s in network_info['model_info']['metrics'].split(',')]))\n",
"print('Mean: %s' % ''.join(['%16.3f'%v for v in np.mean(evaluation, axis=0)]))\n",
"print('Std : %s' % ''.join(['%16.3f'%v for v in np.std(evaluation, axis=0)]))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 7. Load the pre-trained network for prediction\n",
"\n",
"If you want to predict using the pre-trained model, you can use the `deepbiome_prediction` function. If `number_of_fold` is setted as `k`, the function will predict only with first `k` repetitions sample's outputs. \n",
"\n",
"If `change_weight_for_each_fold` is set as `False`, the function will predict the output of every repetition by same weight from the given path. If `change_weight_for_each_fold` is set as `True`, the function will predict the output of by each repetition weight.\n",
"\n",
"If 'get_y=True', the function will provide a list of tuples (prediction, true output) as a output with the shape of `(n_samples, 2, n_classes)`. If 'get_y=False', the function will provide predictions only. The output will have the shape of `(n_samples, n_classes)`."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 7.1 Prediction with fixed weight\n",
"\n",
"If we want to predict new data from one pre-trained model, we can use the option below. We fixed the weight `weight_0.h5` for predicting the whole samples (without using index file)."
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"prediction_network_info = {\n",
" 'architecture_info': {\n",
" 'batch_normalization': 'False',\n",
" 'drop_out': '0',\n",
" 'weight_initial': 'glorot_uniform',\n",
" 'weight_l1_penalty':'0.',\n",
" 'weight_decay': 'phylogenetic_tree',\n",
" },\n",
" 'model_info': {\n",
" 'decay': '0.001',\n",
" 'loss': 'binary_crossentropy',\n",
" 'lr': '0.01',\n",
" 'metrics': 'binary_accuracy, sensitivity, specificity, gmeasure, auc',\n",
" 'network_class': 'DeepBiomeNetwork',\n",
" 'normalizer': 'normalize_minmax',\n",
" 'optimizer': 'adam',\n",
" 'reader_class': 'MicroBiomeClassificationReader',\n",
" 'taxa_selection_metrics': 'sensitivity, specificity, gmeasure, accuracy',\n",
" },\n",
" 'test_info': {\n",
" 'batch_size': 'None'\n",
" }\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"prediction_path_info = {\n",
" 'data_info': {\n",
" 'count_list_path': resource_filename('deepbiome', 'tests/data/gcount_list.csv'),\n",
" 'count_path': resource_filename('deepbiome', 'tests/data/count'),\n",
" 'data_path': resource_filename('deepbiome', 'tests/data'),\n",
" 'tree_info_path': resource_filename('deepbiome', 'tests/data/genus48_dic.csv'),\n",
" 'x_path': '',\n",
" },\n",
" 'model_info': {\n",
" 'model_dir': './example_result/',\n",
" 'weight': 'weight_0.h5'\n",
" }\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|deepbiome.py:450] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:480] -------1 th repeatition prediction start!----------------------------------\n",
"[root |INFO|readers.py:58] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:59] Construct Dataset\n",
"[root |INFO|readers.py:60] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:61] Load data\n",
"[root |INFO|deepbiome.py:498] -----------------------------------------------------------------\n",
"[root |INFO|build_network.py:521] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:522] Read phylogenetic tree information from /DATA/home/muha/github_repos/deepbiome/deepbiome/tests/data/genus48_dic.csv\n",
"[root |INFO|build_network.py:528] Phylogenetic tree level list: ['Genus', 'Family', 'Order', 'Class', 'Phylum']\n",
"[root |INFO|build_network.py:529] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:537] Genus: 48\n",
"[root |INFO|build_network.py:537] Family: 40\n",
"[root |INFO|build_network.py:537] Order: 23\n",
"[root |INFO|build_network.py:537] Class: 17\n",
"[root |INFO|build_network.py:537] Phylum: 9\n",
"[root |INFO|build_network.py:546] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:547] Phylogenetic_tree_dict info: ['Phylum', 'Order', 'Family', 'Class', 'Number', 'Genus']\n",
"[root |INFO|build_network.py:548] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Genus, Family]\n",
"[root |INFO|build_network.py:558] Build edge weights between [Family, Order]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Order, Class]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Class, Phylum]\n",
"[root |INFO|build_network.py:571] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:586] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:587] Build network based on phylogenetic tree information\n",
"[root |INFO|build_network.py:588] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:670] ------------------------------------------------------------------------------------------\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Model: \"model_1\"\n",
"_________________________________________________________________\n",
"Layer (type) Output Shape Param # \n",
"=================================================================\n",
"input (InputLayer) (None, 48) 0 \n",
"_________________________________________________________________\n",
"l1_dense (Dense_with_tree) (None, 40) 1960 \n",
"_________________________________________________________________\n",
"l1_activation (Activation) (None, 40) 0 \n",
"_________________________________________________________________\n",
"l2_dense (Dense_with_tree) (None, 23) 943 \n",
"_________________________________________________________________\n",
"l2_activation (Activation) (None, 23) 0 \n",
"_________________________________________________________________\n",
"l3_dense (Dense_with_tree) (None, 17) 408 \n",
"_________________________________________________________________\n",
"l3_activation (Activation) (None, 17) 0 \n",
"_________________________________________________________________\n",
"l4_dense (Dense_with_tree) (None, 9) 162 \n",
"_________________________________________________________________\n",
"l4_activation (Activation) (None, 9) 0 \n",
"_________________________________________________________________\n",
"last_dense_h (Dense) (None, 1) 10 \n",
"_________________________________________________________________\n",
"p_hat (Activation) (None, 1) 0 \n",
"=================================================================\n",
"Total params: 3,483\n",
"Trainable params: 3,483\n",
"Non-trainable params: 0\n",
"_________________________________________________________________\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:61] Build Network\n",
"[root |INFO|build_network.py:62] Optimizer = adam\n",
"[root |INFO|build_network.py:63] Loss = binary_crossentropy\n",
"[root |INFO|build_network.py:64] Metrics = binary_accuracy, sensitivity, specificity, gmeasure, auc\n",
"[root |INFO|build_network.py:87] Load trained model weight at ./example_result/weight_0.h5 \n",
"[root |INFO|deepbiome.py:509] -----------------------------------------------------------------\n",
"[root |INFO|build_network.py:193] Prediction start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r",
"1000/1000 [==============================] - 0s 49us/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:198] Prediction end with time 0.052338600158691406!\n",
"[root |INFO|deepbiome.py:513] Compute time : 0.6934528350830078\n",
"[root |INFO|deepbiome.py:514] 1 fold computing end!---------------------------------------------\n",
"[root |INFO|deepbiome.py:519] Total Computing Ended\n",
"[root |INFO|deepbiome.py:520] -----------------------------------------------------------------\n"
]
}
],
"source": [
"prediction = deepbiome.deepbiome_prediction(log, prediction_network_info, prediction_path_info,\n",
" num_classes = 1, number_of_fold=None)"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1, 1000, 1)"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"prediction.shape"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([[0.779],\n",
" [0.771],\n",
" [0.620],\n",
" [0.501],\n",
" [0.863],\n",
" [0.622],\n",
" [0.630],\n",
" [0.496],\n",
" [0.822],\n",
" [0.843]], dtype=float32)"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"prediction[0,:10]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### 7.2 Prediction with each fold weight\n",
"\n",
"If we want to predict the test outputs from each repetitions, we can use the option belows.\n",
"\n",
"The example below shows how to predict the 5 repetition outputs.\n",
"We set `idx_path` for using the index file `classification_idx.csv` to predict only the test set for each repetition."
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"prediction_network_info = {\n",
" 'architecture_info': {\n",
" 'batch_normalization': 'False',\n",
" 'drop_out': '0',\n",
" 'weight_initial': 'glorot_uniform',\n",
" 'weight_l1_penalty':'0.',\n",
" 'weight_decay': 'phylogenetic_tree',\n",
" },\n",
" 'model_info': {\n",
" 'decay': '0.001',\n",
" 'loss': 'binary_crossentropy',\n",
" 'lr': '0.01',\n",
" 'metrics': 'binary_accuracy, sensitivity, specificity, gmeasure, auc',\n",
" 'network_class': 'DeepBiomeNetwork',\n",
" 'normalizer': 'normalize_minmax',\n",
" 'optimizer': 'adam',\n",
" 'reader_class': 'MicroBiomeClassificationReader',\n",
" 'taxa_selection_metrics': 'sensitivity, specificity, gmeasure, accuracy',\n",
" },\n",
" 'test_info': {\n",
" 'batch_size': 'None'\n",
" }\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"prediction_path_info = {\n",
" 'data_info': {\n",
" 'count_list_path': resource_filename('deepbiome', 'tests/data/gcount_list.csv'),\n",
" 'count_path': resource_filename('deepbiome', 'tests/data/count'),\n",
" 'data_path': resource_filename('deepbiome', 'tests/data'),\n",
" 'idx_path': resource_filename('deepbiome', 'tests/data/classification_idx.csv'),\n",
" 'tree_info_path': resource_filename('deepbiome', 'tests/data/genus48_dic.csv'),\n",
" 'x_path': '',\n",
" 'y_path': 'classification_y.csv'\n",
" },\n",
" 'model_info': {\n",
" 'model_dir': './example_result/',\n",
" 'weight': 'weight.h5'\n",
" }\n",
"}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To predict the CV outputs from each fold, we set `change_weight_for_each_fold = True`. Also, we set `get_y=True` to get the paired output of each prediction too."
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|deepbiome.py:450] -----------------------------------------------------------------\n",
"[root |INFO|deepbiome.py:480] -------1 th repeatition prediction start!----------------------------------\n",
"[root |INFO|readers.py:58] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:59] Construct Dataset\n",
"[root |INFO|readers.py:60] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:61] Load data\n",
"[root |INFO|deepbiome.py:498] -----------------------------------------------------------------\n",
"[root |INFO|build_network.py:521] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:522] Read phylogenetic tree information from /DATA/home/muha/github_repos/deepbiome/deepbiome/tests/data/genus48_dic.csv\n",
"[root |INFO|build_network.py:528] Phylogenetic tree level list: ['Genus', 'Family', 'Order', 'Class', 'Phylum']\n",
"[root |INFO|build_network.py:529] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:537] Genus: 48\n",
"[root |INFO|build_network.py:537] Family: 40\n",
"[root |INFO|build_network.py:537] Order: 23\n",
"[root |INFO|build_network.py:537] Class: 17\n",
"[root |INFO|build_network.py:537] Phylum: 9\n",
"[root |INFO|build_network.py:546] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:547] Phylogenetic_tree_dict info: ['Phylum', 'Order', 'Family', 'Class', 'Number', 'Genus']\n",
"[root |INFO|build_network.py:548] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Genus, Family]\n",
"[root |INFO|build_network.py:558] Build edge weights between [Family, Order]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Order, Class]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Class, Phylum]\n",
"[root |INFO|build_network.py:571] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:586] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:587] Build network based on phylogenetic tree information\n",
"[root |INFO|build_network.py:588] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:670] ------------------------------------------------------------------------------------------\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Model: \"model_1\"\n",
"_________________________________________________________________\n",
"Layer (type) Output Shape Param # \n",
"=================================================================\n",
"input (InputLayer) (None, 48) 0 \n",
"_________________________________________________________________\n",
"l1_dense (Dense_with_tree) (None, 40) 1960 \n",
"_________________________________________________________________\n",
"l1_activation (Activation) (None, 40) 0 \n",
"_________________________________________________________________\n",
"l2_dense (Dense_with_tree) (None, 23) 943 \n",
"_________________________________________________________________\n",
"l2_activation (Activation) (None, 23) 0 \n",
"_________________________________________________________________\n",
"l3_dense (Dense_with_tree) (None, 17) 408 \n",
"_________________________________________________________________\n",
"l3_activation (Activation) (None, 17) 0 \n",
"_________________________________________________________________\n",
"l4_dense (Dense_with_tree) (None, 9) 162 \n",
"_________________________________________________________________\n",
"l4_activation (Activation) (None, 9) 0 \n",
"_________________________________________________________________\n",
"last_dense_h (Dense) (None, 1) 10 \n",
"_________________________________________________________________\n",
"p_hat (Activation) (None, 1) 0 \n",
"=================================================================\n",
"Total params: 3,483\n",
"Trainable params: 3,483\n",
"Non-trainable params: 0\n",
"_________________________________________________________________\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:61] Build Network\n",
"[root |INFO|build_network.py:62] Optimizer = adam\n",
"[root |INFO|build_network.py:63] Loss = binary_crossentropy\n",
"[root |INFO|build_network.py:64] Metrics = binary_accuracy, sensitivity, specificity, gmeasure, auc\n",
"[root |INFO|build_network.py:87] Load trained model weight at ./example_result/weight_0.h5 \n",
"[root |INFO|deepbiome.py:509] -----------------------------------------------------------------\n",
"[root |INFO|build_network.py:193] Prediction start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r",
"250/250 [==============================] - 0s 136us/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:198] Prediction end with time 0.03711438179016113!\n",
"[root |INFO|deepbiome.py:513] Compute time : 0.6130969524383545\n",
"[root |INFO|deepbiome.py:514] 1 fold computing end!---------------------------------------------\n",
"[root |INFO|deepbiome.py:480] -------2 th repeatition prediction start!----------------------------------\n",
"[root |INFO|readers.py:58] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:59] Construct Dataset\n",
"[root |INFO|readers.py:60] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:61] Load data\n",
"[root |INFO|deepbiome.py:498] -----------------------------------------------------------------\n",
"[root |INFO|build_network.py:521] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:522] Read phylogenetic tree information from /DATA/home/muha/github_repos/deepbiome/deepbiome/tests/data/genus48_dic.csv\n",
"[root |INFO|build_network.py:528] Phylogenetic tree level list: ['Genus', 'Family', 'Order', 'Class', 'Phylum']\n",
"[root |INFO|build_network.py:529] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:537] Genus: 48\n",
"[root |INFO|build_network.py:537] Family: 40\n",
"[root |INFO|build_network.py:537] Order: 23\n",
"[root |INFO|build_network.py:537] Class: 17\n",
"[root |INFO|build_network.py:537] Phylum: 9\n",
"[root |INFO|build_network.py:546] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:547] Phylogenetic_tree_dict info: ['Phylum', 'Order', 'Family', 'Class', 'Number', 'Genus']\n",
"[root |INFO|build_network.py:548] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Genus, Family]\n",
"[root |INFO|build_network.py:558] Build edge weights between [Family, Order]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Order, Class]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Class, Phylum]\n",
"[root |INFO|build_network.py:571] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:586] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:587] Build network based on phylogenetic tree information\n",
"[root |INFO|build_network.py:588] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:670] ------------------------------------------------------------------------------------------\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Model: \"model_2\"\n",
"_________________________________________________________________\n",
"Layer (type) Output Shape Param # \n",
"=================================================================\n",
"input (InputLayer) (None, 48) 0 \n",
"_________________________________________________________________\n",
"l1_dense (Dense_with_tree) (None, 40) 1960 \n",
"_________________________________________________________________\n",
"l1_activation (Activation) (None, 40) 0 \n",
"_________________________________________________________________\n",
"l2_dense (Dense_with_tree) (None, 23) 943 \n",
"_________________________________________________________________\n",
"l2_activation (Activation) (None, 23) 0 \n",
"_________________________________________________________________\n",
"l3_dense (Dense_with_tree) (None, 17) 408 \n",
"_________________________________________________________________\n",
"l3_activation (Activation) (None, 17) 0 \n",
"_________________________________________________________________\n",
"l4_dense (Dense_with_tree) (None, 9) 162 \n",
"_________________________________________________________________\n",
"l4_activation (Activation) (None, 9) 0 \n",
"_________________________________________________________________\n",
"last_dense_h (Dense) (None, 1) 10 \n",
"_________________________________________________________________\n",
"p_hat (Activation) (None, 1) 0 \n",
"=================================================================\n",
"Total params: 3,483\n",
"Trainable params: 3,483\n",
"Non-trainable params: 0\n",
"_________________________________________________________________\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:61] Build Network\n",
"[root |INFO|build_network.py:62] Optimizer = adam\n",
"[root |INFO|build_network.py:63] Loss = binary_crossentropy\n",
"[root |INFO|build_network.py:64] Metrics = binary_accuracy, sensitivity, specificity, gmeasure, auc\n",
"[root |INFO|build_network.py:87] Load trained model weight at ./example_result/weight_1.h5 \n",
"[root |INFO|deepbiome.py:509] -----------------------------------------------------------------\n",
"[root |INFO|build_network.py:193] Prediction start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r",
"250/250 [==============================] - 0s 271us/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:198] Prediction end with time 0.07141661643981934!\n",
"[root |INFO|deepbiome.py:513] Compute time : 0.6672861576080322\n",
"[root |INFO|deepbiome.py:514] 2 fold computing end!---------------------------------------------\n",
"[root |INFO|deepbiome.py:480] -------3 th repeatition prediction start!----------------------------------\n",
"[root |INFO|readers.py:58] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:59] Construct Dataset\n",
"[root |INFO|readers.py:60] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:61] Load data\n",
"[root |INFO|deepbiome.py:498] -----------------------------------------------------------------\n",
"[root |INFO|build_network.py:521] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:522] Read phylogenetic tree information from /DATA/home/muha/github_repos/deepbiome/deepbiome/tests/data/genus48_dic.csv\n",
"[root |INFO|build_network.py:528] Phylogenetic tree level list: ['Genus', 'Family', 'Order', 'Class', 'Phylum']\n",
"[root |INFO|build_network.py:529] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:537] Genus: 48\n",
"[root |INFO|build_network.py:537] Family: 40\n",
"[root |INFO|build_network.py:537] Order: 23\n",
"[root |INFO|build_network.py:537] Class: 17\n",
"[root |INFO|build_network.py:537] Phylum: 9\n",
"[root |INFO|build_network.py:546] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:547] Phylogenetic_tree_dict info: ['Phylum', 'Order', 'Family', 'Class', 'Number', 'Genus']\n",
"[root |INFO|build_network.py:548] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Genus, Family]\n",
"[root |INFO|build_network.py:558] Build edge weights between [Family, Order]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Order, Class]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Class, Phylum]\n",
"[root |INFO|build_network.py:571] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:586] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:587] Build network based on phylogenetic tree information\n",
"[root |INFO|build_network.py:588] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:670] ------------------------------------------------------------------------------------------\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Model: \"model_3\"\n",
"_________________________________________________________________\n",
"Layer (type) Output Shape Param # \n",
"=================================================================\n",
"input (InputLayer) (None, 48) 0 \n",
"_________________________________________________________________\n",
"l1_dense (Dense_with_tree) (None, 40) 1960 \n",
"_________________________________________________________________\n",
"l1_activation (Activation) (None, 40) 0 \n",
"_________________________________________________________________\n",
"l2_dense (Dense_with_tree) (None, 23) 943 \n",
"_________________________________________________________________\n",
"l2_activation (Activation) (None, 23) 0 \n",
"_________________________________________________________________\n",
"l3_dense (Dense_with_tree) (None, 17) 408 \n",
"_________________________________________________________________\n",
"l3_activation (Activation) (None, 17) 0 \n",
"_________________________________________________________________\n",
"l4_dense (Dense_with_tree) (None, 9) 162 \n",
"_________________________________________________________________\n",
"l4_activation (Activation) (None, 9) 0 \n",
"_________________________________________________________________\n",
"last_dense_h (Dense) (None, 1) 10 \n",
"_________________________________________________________________\n",
"p_hat (Activation) (None, 1) 0 \n",
"=================================================================\n",
"Total params: 3,483\n",
"Trainable params: 3,483\n",
"Non-trainable params: 0\n",
"_________________________________________________________________\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:61] Build Network\n",
"[root |INFO|build_network.py:62] Optimizer = adam\n",
"[root |INFO|build_network.py:63] Loss = binary_crossentropy\n",
"[root |INFO|build_network.py:64] Metrics = binary_accuracy, sensitivity, specificity, gmeasure, auc\n",
"[root |INFO|build_network.py:87] Load trained model weight at ./example_result/weight_2.h5 \n",
"[root |INFO|deepbiome.py:509] -----------------------------------------------------------------\n",
"[root |INFO|build_network.py:193] Prediction start!\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"\r",
"250/250 [==============================] - 0s 301us/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|build_network.py:198] Prediction end with time 0.07864809036254883!\n",
"[root |INFO|deepbiome.py:513] Compute time : 0.7205522060394287\n",
"[root |INFO|deepbiome.py:514] 3 fold computing end!---------------------------------------------\n",
"[root |INFO|deepbiome.py:519] Total Computing Ended\n",
"[root |INFO|deepbiome.py:520] -----------------------------------------------------------------\n"
]
}
],
"source": [
"prediction = deepbiome.deepbiome_prediction(log, prediction_network_info, prediction_path_info,\n",
" num_classes = 1, number_of_fold=None, \n",
" change_weight_for_each_fold = True, \n",
" get_y=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We gathered the outputs from each fold. "
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"prediction = np.vstack(prediction)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Since we set the option `get_y=True`, the output has the shape of `(n_samples, 2, n_classes)`. With this options, we can get the predictions of test set and the true output of each predictions.\n",
"\n",
"Now, we can calculate the test performance by the test predictions."
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|:4] Shape of the predict function ourput: (750, 2, 1)\n",
"[root |INFO|:5] Shape of the prediction: (750, 1)\n",
"[root |INFO|:6] Shape of the true_output for each prediction: (750, 1)\n"
]
}
],
"source": [
"predict_output = prediction[:,0]\n",
"true_output = prediction[:,1]\n",
"\n",
"log.info('Shape of the predict function ourput: %s' % str(prediction.shape))\n",
"log.info('Shape of the prediction: %s' % str(predict_output.shape))\n",
"log.info('Shape of the true_output for each prediction: %s' % str(true_output.shape))"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|:1] CV accuracy: 0.719\n"
]
}
],
"source": [
"log.info('CV accuracy: %6.3f' % np.mean((predict_output >= 0.5) == true_output))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 8. Load trained weight matrix\n",
"\n",
"The `deepbiome_get_trained_weight` function convert the trained weight `*.h5` saved from the `deepbiome_train` to a list of numpy arrays.\n",
"In this exampe, the list has numpy array of weights from 6 layers. (`[genus to family, family to order, order to Class, class to phylum, phylum to output]`)"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|readers.py:58] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:59] Construct Dataset\n",
"[root |INFO|readers.py:60] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:61] Load data\n",
"[root |INFO|build_network.py:521] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:522] Read phylogenetic tree information from /DATA/home/muha/github_repos/deepbiome/deepbiome/tests/data/genus48_dic.csv\n",
"[root |INFO|build_network.py:528] Phylogenetic tree level list: ['Genus', 'Family', 'Order', 'Class', 'Phylum']\n",
"[root |INFO|build_network.py:529] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:537] Genus: 48\n",
"[root |INFO|build_network.py:537] Family: 40\n",
"[root |INFO|build_network.py:537] Order: 23\n",
"[root |INFO|build_network.py:537] Class: 17\n",
"[root |INFO|build_network.py:537] Phylum: 9\n",
"[root |INFO|build_network.py:546] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:547] Phylogenetic_tree_dict info: ['Phylum', 'Order', 'Family', 'Class', 'Number', 'Genus']\n",
"[root |INFO|build_network.py:548] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Genus, Family]\n",
"[root |INFO|build_network.py:558] Build edge weights between [Family, Order]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Order, Class]\n",
"[root |INFO|build_network.py:558] Build edge weights between [ Class, Phylum]\n",
"[root |INFO|build_network.py:571] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:586] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:587] Build network based on phylogenetic tree information\n",
"[root |INFO|build_network.py:588] ------------------------------------------------------------------------------------------\n",
"[root |INFO|build_network.py:670] ------------------------------------------------------------------------------------------\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Model: \"model_1\"\n",
"_________________________________________________________________\n",
"Layer (type) Output Shape Param # \n",
"=================================================================\n",
"input (InputLayer) (None, 48) 0 \n",
"_________________________________________________________________\n",
"l1_dense (Dense_with_tree) (None, 40) 1960 \n",
"_________________________________________________________________\n",
"l1_activation (Activation) (None, 40) 0 \n",
"_________________________________________________________________\n",
"l2_dense (Dense_with_tree) (None, 23) 943 \n",
"_________________________________________________________________\n",
"l2_activation (Activation) (None, 23) 0 \n",
"_________________________________________________________________\n",
"l3_dense (Dense_with_tree) (None, 17) 408 \n",
"_________________________________________________________________\n",
"l3_activation (Activation) (None, 17) 0 \n",
"_________________________________________________________________\n",
"l4_dense (Dense_with_tree) (None, 9) 162 \n",
"_________________________________________________________________\n",
"l4_activation (Activation) (None, 9) 0 \n",
"_________________________________________________________________\n",
"last_dense_h (Dense) (None, 1) 10 \n",
"_________________________________________________________________\n",
"p_hat (Activation) (None, 1) 0 \n",
"=================================================================\n",
"Total params: 3,483\n",
"Trainable params: 3,483\n",
"Non-trainable params: 0\n",
"_________________________________________________________________\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|:3] 5\n"
]
}
],
"source": [
"weight_path = '%s/%s' % (path_info['model_info']['model_dir'], 'weight_0.h5')\n",
"trained_weight_list = deepbiome.deepbiome_get_trained_weight(log, network_info, path_info, num_classes=1, weight_path=weight_path)\n",
"log.info(len(trained_weight_list))"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"First weight between the `genus` and `family` layers has the shape of `(number of genus = 48, number of family = 40)`"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|:1] (48, 40)\n"
]
}
],
"source": [
"log.info(trained_weight_list[0].shape)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 9. Taxa selection performance\n",
"\n",
"If we know the true disease path, we can calculate the taxa selection performance by `deepbiome_taxa_selection_performance` funciton. First, we prepared the true weight list based on the true disease path. For each fold, we prepared 4 weights from the 5 layers (`[genus to family, family to order, order to Class, class to phylum]`). An example of the list of the true weights from each fold is as follow:"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|:2] (5, 4)\n"
]
}
],
"source": [
"true_tree_weight_list = np.load(resource_filename('deepbiome', 'tests/data/true_weight_list.npy'), allow_pickle=True)\n",
"log.info(true_tree_weight_list.shape)"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"The first weight between the genus and family layers for first epoch has the shape below:"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|:1] (48, 40)\n"
]
}
],
"source": [
"log.info(true_tree_weight_list[0][0].shape)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"We will calculate the taxa selection performance of the trained weight below:"
]
},
{
"cell_type": "code",
"execution_count": 49,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['./example_result//weight_0.h5',\n",
" './example_result//weight_1.h5',\n",
" './example_result//weight_2.h5']"
]
},
"execution_count": 49,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"trained_weight_path_list = ['%s/weight_%d.h5' % (path_info['model_info']['model_dir'], i) for i in range(3)]\n",
"trained_weight_path_list"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This is the summary of the taxa selection accuracy of trained weights from each fold."
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"[root |INFO|readers.py:58] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:59] Construct Dataset\n",
"[root |INFO|readers.py:60] -----------------------------------------------------------------------\n",
"[root |INFO|readers.py:61] Load data\n",
"[root |INFO|build_network.py:87] Load trained model weight at ./example_result//weight_0.h5 \n",
"[root |INFO|build_network.py:87] Load trained model weight at ./example_result//weight_1.h5 \n",
"[root |INFO|build_network.py:87] Load trained model weight at ./example_result//weight_2.h5 \n"
]
}
],
"source": [
"summary = deepbiome.deepbiome_taxa_selection_performance(log, network_info, path_info, num_classes=1, \n",
" true_tree_weight_list=true_tree_weight_list, \n",
" trained_weight_path_list = trained_weight_path_list)"
]
},
{
"cell_type": "code",
"execution_count": 51,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Model | \n",
" PhyloTree | \n",
" No. true taxa | \n",
" No. total taxa | \n",
" Sensitivity_mean | \n",
" Sensitivity_std | \n",
" Specificity_mean | \n",
" Specificity_std | \n",
" Gmeasure_mean | \n",
" Gmeasure_std | \n",
" Accuracy_mean | \n",
" Accuracy_std | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" ./example_result/ | \n",
" Genus | \n",
" 31 | \n",
" 48 | \n",
" 0.946 | \n",
" 0.055 | \n",
" 0.983 | \n",
" 0.009 | \n",
" 0.964 | \n",
" 0.026 | \n",
" 0.983 | \n",
" 0.008 | \n",
"
\n",
" \n",
" 1 | \n",
" | \n",
" Family | \n",
" 23 | \n",
" 40 | \n",
" 0.942 | \n",
" 0.020 | \n",
" 0.981 | \n",
" 0.002 | \n",
" 0.961 | \n",
" 0.011 | \n",
" 0.980 | \n",
" 0.002 | \n",
"
\n",
" \n",
" 2 | \n",
" | \n",
" Order | \n",
" 9 | \n",
" 23 | \n",
" 0.963 | \n",
" 0.052 | \n",
" 0.962 | \n",
" 0.002 | \n",
" 0.962 | \n",
" 0.028 | \n",
" 0.962 | \n",
" 0.004 | \n",
"
\n",
" \n",
" 3 | \n",
" | \n",
" Class | \n",
" 7 | \n",
" 17 | \n",
" 0.952 | \n",
" 0.067 | \n",
" 0.925 | \n",
" 0.010 | \n",
" 0.938 | \n",
" 0.032 | \n",
" 0.926 | \n",
" 0.008 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Model PhyloTree No. true taxa No. total taxa Sensitivity_mean \\\n",
"0 ./example_result/ Genus 31 48 0.946 \n",
"1 Family 23 40 0.942 \n",
"2 Order 9 23 0.963 \n",
"3 Class 7 17 0.952 \n",
"\n",
" Sensitivity_std Specificity_mean Specificity_std Gmeasure_mean \\\n",
"0 0.055 0.983 0.009 0.964 \n",
"1 0.020 0.981 0.002 0.961 \n",
"2 0.052 0.962 0.002 0.962 \n",
"3 0.067 0.925 0.010 0.938 \n",
"\n",
" Gmeasure_std Accuracy_mean Accuracy_std \n",
"0 0.026 0.983 0.008 \n",
"1 0.011 0.980 0.002 \n",
"2 0.028 0.962 0.004 \n",
"3 0.032 0.926 0.008 "
]
},
"execution_count": 51,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"summary"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}