Skip to content
Snippets Groups Projects
Commit 48baa783 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Improve the LDA plot

parent e2af4dbf
No related branches found
No related tags found
No related merge requests found
Pipeline #36992 passed
......@@ -46,7 +46,7 @@ linear discriminant model to distinguish the species from each other.
Training a :py:class:`bob.learn.linear.Machine` with LDA
---------------------------------------------------------
========================================================
Creating a :py:class:`bob.learn.linear.Machine` to perform Linear Discriminant Analysis on the Iris dataset involves using the :py:class:`bob.learn.linear.FisherLDATrainer`:
......@@ -72,7 +72,7 @@ A few things should be noted:
For this example, we just discard this information.
Looking at the first LDA component
----------------------------------
==================================
To reproduce Fisher's results, we must pass the data through the created machine:
......@@ -117,7 +117,7 @@ You should see an image like this:
Measuring performance
---------------------
=====================
You can measure the performance of the system on classifying, say, *Iris Virginica* as compared to the other two variants.
We can use the functions in :ref:`bob.measure <bob.measure>` for that purpose.
......
.. _bob.install:
***************************
===========================
Installation instructions
***************************
===========================
By now you should know that Bob is made of several :ref:`bob.packages`. There is no single
package that installs all Bob packages because that would just take too much space.
......
#!/usr/bin/env python
# Andre Anjos <andre.anjos@idiap.ch>
# Sat 24 Mar 2012 18:51:21 CET
# Sat 24 Mar 2012 18:51:21 CET
"""Computes an ROC curve for the Iris Flower Recognition using Linear Discriminant Analysis and Bob.
"""
......@@ -18,11 +18,12 @@ machine, eigen_values = trainer.train(data.values())
# A simple way to forward the data
output = {}
for key in data.keys(): output[key] = machine(data[key])
for key, value in data.items():
output[key] = machine(value)
# Performance
negatives = numpy.vstack([output['setosa'], output['versicolor']])[:,0]
positives = output['virginica'][:,0]
negatives = numpy.vstack([output["setosa"], output["versicolor"]])[:, 0]
positives = output["virginica"][:, 0]
# Plot ROC curve
bob.measure.plot.roc(negatives, positives)
......@@ -30,4 +31,3 @@ pyplot.xlabel("False Virginica Acceptance (%)")
pyplot.ylabel("False Virginica Rejection (%)")
pyplot.title("ROC Curve for Virginica Classification")
pyplot.grid()
pyplot.axis([0, 5, 0, 15]) #xmin, xmax, ymin, ymax
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment