Charles Colbourn > AI-NNFlex > AI::NNFlex::Dataset

Download:
ai-nnflex/AI-NNFlex-0.24.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source  

NAME ^

AI::NNFlex::Dataset - support for creating/loading/saving datasets for NNFlex nets

SYNOPSIS ^

 use AI::NNFlex::Dataset;

 my $dataset = AI::NNFlex::Dataset->new([[0,1,1,0],[0,0,1,1]]);

 $dataset->add([[0,1,0,1],[1,1,0,0]]);

 $dataset->add([0,1,0,0]);

 $dataset->save(filename=>'test.pat');

 $dataset->load(filename=>'test.pat');

DESCRIPTION ^

This module allows you to construct, load, save and maintain datasets for use with neural nets implemented using the AI::NNFlex classes. The dataset consists of an array of references to arrays of data. Items may be added in pairs (useful for feedforward nets with an input & target pair of values) or individually (for Hopfield type nets where only an input is specified). The load and save methods use files that are compatible (I think) with SNNS .pat files.

CONSTRUCTOR ^

AI::NNFlex::Dataset->new([[INPUT],[TARGET]]);

Parameters:

The constructor takes an (optional) reference to an array of one or more arrays. For convenience you can specify two values at a time (for INPUT and OUTPUT values) or a single value at a time. You can also leave the parameters blank, in which case the constructor creates a Dataset object with no values. Values can then be added with the 'add' method.

The return value is an AI::NNFlex::Dataset object.

METHODS ^

This is a short list of the main methods implemented in AI::NNFlex::Dataset

add

 Syntax:

 $dataset->add([[INPUT],[OUTPUT]]);

or

 $dataset->add([VALUE]);

This method adds new values to the end of the dataset. You can specify the values as pairs or individually.

load

 Syntax:

 $dataset->load(filename=>'filename.pat');

Loads an SNNS type .pat file into a blank dataset. If called on an existing dataset IT WILL OVERWRITE IT!

save

 $dataset->save(filename=>'filename.pat');

Save the existing dataset as an SNNS .pat file. If the file already exists it will be overwritten.

delete

 $dataset->delete(INDEX);

or

 $dataset->delete([ARRAY OF INDICES]);

Deletes 1 or more items from the dataset by their index (counting from 0). Note that if you are using pairs of values (in a backprop net for example) you MUST delete in pairs - otherwise you will delete only the input/target, and the indices will be shifted leaving your dataset in a messed up state.

EXAMPLES ^

See the code in ./examples.

PREREQs ^

None.

SEE ALSO ^

 AI::NNFlex

TODO ^

Method to delete existing dataset entries by index

Method to validate linear separability of a dataset.

CHANGES ^

COPYRIGHT ^

Copyright (c) 2004-2005 Charles Colbourn. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

CONTACT ^

 charlesc@nnflex.g0n.net
syntax highlighting: