AI-Perceptron-Simple

 view release on metacpan or  search on metacpan

docs/AI-Perceptron-Simple-1.04.html  view on Meta::CPAN


<dt id="stimuli_validate-csv_file">stimuli_validate =&gt; $csv_file</dt>
<dd>

<p>This is the CSV file containing the validation data, make sure that it contains a column with the predicted values as it is needed in the next key mentioned: <code>predicted_column_index</code></p>

</dd>
<dt id="predicted_column_index-column_number">predicted_column_index =&gt; $column_number</dt>
<dd>

<p>This is the index of the column that contains the predicted output values. <code>$index</code> starts from <code>0</code>.</p>

<p>This column will be filled with binary numbers and the full new data will be saved to the file specified in the <code>results_write_to</code> key.</p>

</dd>
<dt id="results_write_to-new_csv_file">results_write_to =&gt; $new_csv_file</dt>
<dd>

<p>Optional.</p>

<p>The default behaviour will write the predicted output back into <code>stimuli_validate</code> ie the original data. The sequence of the data will be maintained.</p>

lib/AI/Perceptron/Simple.pm  view on Meta::CPAN

For C<%options>, the followings are needed unless mentioned:

=over 4

=item stimuli_validate => $csv_file

This is the CSV file containing the validation data, make sure that it contains a column with the predicted values as it is needed in the next key mentioned: C<predicted_column_index>

=item predicted_column_index => $column_number

This is the index of the column that contains the predicted output values. C<$index> starts from C<0>.

This column will be filled with binary numbers and the full new data will be saved to the file specified in the C<results_write_to> key.

=item results_write_to => $new_csv_file

Optional.

The default behaviour will write the predicted output back into C<stimuli_validate> ie the original data. The sequence of the data will be maintained.

=back

lib/AI/Perceptron/Simple.pm  view on Meta::CPAN

    for ( qw( stimuli_validate predicted_column_index ) ) {
        push @missing_keys, $_ unless exists $data_hash_ref->{ $_ };
    }
    
    croak "Missing keys: @missing_keys" if @missing_keys;
    #####
    
    my $stimuli_validate = $data_hash_ref->{ stimuli_validate };
    my $predicted_index = $data_hash_ref->{ predicted_column_index };
    
    # actual processing starts here
    my $output_file = defined $data_hash_ref->{ results_write_to } 
                        ? $data_hash_ref->{ results_write_to }
                        : $stimuli_validate;
    
    # open for writing results
    my $aoa = csv (in => $stimuli_validate, encoding => ":encoding(utf-8)");
    
    my $attrib_array_ref = shift @$aoa; # 'remove' the header, it's annoying :)

    $aoa = _fill_predicted_values( $self, $stimuli_validate, $predicted_index, $aoa );



( run in 0.442 second using v1.01-cache-2.11-cpan-0d8aa00de5b )