Skip to content

Commit dd5bef5

Browse files
updating the documentation with algorithms for efficient learning
1 parent 59042f9 commit dd5bef5

File tree

104 files changed

+21007
-3690
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+21007
-3690
lines changed
Binary file not shown.

_downloads/0c5ab177a019d9eb71a5f760ed0b28ec/feature_extraction.ipynb

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {
7+
"collapsed": false
8+
},
9+
"outputs": [],
10+
"source": [
11+
"%matplotlib inline"
12+
]
13+
},
314
{
415
"cell_type": "markdown",
516
"metadata": {},
617
"source": [
7-
"\n\n# MRCs with Deep Neural Networks: Part I\nIn this example we will use a pretrained neural network to extract features\nof images in a dataset to train and test MRCs with these features in\n`feature_mrc`.\n\nWe are using [ResNet18](https://pytorch.org/hub/pytorch_vision_resnet/)\npretrained model implementation in Pytorch library. Resnet models were proposed\nin \u201cDeep Residual Learning for Image Recognition\u201d. Here we are using the\nversion ResNet18 which contains 18 layers and it is pretrained over\n`ImageNet dataset<https://www.image-net.org/index.php>` which has 1000\ndifferent classes.\n\n.. seealso:: For more information about ResNet models refer to\n\n [1] He, K., Zhang, X., Ren, S., & Sun, J. (2016).\n Deep residual learning for image recognition.\n In Proceedings of the IEEE conference on computer\n vision and pattern recognition (pp. 770-778).\n"
18+
"\n\n# MRCs with Deep Neural Networks: Part I\nIn this example we will use a pretrained neural network to extract features\nof images in a dataset to train and test MRCs with these features in\n`feature_mrc`.\n\nWe are using `ResNet18 <https://pytorch.org/hub/pytorch_vision_resnet/>`_\npretrained model implementation in Pytorch library. Resnet models were proposed\nin \u201cDeep Residual Learning for Image Recognition\u201d. Here we are using the\nversion ResNet18 which contains 18 layers and it is pretrained over\n`ImageNet dataset<https://www.image-net.org/index.php>` which has 1000\ndifferent classes.\n\n.. seealso:: For more information about ResNet models refer to\n\n [1] He, K., Zhang, X., Ren, S., & Sun, J. (2016).\n Deep residual learning for image recognition.\n In Proceedings of the IEEE conference on computer\n vision and pattern recognition (pp. 770-778).\n"
819
]
920
},
1021
{
@@ -36,7 +47,7 @@
3647
"cell_type": "markdown",
3748
"metadata": {},
3849
"source": [
39-
"## Using tensorflow datasets: MNIST & Cats vs Dogs\nMNIST\n-----\nThe MNIST database of handwritten digits, available from\n`this page<http://yann.lecun.com/exdb/mnist/>`,\nhas a training set of 60000 examples, and a test set of 10000 examples. All\nimages have dimension (28,28,1) and they are greyscale. Tensorflow provides\nwith a convenient function to directly load this dataset into the scope\nwithout the need of downloading and storing the dataset locally, you can\ncheck more in [tensorflow documentation](https://www.tensorflow.org/datasets/catalog/mnist).\nIt already provides with the train and test partitions. We load the dataset\nwith the function `tensorflow_datasets.load` and we specify\n`as_supervised=True` to indicate that we want to load the labels together\nwith the images and `with_info=True` will return the tuple\n`(tf.data.Dataset, tfds.core.DatasetInfo)`,\nthe latter containing the info associated with the builder.\n\n"
50+
"## Using tensorflow datasets: MNIST & Cats vs Dogs\nMNIST\n-----\nThe MNIST database of handwritten digits, available from\n`this page<http://yann.lecun.com/exdb/mnist/>`,\nhas a training set of 60000 examples, and a test set of 10000 examples. All\nimages have dimension (28,28,1) and they are greyscale. Tensorflow provides\nwith a convenient function to directly load this dataset into the scope\nwithout the need of downloading and storing the dataset locally, you can\ncheck more in `tensorflow documentation\n<https://www.tensorflow.org/datasets/catalog/mnist>`_.\nIt already provides with the train and test partitions. We load the dataset\nwith the function `tensorflow_datasets.load` and we specify\n`as_supervised=True` to indicate that we want to load the labels together\nwith the images and `with_info=True` will return the tuple\n`(tf.data.Dataset, tfds.core.DatasetInfo)`,\nthe latter containing the info associated with the builder.\n\n"
4051
]
4152
},
4253
{
@@ -54,7 +65,7 @@
5465
"cell_type": "markdown",
5566
"metadata": {},
5667
"source": [
57-
"### Cats vs Dogs\nCats vs dogs dataset is a database of 23262 RGB cats\nand dogs images released by Microsoft for the Asirra captcha ([homepage](https://www.microsoft.com/en-us/download/details.aspx?id=54765)).\nCats are labeled by 0 and dogs by 1 and there are 11658 and 11604 images\nof each class, respectively.\nIt is available in tensorflow datasets, you can check the details [here](https://www.tensorflow.org/datasets/catalog/cats_vs_dogs).\n\n"
68+
"### Cats vs Dogs\nCats vs dogs dataset is a database of 23262 RGB cats\nand dogs images released by Microsoft for the Asirra captcha (`homepage\n<https://www.microsoft.com/en-us/download/details.aspx?id=54765>`_).\nCats are labeled by 0 and dogs by 1 and there are 11658 and 11604 images\nof each class, respectively.\nIt is available in tensorflow datasets, you can check the details `here\n<https://www.tensorflow.org/datasets/catalog/cats_vs_dogs>`_.\n\n"
5869
]
5970
},
6071
{
@@ -128,7 +139,7 @@
128139
"name": "python",
129140
"nbconvert_exporter": "python",
130141
"pygments_lexer": "ipython3",
131-
"version": "3.12.4"
142+
"version": "3.9.23"
132143
}
133144
},
134145
"nbformat": 4,
Binary file not shown.

_downloads/952ecdb7b594216f970d4c743a7ac511/z_COVID.ipynb

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"metadata": {
7+
"collapsed": false
8+
},
9+
"outputs": [],
10+
"source": [
11+
"%matplotlib inline"
12+
]
13+
},
314
{
415
"cell_type": "markdown",
516
"metadata": {},
617
"source": [
7-
"\n\n\n# Example: Predicting COVID-19 patients outcome using MRCs\n\nIn this example we will use `MRCpy.MRC` and `MRCpy.CMRC` to predict the outcome\nof a COVID-19 positive patient at the moment of hospital triage. This example\nuses a dataset that comprises different demographic variables and biomarkers of\nthe patients and a binary outcome :attr:`Status` where :attr:`Status = 0`\ndefine the group of survivors and :attr:`Status = 1` determines a decease.\n\nThe data is provided by the [Covid Data Saves Lives](https://www.hmhospitales.com/coronavirus/covid-data-save-lives/) initiative\ncarried out by HM Hospitales with information of the first wave of the COVID\noutbreak in Spanish hospitals. The data is available upon request through HM\nHospitales\n[here](https://www.hmhospitales.com/coronavirus/covid-data-save-lives/) .\n\n.. seealso:: For more information about the dataset and the creation of a\n risk indicator using Logistic regression refer to:\n\n [1] Ruben Arma\u00f1anzas et al. \u201cDerivation of a Cost-Sensitive\n COVID-19 Mortality Risk Indicator Using a Multistart Framework\"\n , in *2021 IEEE International Conference on Bioinformatics and\n Biomedicine (BIBM)*, 2021, pp. 2179\u20132186.\n\n\n\nFirst we will see how to deal with class imbalance when training a model using\nsyntethic minority over-sampling (SMOTE) techniques. Furthermore, we will\ncomparetwo MRC with two state of the art machine learning models probability\nestimation . The selected models are :mod:`CMRC(phi = 'threshold' ,\nloss = 'log')` & :mod:`MRC(phi = 'fourier' , loss = 'log')` for the group of\nMRCs and Logistic Regression (LR) & C-Support Vector Classifier(SVC) with the\nimplementation from `Scikit-Learn <https://scikit-learn.org/stable/#>`.\n"
18+
"\n\n\n# Example: Predicting COVID-19 patients outcome using MRCs\n\nIn this example we will use `MRCpy.MRC` and `MRCpy.CMRC` to predict the outcome\nof a COVID-19 positive patient at the moment of hospital triage. This example\nuses a dataset that comprises different demographic variables and biomarkers of\nthe patients and a binary outcome :attr:`Status` where :attr:`Status = 0`\ndefine the group of survivors and :attr:`Status = 1` determines a decease.\n\nThe data is provided by the `Covid Data Saves Lives\n<https://www.hmhospitales.com/coronavirus/covid-data-save-lives/>`_ initiative\ncarried out by HM Hospitales with information of the first wave of the COVID\noutbreak in Spanish hospitals. The data is available upon request through HM\nHospitales\n`here <https://www.hmhospitales.com/coronavirus/covid-data-save-lives/>`_ .\n\n.. seealso:: For more information about the dataset and the creation of a\n risk indicator using Logistic regression refer to:\n\n [1] Ruben Arma\u00f1anzas et al. \u201cDerivation of a Cost-Sensitive\n COVID-19 Mortality Risk Indicator Using a Multistart Framework\"\n , in *2021 IEEE International Conference on Bioinformatics and\n Biomedicine (BIBM)*, 2021, pp. 2179\u20132186.\n\n\n\nFirst we will see how to deal with class imbalance when training a model using\nsyntethic minority over-sampling (SMOTE) techniques. Furthermore, we will\ncomparetwo MRC with two state of the art machine learning models probability\nestimation . The selected models are :mod:`CMRC(phi = 'threshold' ,\nloss = 'log')` & :mod:`MRC(phi = 'fourier' , loss = 'log')` for the group of\nMRCs and Logistic Regression (LR) & C-Support Vector Classifier(SVC) with the\nimplementation from `Scikit-Learn <https://scikit-learn.org/stable/#>`.\n"
819
]
920
},
1021
{
@@ -65,7 +76,7 @@
6576
"cell_type": "markdown",
6677
"metadata": {},
6778
"source": [
68-
"So we create a set of cases syntehtically using 5 nearest neighbors until\nthe class imbalance is almost removed. For more information about\n:mod:`SMOTE` refer to it's [documentation](https://imbalanced-learn.org/stable/) .\nWe will use the method `SMOTE-NC` for numerical and categorical variables.\n\n.. seealso:: For more information about the SMOTE package refer to:\n\n [2] Chawla, N. V., Bowyer, K. W., Hall, L. O., & Kegelmeyer,\n W. P. (2002). SMOTE: synthetic minority over-sampling\n technique. Journal of artificial intelligence research,\n 16, 321-357.\n\n"
79+
"So we create a set of cases syntehtically using 5 nearest neighbors until\nthe class imbalance is almost removed. For more information about\n:mod:`SMOTE` refer to it's `documentation\n<https://imbalanced-learn.org/stable/>`_ .\nWe will use the method `SMOTE-NC` for numerical and categorical variables.\n\n.. seealso:: For more information about the SMOTE package refer to:\n\n [2] Chawla, N. V., Bowyer, K. W., Hall, L. O., & Kegelmeyer,\n W. P. (2002). SMOTE: synthetic minority over-sampling\n technique. Journal of artificial intelligence research,\n 16, 321-357.\n\n"
6980
]
7081
},
7182
{
@@ -361,7 +372,7 @@
361372
"name": "python",
362373
"nbconvert_exporter": "python",
363374
"pygments_lexer": "ipython3",
364-
"version": "3.12.4"
375+
"version": "3.9.23"
365376
}
366377
},
367378
"nbformat": 4,

0 commit comments

Comments
 (0)