datasets-iris
v1.0.0
Published
Edgar Anderson's iris data.
Downloads
12
Maintainers
Readme
Iris
Edgar Anderson's iris data.
Installation
$ npm install datasets-iris
For use in the browser, use browserify.
Usage
var data = require( 'datasets-iris' );
data.setosa
Edgar Anderson's data for Iris setosa.
console.log( data.setosa );
/* returns
{
'sepal': {
'len': [...],
'width': [...]
},
'petal': {
'len': [...],
'width': [...]
}
}
*/
data.versicolor
Edgar Anderson's data for Iris versicolor.
console.log( data.versicolor );
/* returns
{
'sepal': {
'len': [...],
'width': [...]
},
'petal': {
'len': [...],
'width': [...]
}
}
*/
data.virginica
Edgar Anderson's data for Iris virginica.
console.log( data.virginica );
/* returns
{
'sepal': {
'len': [...],
'width': [...]
},
'petal': {
'len': [...],
'width': [...]
}
}
*/
Examples
var toMatrix = require( 'compute-to-matrix' ),
mean = require( 'compute-mean' ),
variance = require( 'compute-variance' ),
data = require( 'datasets-iris' );
var submat,
mat,
mu,
s2;
// Create one large matrix containing all iris data...
mat = toMatrix([
data.setosa.sepal.len,
data.setosa.sepal.width,
data.setosa.petal.len,
data.setosa.petal.width,
data.versicolor.sepal.len,
data.versicolor.sepal.width,
data.versicolor.petal.len,
data.versicolor.petal.width,
data.virginica.sepal.len,
data.virginica.sepal.width,
data.virginica.petal.len,
data.virginica.petal.width
]);
// Calculate sample statistics for the various features across species...
// Sepal lengths:
submat = mat.sget( '::4,:' );
mu = mean( submat );
console.log( 'Sepal length means: %s', mu.toString() );
s2 = variance( submat );
console.log( 'Sepal length variances: %s', s2.toString() );
// Sepal widths:
submat = mat.sget( '1::4,:' );
mu = mean( submat );
console.log( 'Sepal width means: %s', mu.toString() );
s2 = variance( submat );
console.log( 'Sepal width variances: %s', s2.toString() );
// Petal lengths:
submat = mat.sget( '2::4,:' );
mu = mean( submat );
console.log( 'Petal length means: %s', mu.toString() );
s2 = variance( submat );
console.log( 'Petal length variances: %s', s2.toString() );
// Petal widths:
submat = mat.sget( '3::4,:' );
mu = mean( submat );
console.log( 'Petal width means: %s', mu.toString() );
s2 = variance( submat );
console.log( 'Petal width variances: %s', s2.toString() );
To run the example code from the top-level application directory,
$ node ./examples/index.js
References
- Anderson, Edgar (1935). "The irises of the Gaspe Peninsula," Bulletin of the American Iris Society, 59, 2–5.
- Fisher, Ronald A. (1936). "The use of multiple measurements in taxonomic problems." Annals of Eugenics, 7, Part II, 179–188.
See Also
Tests
Unit
Unit tests use the Mocha test framework with Chai assertions. To run the tests, execute the following command in the top-level application directory:
$ make test
All new feature development should have corresponding unit tests to validate correct functionality.
Test Coverage
This repository uses Istanbul as its code coverage tool. To generate a test coverage report, execute the following command in the top-level application directory:
$ make test-cov
Istanbul creates a ./reports/coverage
directory. To access an HTML version of the report,
$ make view-cov
License
Copyright
Copyright © 2015. The Compute.io Authors.