view release on metacpan or search on metacpan
lib/AI/Evolve/Befunge.pm view on Meta::CPAN
=head1 CONFIG FILE
You can find an example config file ("example.conf") in the source
tarball. It contains all of the variables with their default values,
and descriptions of each. It lets you configure many important
parameters about how the evolutionary process works, so you probably
want to copy and edit it.
This file can be copied to ".ai-evolve-befunge" in your home
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install/Makefile.pm view on Meta::CPAN
my @c = caller();
if ( ++$seen{"$c[1]|$c[2]|$_[0]"} > 3 ) {
die "Caught an potential prompt infinite loop ($c[1]|$c[2]|$_[0])";
}
# In automated testing, always use defaults
if ( $ENV{AUTOMATED_TESTING} and ! $ENV{PERL_MM_USE_DEFAULT} ) {
local $ENV{PERL_MM_USE_DEFAULT} = 1;
goto &ExtUtils::MakeMaker::prompt;
} else {
goto &ExtUtils::MakeMaker::prompt;
view all matches for this distribution
view release on metacpan or search on metacpan
bin/consult view on Meta::CPAN
exec wish "$0" "$@"
################################################################################
# To do
# -----
# Save defaults for program to run, text colour etc
################################################################################
package require cmdline
################################################################################
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/FANN/Evolving.pm view on Meta::CPAN
while( my ( $k, $v ) = each %{ $hashref } ) {
$constant{$k} = $v;
}
}
my %default = (
'error' => 0.0001,
'epochs' => 5000,
'train_type' => 'ordinary',
'epoch_printfreq' => 100,
'neuron_printfreq' => 0,
lib/AI/FANN/Evolving.pm view on Meta::CPAN
cascade_weight_multiplier => \&_mutate_double, # 'fann_type',
cascade_candidate_limit => \&_mutate_double, # 'fann_type',
)
}
=item defaults
Getter/setter to influence default ANN configuration
=cut
sub defaults {
my $self = shift;
my %args = @_;
for my $key ( keys %args ) {
$log->info("setting $key to $args{$key}");
if ( $key eq 'activation_function' ) {
$args{$key} = $constant{$args{$key}};
}
$default{$key} = $args{$key};
}
return %default;
}
sub _init {
my $self = shift;
my %args = @_;
for ( qw(error epochs train_type epoch_printfreq neuron_printfreq neurons activation_function) ) {
$self->{$_} = $args{$_} // $default{$_};
}
return $self;
}
=item clone
lib/AI/FANN/Evolving.pm view on Meta::CPAN
}
}
=item epochs
Getter/setter for the number of training epochs, default is 500000
=cut
sub epochs {
my $self = shift;
lib/AI/FANN/Evolving.pm view on Meta::CPAN
}
}
=item epoch_printfreq
Getter/setter for the number of epochs after which progress is printed. default is 1000
=cut
sub epoch_printfreq {
my $self = shift;
lib/AI/FANN/Evolving.pm view on Meta::CPAN
}
=item neuron_printfreq
Getter/setter for the number of cascading neurons after which progress is printed.
default is 10
=cut
sub neuron_printfreq {
my $self = shift;
lib/AI/FANN/Evolving.pm view on Meta::CPAN
}
}
=item activation_function
Getter/setter for the function that maps inputs to outputs. default is
FANN_SIGMOID_SYMMETRIC
=back
=cut
view all matches for this distribution
view release on metacpan or search on metacpan
- ppport.h regenerated with latest version of Devel::PPPort to
make it work on perls older than 5.8.8 (bug reported by bodyn).
0.04 May 1, 2006
- corrected bug on accessor generators with indexes
- better accessor generation using default arguments XS feature
0.03 Apr 14, 2006
- improved docs.
0.02 Apr 14, 2006
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/FuzzyEngine/Set.pm view on Meta::CPAN
sub _x_of ($) { return @{shift->[0]} };
sub _y_of ($) { return @{shift->[1]} };
sub _init {
my ($self, %pars) = @_;
my %defaults = ( name => '',
value => 0,
memb_fun => [[]=>[]], # \@x => \@y
variable => undef,
fuzzyEngine => undef,
);
my %attrs = ( %defaults, %pars );
my $class = 'AI::FuzzyEngine';
croak "fuzzyEngine is not a $class"
unless blessed $attrs{fuzzyEngine} && $attrs{fuzzyEngine}->isa($class);
view all matches for this distribution
view release on metacpan or search on metacpan
FuzzyInference.pm view on Meta::CPAN
# standard fuzzy logic operations.
my %_operations = (
'&' => {
min => sub { (sort {$a <=> $b} @_)[0] },
product => sub { my $p = 1; $p *= $_ for @_; $p },
default => 'min',
},
'|' => {
max => sub { (sort {$a <=> $b} @_)[-1] },
sum => sub { my $s = 0; $s += $_ for @_; $s > 1 ? 1 : $s },
default => 'max',
},
'!' => {
complement => sub { 1 - $_[0] },
custom => sub {},
default => 'complement',
},
);
# this hash defines the currently implemented implication methods.
my %_implication = qw(
clip 1
scale 1
default clip
);
# this hash defines the currently implemented aggregation methods.
my %_aggregation = qw(
max 1
default max
);
# this hash defines the currently implemented defuzzification methods.
my %_defuzzification = qw(
centroid 1
default centroid
);
# sub new() - constructor.
#
# doesn't take any arguments. Returns an initialized AI::FuzzyInference object.
FuzzyInference.pm view on Meta::CPAN
}
# sub _init() - private method.
#
# no arguments. Initializes the data structures we will need.
# It also defines the default logic operations we might need.
sub _init {
my $self = shift;
$self->{SET} = new AI::FuzzyInference::Set;
$self->{INVARS} = {};
$self->{OUTVARS} = {};
$self->{RULES} = [];
$self->{RESULTS} = {};
$self->{IMPLICATION} = $_implication{default};
$self->{AGGREGATION} = $_aggregation{default};
$self->{DEFUZZIFICATION} = $_defuzzification{default};
for my $op (qw/& | !/) {
$self->{OPERATIONS}{$op} = $_operations{$op}{default};
}
}
# sub implication() - public method.
#
FuzzyInference.pm view on Meta::CPAN
=over 8
=item min
The result of C<A and B> is C<min(A, B)>. This is the default.
=item product
The result of C<A and B> is C<A * B>.
FuzzyInference.pm view on Meta::CPAN
=over 8
=item max
The result of C<A or B> is C<max(A, B)>. This is the default.
=item sum
The result of C<A or B> is C<min(A + B, 1)>.
FuzzyInference.pm view on Meta::CPAN
=over 8
=item complement
The result of C<not A> is C<1 - A>. This is the default.
=back
The method returns the name of the method to be used for the given
operation.
FuzzyInference.pm view on Meta::CPAN
=over 8
=item clip
This causes the output fuzzy set to be clipped at its support value.
This is the default.
=item scale
This scales the output fuzzy set by multiplying it by its support value.
FuzzyInference.pm view on Meta::CPAN
=item max
The fuzzy sets are combined by taking at each point the maximum value of
all the fuzzy sets at that point.
This is the default.
=back
=item defuzzification()
FuzzyInference.pm view on Meta::CPAN
=item centroid
The centroid (aka I<center of mass> and I<center of gravity>) of the
aggregated fuzzy set is computed and returned.
This is the default.
=back
=item inVar()
view all matches for this distribution
view release on metacpan or search on metacpan
AI/Gene/Sequence.pm view on Meta::CPAN
switch shuffle reverse) } );
##
# calls mutation method at random
# 0: number of mutations to perform
# 1: ref to hash of probs to use (otherwise uses default mutations and probs)
sub mutate {
my $self = shift;
my $num_mutates = +$_[0] || 1;
my $rt = 0;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Genetic/Pro.pm view on Meta::CPAN
Attention! You cannot preserve more chromosomes than exist in your population.
=item -variable_length
This defines whether variable-length chromosomes are turned on (default off)
and a which types of mutation are allowed. See below.
=over 8
=item level 0
Feature is inactive (default). Example:
-variable_length => 0
# chromosomes (i.e. bitvectors)
0 1 0 0 1 1 0 1 1 1 0 1 0 1
lib/AI/Genetic/Pro.pm view on Meta::CPAN
Standard uniform distribution. No additional parameters are needed.
=item C<-selection =E<gt> [ 'RouletteDistribution', 'normal', $av, $sd ]>
Normal distribution, where C<$av> is average (default: size of population /2) and $C<$sd> is standard deviation (default: size of population).
=item C<-selection =E<gt> [ 'RouletteDistribution', 'beta', $aa, $bb ]>
I<Beta> distribution. The density of the beta is:
X^($aa - 1) * (1 - X)^($bb - 1) / B($aa , $bb) for 0 < X < 1.
C<$aa> and C<$bb> are set by default to number of parents.
B<Argument restrictions:> Both $aa and $bb must not be less than 1.0E-37.
=item C<-selection =E<gt> [ 'RouletteDistribution', 'binomial' ]>
Binomial distribution. No additional parameters are needed.
=item C<-selection =E<gt> [ 'RouletteDistribution', 'chi_square', $df ]>
Chi-square distribution with C<$df> degrees of freedom. C<$df> by default is set to size of population.
=item C<-selection =E<gt> [ 'RouletteDistribution', 'exponential', $av ]>
Exponential distribution, where C<$av> is average . C<$av> by default is set to size of population.
=item C<-selection =E<gt> [ 'RouletteDistribution', 'poisson', $mu ]>
Poisson distribution, where C<$mu> is mean. C<$mu> by default is set to size of population.
=back
=item B<Distribution>
lib/AI/Genetic/Pro.pm view on Meta::CPAN
Standard uniform distribution. No additional parameters are needed.
=item C<-selection =E<gt> [ 'Distribution', 'normal', $av, $sd ]>
Normal distribution, where C<$av> is average (default: size of population /2) and $C<$sd> is standard deviation (default: size of population).
=item C<-selection =E<gt> [ 'Distribution', 'beta', $aa, $bb ]>
I<Beta> distribution. The density of the beta is:
X^($aa - 1) * (1 - X)^($bb - 1) / B($aa , $bb) for 0 < X < 1.
C<$aa> and C<$bb> are set by default to number of parents.
B<Argument restrictions:> Both $aa and $bb must not be less than 1.0E-37.
=item C<-selection =E<gt> [ 'Distribution', 'binomial' ]>
Binomial distribution. No additional parameters are needed.
=item C<-selection =E<gt> [ 'Distribution', 'chi_square', $df ]>
Chi-square distribution with C<$df> degrees of freedom. C<$df> by default is set to size of population.
=item C<-selection =E<gt> [ 'Distribution', 'exponential', $av ]>
Exponential distribution, where C<$av> is average . C<$av> by default is set to size of population.
=item C<-selection =E<gt> [ 'Distribution', 'poisson', $mu ]>
Poisson distribution, where C<$mu> is mean. C<$mu> by default is set to size of population.
=back
=back
lib/AI/Genetic/Pro.pm view on Meta::CPAN
Standard uniform distribution. No additional parameters are needed.
=item C<-strategy =E<gt> [ 'Distribution', 'normal', $av, $sd ]>
Normal distribution, where C<$av> is average (default: number of parents/2) and C<$sd> is standard deviation (default: number of parents).
=item C<-strategy =E<gt> [ 'Distribution', 'beta', $aa, $bb ]>
I<Beta> distribution. The density of the beta is:
X^($aa - 1) * (1 - X)^($bb - 1) / B($aa , $bb) for 0 < X < 1.
C<$aa> and C<$bb> are set by default to the number of parents.
B<Argument restrictions:> Both $aa and $bb must not be less than 1.0E-37.
=item C<-strategy =E<gt> [ 'Distribution', 'binomial' ]>
Binomial distribution. No additional parameters are needed.
=item C<-strategy =E<gt> [ 'Distribution', 'chi_square', $df ]>
Chi-squared distribution with C<$df> degrees of freedom. C<$df> by default is set to the number of parents.
=item C<-strategy =E<gt> [ 'Distribution', 'exponential', $av ]>
Exponential distribution, where C<$av> is average . C<$av> by default is set to the number of parents.
=item C<-strategy =E<gt> [ 'Distribution', 'poisson', $mu ]>
Poisson distribution, where C<$mu> is mean. C<$mu> by default is set to the number of parents.
=back
=item PMX
lib/AI/Genetic/Pro.pm view on Meta::CPAN
=back
=item -cache
This defines whether a cache should be used. Allowed values are 1 or 0
(default: I<0>).
=item -history
This defines whether history should be collected. Allowed values are 1 or 0 (default: I<0>).
=item -native
This defines whether native arrays should be used instead of packing each chromosome into signle scalar.
Turning this option can give you speed up, but much more memory will be used. Allowed values are 1 or 0 (default: I<0>).
=item -mce
This defines whether Many-Core Engine (MCE) should be used during processing.
This can give you significant speed up on many-core/CPU systems, but it'll
increase memory consumption. Allowed values are 1 or 0 (default: I<0>).
=item -workers
This option has any meaning only if MCE is turned on. This defines how
many process will be used during processing. Default will be used one proces per core (most efficient).
lib/AI/Genetic/Pro.pm view on Meta::CPAN
File to save a chart in (B<obligatory>).
=item -title
Title of a chart (default: I<Evolution>).
=item -x_label
X label (default: I<Generations>).
=item -y_label
Y label (default: I<Value>).
=item -format
Format of values, like C<sprintf> (default: I<'%.2f'>).
=item -legend1
Description of min line (default: I<Min value>).
=item -legend2
Description of min line (default: I<Mean value>).
=item -legend3
Description of min line (default: I<Max value>).
=item -width
Width of a chart (default: I<640>).
=item -height
Height of a chart (default: I<480>).
=item -font
Path to font (in *.ttf format) to be used (default: none).
=item -logo
Path to logo (png/jpg image) to embed in a chart (default: none).
=item For example:
$ga->chart(-width => 480, height => 320, -filename => 'chart.png');
view all matches for this distribution
view release on metacpan or search on metacpan
=item I<$ga>-E<gt>B<evolve>(I<strategy>, ?I<num_generations>?)
This method causes the GA to evolve the population using the specified strategy.
A strategy name has to be specified as the first argument. The second argument
is optional and specifies the number of generations to evolve. It defaults to
1. See L</"STRATEGIES"> for more information on the default strategies.
Each generation consists of the following steps:
=over
=back
=item I<$ga>-E<gt>B<getFittest>(?I<N>?)
This returns the I<N> fittest individuals. If not specified,
I<N> defaults to 1. As a side effect, it sorts the population by
fitness score. The actual AI::Genetic::Individual objects are returned.
You can use the C<genes()> and C<score()> methods to get the genes and the
scores of the individuals. Please check L<AI::Genetic::Individual> for details.
=item I<$ga>-E<gt>B<sortPopulation>
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Image.pm view on Meta::CPAN
=head1 MODELS
Although the API Key is free, each use incurs a cost. This is dependent on the
model chosen and the size. The 'dall-e-3' model produces better images but at a
higher cost. Likewise, bigger images cost more.
The default model C<dall-e-2> with the default size of C<512x512> produces resonable
results at a low cost and is a good place to start using this module.
See also L<https://platform.openai.com/docs/models/overview>
=head1 METHODS
lib/AI/Image.pm view on Meta::CPAN
The API to use (currently only 'OpenAI' is supported).
=item model
The language model to use (default: 'dall-e-2').
See L<https://platform.openai.com/docs/models/overview>
=item size
The size for the generated image (default: '512x512').
=item debug
Used for testing. If set to any true value, the image method
will return details of the error encountered instead of C<undef>
view all matches for this distribution
view release on metacpan or search on metacpan
LibNeural.pm view on Meta::CPAN
=back
=head2 EXPORT
None by default
=head2 EXPORT TAGS
=over
view all matches for this distribution
view release on metacpan or search on metacpan
doc_install :: doc_$(INSTALLDIRS)_install
$(NOECHO) $(NOOP)
pure__install : pure_site_install
$(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
doc__install : doc_site_install
$(NOECHO) $(ECHO) INSTALLDIRS not defined, defaulting to INSTALLDIRS=site
pure_perl_install :: all
$(NOECHO) umask 022; $(MOD_INSTALL) \
$(INST_LIB) $(DESTINSTALLPRIVLIB) \
$(INST_ARCHLIB) $(DESTINSTALLARCHLIB) \
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/ML/Expr.pm view on Meta::CPAN
=head2 mini-batch
=cut
sub mini_batch {
my ($self, $start, $size, $axis) = @_;
$axis = 0 unless defined $axis; #default
return _bless _mini_batch($self->matrix_id, $start, $size, $axis);
}
=head2 prediction
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/MXNet/Gluon/Contrib/NN/BasicLayers.pm view on Meta::CPAN
$net->add(nn->Identity());
});
Parameters
----------
axis : int, default -1
The axis on which to concatenate the outputs.
=cut
has 'axis' => (is => 'rw', isa => 'Int', default => -1);
method python_constructor_arguments() { ['axis'] }
method forward(GluonInput $x)
{
return AI::MXNet::NDArray->concat((map { $_->($x) } $self->_children->values), dim=>$self->axis);
lib/AI/MXNet/Gluon/Contrib/NN/BasicLayers.pm view on Meta::CPAN
$net->add(nn->Identity());
});
Parameters
----------
axis : int, default -1
The axis on which to concatenate the outputs.
=cut
has 'axis' => (is => 'rw', isa => 'Int', default => -1);
method python_constructor_arguments() { ['axis'] }
method hybrid_forward(GluonClass $F, GluonInput $x)
{
return $F->concat((map { $_->($x) } $self->_children->values), dim=>$self->axis);
lib/AI/MXNet/Gluon/Contrib/NN/BasicLayers.pm view on Meta::CPAN
----------
input_dim : int
Size of the vocabulary, i.e. maximum integer index + 1.
output_dim : int
Dimension of the dense embedding.
dtype : Dtype, default 'float32'
Data type of output embeddings.
weight_initializer : Initializer
Initializer for the embeddings matrix.
=cut
has 'input_dim' => (is => 'ro', isa => 'Int', required => 1);
has 'output_dim' => (is => 'ro', isa => 'Int', required => 1);
has 'dtype' => (is => 'ro', isa => 'Dtype', default => 'float32');
has 'weight_initializer' => (is => 'ro', isa => 'Maybe[Initializer]');
method python_constructor_arguments() { [qw/input_dim output_dim dtype weight_initializer/] }
sub BUILD
{
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/MXNet/Gluon/ModelZoo.pm view on Meta::CPAN
Name of the model.
:$pretrained : Bool
Whether to load the pretrained weights for model.
:$classes : Int
Number of classes for the output layer.
:$ctx : AI::MXNet::Context, default CPU
The context in which to load the pretrained weights.
:$root : Str, default '~/.mxnet/models'
Location for keeping the model parameters.
Returns
-------
HybridBlock
view all matches for this distribution
view release on metacpan or search on metacpan
examples/char_lstm.pl view on Meta::CPAN
char_lstm.pl - Example of training char LSTM RNN on tiny shakespeare using high level RNN interface
with optional inferred sampling (RNN generates Shakespeare like text)
=head1 SYNOPSIS
--num-layers number of stacked RNN layers, default=2
--num-hidden hidden layer size, default=256
--num-embed embed size, default=10
--num-seq sequence size, default=60
--gpus list of gpus to run, e.g. 0 or 0,2,5. empty means using cpu.
Increase batch size when using multiple gpus for best performance.
--kv-store key-value store type, default='device'
--num-epochs max num of epochs, default=25
--lr initial learning rate, default=0.01
--optimizer the optimizer type, default='adam'
--mom momentum for sgd, default=0.0
--wd weight decay for sgd, default=0.00001
--batch-size the batch size type, default=32
--bidirectional use bidirectional cell, default false (0)
--disp-batches show progress for every n batches, default=50
--chkp-prefix prefix for checkpoint files, default='lstm_'
--cell-mode RNN cell mode (LSTM, GRU, RNN, default=LSTM)
--sample-size a size of inferred sample text (default=10000) after each epoch
--chkp-epoch save checkpoint after this many epoch, default=1 (saving every checkpoint)
=cut
package AI::MXNet::RNN::IO::ASCIIIterator;
use Mouse;
extends AI::MXNet::DataIter;
has 'data' => (is => 'ro', isa => 'PDL', required => 1);
has 'seq_size' => (is => 'ro', isa => 'Int', required => 1);
has '+batch_size' => (is => 'ro', isa => 'Int', required => 1);
has 'data_name' => (is => 'ro', isa => 'Str', default => 'data');
has 'label_name' => (is => 'ro', isa => 'Str', default => 'softmax_label');
has 'dtype' => (is => 'ro', isa => 'Dtype', default => 'float32');
has [qw/nd counter seq_counter vocab_size
data_size provide_data provide_label idx/] => (is => 'rw', init_arg => undef);
sub BUILD
{
view all matches for this distribution
view release on metacpan or search on metacpan
* \brief Generate Executor from symbol,
* This is advanced function, allow specify group2ctx map.
* The user can annotate "ctx_group" attribute to name each group.
*
* \param symbol_handle symbol handle
* \param dev_type device type of default context
* \param dev_id device id of default context
* \param num_map_keys size of group2ctx map
* \param map_keys keys of group2ctx map
* \param map_dev_types device type of group2ctx map
* \param map_dev_ids device id of group2ctx map
* \param len length
* \brief Generate Executor from symbol,
* This is advanced function, allow specify group2ctx map.
* The user can annotate "ctx_group" attribute to name each group.
*
* \param symbol_handle symbol handle
* \param dev_type device type of default context
* \param dev_id device id of default context
* \param num_map_keys size of group2ctx map
* \param map_keys keys of group2ctx map
* \param map_dev_types device type of group2ctx map
* \param map_dev_ids device id of group2ctx map
* \param len length
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/AutoInstall.pm view on Meta::CPAN
my ( @Missing, @Existing, %DisabledTests, $UnderCPAN, $HasCPANPLUS );
my ( $Config, $CheckOnly, $SkipInstall, $AcceptDefault, $TestOnly );
my ( $PostambleActions, $PostambleUsed );
# See if it's a testing or non-interactive session
_accept_default( $ENV{AUTOMATED_TESTING} or ! -t STDIN );
_init();
sub _accept_default {
$AcceptDefault = shift;
}
sub missing_modules {
return @Missing;
inc/Module/AutoInstall.pm view on Meta::CPAN
}
elsif ( $arg =~ /^--installdeps=(.*)$/ ) {
__PACKAGE__->install( $Config, @Missing = split( /,/, $1 ) );
exit 0;
}
elsif ( $arg =~ /^--default(?:deps)?$/ ) {
$AcceptDefault = 1;
}
elsif ( $arg =~ /^--check(?:deps)?$/ ) {
$CheckOnly = 1;
}
inc/Module/AutoInstall.pm view on Meta::CPAN
$TestOnly = 1;
}
}
}
# overrides MakeMaker's prompt() to automatically accept the default choice
sub _prompt {
goto &ExtUtils::MakeMaker::prompt unless $AcceptDefault;
my ( $prompt, $default ) = @_;
my $y = ( $default =~ /^[Yy]/ );
print $prompt, ' [', ( $y ? 'Y' : 'y' ), '/', ( $y ? 'n' : 'N' ), '] ';
print "$default\n";
return $default;
}
# the workhorse
sub import {
my $class = shift;
inc/Module/AutoInstall.pm view on Meta::CPAN
)[0]
);
while ( my ( $feature, $modules ) = splice( @args, 0, 2 ) ) {
my ( @required, @tests, @skiptests );
my $default = 1;
my $conflict = 0;
if ( $feature =~ m/^-(\w+)$/ ) {
my $option = lc($1);
inc/Module/AutoInstall.pm view on Meta::CPAN
print "[" . ( $FeatureMap{ lc($feature) } || $feature ) . "]\n";
$modules = [ %{$modules} ] if UNIVERSAL::isa( $modules, 'HASH' );
unshift @$modules, -default => &{ shift(@$modules) }
if ( ref( $modules->[0] ) eq 'CODE' ); # XXX: bugward combatability
while ( my ( $mod, $arg ) = splice( @$modules, 0, 2 ) ) {
if ( $mod =~ m/^-(\w+)$/ ) {
my $option = lc($1);
$default = $arg if ( $option eq 'default' );
$conflict = $arg if ( $option eq 'conflict' );
@tests = @{$arg} if ( $option eq 'tests' );
@skiptests = @{$arg} if ( $option eq 'skiptests' );
next;
inc/Module/AutoInstall.pm view on Meta::CPAN
or _prompt(
qq{==> Auto-install the }
. ( @required / 2 )
. ( $mandatory ? ' mandatory' : ' optional' )
. qq{ module(s) from CPAN?},
$default ? 'y' : 'n',
) =~ /^[Yy]/
)
)
{
push( @Missing, @required );
$DisabledTests{$_} = 1 for map { glob($_) } @skiptests;
}
elsif ( !$SkipInstall
and $default
and $mandatory
and
_prompt( qq{==> The module(s) are mandatory! Really skip?}, 'n', )
=~ /^[Nn]/ )
{
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/MegaHAL.pm view on Meta::CPAN
=over 4
=item B<Path> - The path to MegaHALs brain or training file (megahal.brn and megahal.trn respectively). If 'Path' is not specified the current working directory is assumed.
=item B<Banner> - A flag which enables/disables the banner which is displayed when MegaHAL starts up. The default is to disable the banner.
=item B<Prompt> - A flag which enables/disables the prompt. This flag is only useful when MegaHAL is run interactively and is disabled by default.
=item B<Wrap> - A flag which enables/disables word wrapping of MegaHALs responses when the lines exceed 80 characters in length. The default is to disable word wrapping.
=back
=head1 METHODS
view all matches for this distribution
view release on metacpan or search on metacpan
bin/remote.pl view on Meta::CPAN
$k =~ s!$tail!!;
}
}
}
${"$class\::Default"} = $data->{default} || ':all';
${"$class\::Theme"} = ( split /::/, $class )[-1];
*{"$class\::import"} = sub {
my $callpkg = caller(0);
my $theme = ${"$class\::Theme"};
bin/remote.pl view on Meta::CPAN
my $class = shift;
no strict 'refs';
my $self = bless { @_, cache => [] }, $class;
# compute some defaults
$self->{category} ||= ${"$class\::Default"};
# fall back to last resort (FIXME should we carp()?)
$self->{category} = ${"$class\::Default"}
if $self->{category} ne ':all'
bin/remote.pl view on Meta::CPAN
sub extract {
my $class = ref $_[0] || $_[0];
no strict 'refs';
my $func = ${"$class\::Remote"}{extract};
# provide a very basic default
my $meth = ref $func eq 'CODE'
? sub { my %seen; return grep { !$seen{$_}++ } $func->( $_[1] ); }
: sub { return $_[1] }; # very basic default
# put the method in the subclass symbol table (at runtime)
*{"$class\::extract"} = $meth;
# now run the function^Wmethod
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/NNEasy.pm view on Meta::CPAN
The output size (number of nodes in the output layer).
=item @HIDDEN_LAYERS
A list of size of hidden layers. By default we have 1 hidden layer, and
the size is calculated by I<(IN_SIZE + OUT_SIZE)>. So, for a NN of
2 inputs and 1 output the hidden layer have 3 nodes.
=item %CONF
lib/AI/NNEasy.pm view on Meta::CPAN
=item OK_OUTPUTS
Minimal number of outputs that should be OK when calculating the erros.
By default I<OK_OUTPUTS> should have the same size of number of different
inouts in the @SET.
=item LIMIT
Limit of interations when learning. Default: 30000
lib/AI/NNEasy.pm view on Meta::CPAN
nodes that can give to us an output near the real output. So, if the output of [0,1]
is [1,1], the nodes I<output1> and I<output2> should give to us a number near 1,
let's say 0.98654. And if the output for [0,0] is [0,0], I<output1> and I<output2> should give to us a number near 0,
let's say 0.078875.
What is hard in a NN is to find this I<weights>. By default L<AI::NNEasy> uses
I<backprop> as learning algorithm. With I<backprop> it pastes the inputs through
the Neural Network and adjust the I<weights> using random numbers until we find
a set of I<weights> that give to us the right output.
The secret of a NN is the number of hidden layers and nodes/neurons for each layer.
view all matches for this distribution
view release on metacpan or search on metacpan
examples/xor_minimal.pl view on Meta::CPAN
# Example demonstrating XOR with momentum backprop learning
# and minimal set of parameters (using default values)
use strict;
use AI::NNFlex::Backprop;
use AI::NNFlex::Dataset;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/NaiveBayes.pm view on Meta::CPAN
=head1 SYNOPSIS
# AI::NaiveBayes objects are created by AI::NaiveBayes::Learner
# but for quick start you can use the 'train' class method
# that is a shortcut using default AI::NaiveBayes::Learner settings
my $classifier = AI::NaiveBayes->train(
{
attributes => {
sheep => 1, very => 1, valuable => 1, farming => 1
lib/AI/NaiveBayes.pm view on Meta::CPAN
this class.
Creation of C<AI::NaiveBayes> classifier object out of training
data is done by L<AI::NaiveBayes::Learner>. For quick start
you can use the limited C<train> class method that trains the
classifier in a default way.
The classifier object is immutable.
It is a well-studied probabilistic algorithm often used in
automatic text categorization. Compared to other algorithms (kNN,
lib/AI/NaiveBayes.pm view on Meta::CPAN
Internal. See L<AI::NaiveBayes::Learner> to learn how to create a C<AI::NaiveBayes>
classifier from training data.
=item train( LIST of HASHREFS )
Shortcut for creating a trained classifier using L<AI::NaiveBayes::Learner> default
settings.
Arguments are passed to the C<add_example> method of the L<AI::NaiveBayes::Learner>
object one by one.
=item classify( HASHREF )
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/Nerl.pm view on Meta::CPAN
has scale_input => (
is => 'ro',
isa => 'Num',
required => 0,
default => 0,
);
has l2 => ( #hidden layer.
is => 'ro',
isa => 'Num',
default => 30,
);
has [qw/ train_x
train_y /] => (
is => 'ro',
lib/AI/Nerl.pm view on Meta::CPAN
);
has passes=> (
is => 'rw',
isa => 'Int',
default => 10,
);
has basis => (
is => 'ro',
isa => 'AI::Nerl',
view all matches for this distribution
view release on metacpan or search on metacpan
BackProp.pm view on Meta::CPAN
my $delta = $ammount * ($what - $value) * $self->{SYNAPSES}->{LIST}->[$i]->{INPUT};
$self->{SYNAPSES}->{LIST}->[$i]->{WEIGHT} += $delta;
$self->{SYNAPSES}->{LIST}->[$i]->{PKG}->weight($ammount,$what);
}
# This formula in use by default is original by me (Josiah Bryan) as far as I know.
# If it is equal, then don't adjust
#
### Disabled because this soemtimes causes
### infinte loops when learning with range limits enabled
BackProp.pm view on Meta::CPAN
# 3. So we would loop over and every 3 neurons we would connect each of those 3
# neurons to one input of every neuron in the next set of 3 neurons. Of course, this
# is an example. 3 and 2 are set by the new() constructor.
# Flag values:
# 0 - (default) -
# My feed-foward style: Each neuron in layer X is connected to one input of every
# neuron in layer Y. The best and most proven flag style.
#
# ^ ^ ^
# O\ O\ /O Layer Y
BackProp.pm view on Meta::CPAN
are seven new practical-use example scripts. Also implemented in this version is a much cleaner
learning function for individual neurons which is more accurate than previous verions and is
based on the LMS rule. See range() for information on output range limits. I have also updated
the load() and save() methods so that they do not depend on Storable anymore. In this version
you also have the choice between three network topologies, two not as stable, and the third is
the default which has been in use for the previous four versions.
=head1 DESCRIPTION
AI::NeuralNet::BackProp implements a nerual network similar to a feed-foward,
BackProp.pm view on Meta::CPAN
object. The network will have C<$layers> number layers in it
and each layer will have C<$size> number of neurons in that layer.
There is an optional parameter of $outputs, which specifies the number
of output neurons to provide. If $outputs is not specified, $outputs
defaults to equal $size. $outputs may not exceed $size. If $outputs
exceeds $size, the new() constructor will return undef.
The optional parameter, $topology_flag, defaults to 0 when not used. There are
three valid topology flag values:
B<0> I<default>
My feed-foward style: Each neuron in layer X is connected to one input of every
neuron in layer Y. The best and most proven flag style.
^ ^ ^
O\ O\ /O Layer Y
BackProp.pm view on Meta::CPAN
max => $maximum_iterations
error => $maximum_allowable_percentage_of_error
$learning_gradient is an optional value used to adjust the weights of the internal
connections. If $learning_gradient is ommitted, it defaults to 0.20.
$maximum_iterations is the maximum numbers of iteration the loop should do.
It defaults to 1024. Set it to 0 if you never want the loop to quit before
the pattern is perfectly learned.
$maximum_allowable_percentage_of_error is the maximum allowable error to have. If
this is set, then learn() will return when the perecentage difference between the
actual results and desired results falls below $maximum_allowable_percentage_of_error.
BackProp.pm view on Meta::CPAN
is not set, then it will return a percentage represting the amount of forgetfullness. Otherwise,
learn_set() will return an integer specifying the amount of forgetfulness when all the patterns
are learned.
If "pattern" is set, then learn_set() will use that pattern in the data set to measure forgetfulness by.
If "pattern" is omitted, it defaults to the first pattern in the set. Example:
my @set = (
[ 0,1,0,1 ], [ 0 ],
[ 0,0,1,0 ], [ 1 ],
[ 1,1,0,1 ], [ 2 ], # <---
BackProp.pm view on Meta::CPAN
number of elements has passed. Additionally, if you include a $high_state_character and a $low_state_character,
it will print the $high_state_character (can be more than one character) for every element that
has a true value, and the $low_state_character for every element that has a false value.
If you do not supply a $high_state_character, or the $high_state_character is a null or empty or
undefined string, it join_cols() will just print the numerical value of each element seperated
by a null character (\0). join_cols() defaults to the latter behaviour.
=item $net->pdiff($array_ref_A, $array_ref_B);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/NeuralNet/FastSOM/Hexa.pm view on Meta::CPAN
The constructor takes the following arguments (additionally to those in
the base class):
=over
=item C<output_dim> : (mandatory, no default)
A positive, non-zero number specifying the diameter of the hexagonal. C<1>
creates one with a single hexagon, C<2> one with 4, C<3> one with 9. The
number plays the role of a diameter.
view all matches for this distribution
view release on metacpan or search on metacpan
$self->{c}->update;
$l->update;
DoOneEvent(DONT_WAIT); # be kind and process XEvents if they arise
}
$label_txt = "Did $self->{t} epochs: now smoothed by "
.($self->{smoothing}? $self->{smoothing} : "default amount");
$_->smooth;
# MainLoop;
return 1;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/NeuralNet/Kohonen/Visual.pm view on Meta::CPAN
=over 4
=item display
Set to C<hex> for display as a unified distance matrix, rather than
as the default plain grid;
=item display_scale
Set with a factor to effect the size of the display.
lib/AI/NeuralNet/Kohonen/Visual.pm view on Meta::CPAN
=item missing_colour
When selecting a colour using L<METHOD get_colour_for>,
every node weight holding the value of C<missing_mask>
will be given the value of this paramter. If this paramter
is not defined, the default is 0.
=back
=cut
lib/AI/NeuralNet/Kohonen/Visual.pm view on Meta::CPAN
in a hash with the following keys as options:
The values of C<bmu_x> and C<bmu_y> represent The I<x> and I<y>
co-ordinates of unit to highlight using the value in the
C<hicol> to highlight it with colour. If no C<hicolo> is provided,
it default to red.
When called, this method also sets the object field flag C<plotted>:
currently, this prevents C<main_loop> from calling this routine.
See also L<METHOD get_colour_for>.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/AI/NeuralNet/Kohonen.pm view on Meta::CPAN
=item map_dim_x
=item map_dim_y
The dimensions of the feature map to create - defaults to a toy 19.
(note: this is Perl indexing, starting at zero).
=item epochs
Number of epochs to run for (see L<METHOD train>).
lib/AI/NeuralNet/Kohonen.pm view on Meta::CPAN
If undefined, random targets are chosen; otherwise
they're iterated over. Just for experimental purposes.
=item smoothing
The amount of smoothing to apply by default when C<smooth>
is applied (see L</METHOD smooth>).
=item neighbour_factor
When working out the size of the neighbourhood of influence,
the average of the dimensions of the map are divided by this variable,
before the exponential function is applied: the default value is 2.5,
but you may with to use 2 or 4.
=item missing_mask
Used to signify data is missing in an input vector. Defaults
lib/AI/NeuralNet/Kohonen.pm view on Meta::CPAN
=head1 METHOD train
Optionally accepts a parameter that is the number of epochs
for which to train: the default is the value in the C<epochs> field.
An epoch is composed of A number of generations, the number being
the total number of input vectors.
For every generation, iterates:
view all matches for this distribution