Skip Menu |

This queue is for tickets about the Algorithm-NaiveBayes CPAN distribution.

Report information
The Basics
Id: 63630
Status: open
Priority: 0/
Queue: Algorithm-NaiveBayes

People
Owner: Nobody in particular
Requestors: mailgpa [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: can't use predict on restored object
Date: Mon, 6 Dec 2010 01:26:54 +0300
To: bug-Algorithm-NaiveBayes <bug-Algorithm-NaiveBayes [...] rt.cpan.org>
From: Pavel Goloborodko <mailgpa [...] gmail.com>
Hello. I'm getting the following message trying to call predict on an object restored from file: "Can't use an undefined value as a HASH reference at /usr/local/share/perl/5.10.1/Algorithm/NaiveBayes/Model/Frequency.pm line 62." It works fine with the same args I'm calling it immediately after train without save/restore. Could you please help with a solution or workaround? Thanks. Algorithm::NaiveBayes version 0.04 $ perl -v This is perl, v5.10.1 (*) built for i486-linux-gnu-thread-multi (with 50 registered patches, see perl -V for more detail) Copyright 1987-2009, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page. $ uname -a Linux subzero 2.6.32-5-686 #1 SMP Thu Nov 25 18:43:34 UTC 2010 i686 GNU/Linux -- С уважением, / Kind regards, Павел Голобородько / Pavel Goloborodko
From: lockster [...] gmail.com
It's not that clear in the documentation, but you should call restore on the class itself, and let restore_state return a NaiveBayes object like so: my $nb = Algorithm::NaiveBayes->restore_state("test_Algorithm-NaiveBayes_state"); On Sun Dec 05 17:27:02 2010, mailgpa@gmail.com wrote: Show quoted text
> Hello. > > I'm getting the following message trying to call predict on an object > restored from file: "Can't use an undefined value as a HASH reference > at > /usr/local/share/perl/5.10.1/Algorithm/NaiveBayes/Model/Frequency.pm > line 62." > > It works fine with the same args I'm calling it immediately after > train without save/restore. > > Could you please help with a solution or workaround? > > Thanks. > > Algorithm::NaiveBayes version 0.04 > > $ perl -v > > This is perl, v5.10.1 (*) built for i486-linux-gnu-thread-multi > (with 50 registered patches, see perl -V for more detail) > > Copyright 1987-2009, Larry Wall > > Perl may be copied only under the terms of either the Artistic License > or the > GNU General Public License, which may be found in the Perl 5 source > kit. > > Complete documentation for Perl, including FAQ lists, should be found > on > this system using "man perl" or "perldoc perl". If you have access to > the > Internet, point your browser at http://www.perl.org/, the Perl Home > Page. > > $ uname -a > Linux subzero 2.6.32-5-686 #1 SMP Thu Nov 25 18:43:34 UTC 2010 i686 > GNU/Linux >