Perl-Sensitive Sunglasses PerlMonks

### Predict project success by fuzzy logic

by chunlou (Curate)
 on Aug 04, 2003 at 02:11 UTC ( #280540=CUFP: print w/replies, xml ) Need Help??

Just an instructional toy, it predicts the likelihood of a project to succeed based on 1) Leadership, 2) Resources, and 3) Deadline, for which you will enter their ratings at the command prompt after running the script. Press Ctrl-C to quit.

You will need to have AI::Fuzzy and AI::FuzzyInference installed.

In a sense, fuzzy logic is not unlike regression analysis.

```use strict;
use warnings;
use AI::Fuzzy;
use AI::FuzzyInference;

print "##### Project Success Prediction System by Fuzzy Logic #####\n\
+n";
print "Predict the likelihood of a project to succeed based on\n";
print "Press Ctrl-C to quit.\n\n";
print "Leadership quality (1: poor - 10: superb): ";
my \$predict = predict();
while(<STDIN>){print \$predict->(\$_)}

sub predict {
my \$infer = infer();
my @prompt = (
"Leadership quality (1: poor - 10: superb): ",
"Resources (physical & human) available (1: scarce - 10: plent
+y): ",
"Deadline (1: tight - 10: reasonable): "
);
my @input;
return sub {
push @input, shift;
return \$#input < 2 ? \$prompt[\$#input+1] : \$infer->(map{shift @
+input}1..3) . "\n\n" . \$prompt[\$#input+1];
};
}

sub infer {
my \$proj = new AI::FuzzyInference;
poor       => [       1,1,  5,0],
good       => [4,0,   7,1,  9,0],
superb     => [8,0,  10,1      ] );
\$proj->inVar('resources', 1, 10,
scarce     => [       1,1,  5,0],
plenty     => [7,0,  10,1     ] );
tight      => [       1,1,  6,0],
reasonable => [4,0,  10,1     ] );
\$proj->outVar('success', 0, 100,
unlikely   => [         0,1,  45,0],
maybe      => [40,0,   60,1,  85,0],
likely     => [80,0,  100,1       ] );
+ => 'success=unlikely',
+ => 'success=unlikely',
+ => 'success=unlikely',
+ => 'success=maybe',
+ => 'success=maybe',
+ => 'success=maybe',

+ => 'success=unlikely',
+ => 'success=maybe',
+ => 'success=maybe',
+ => 'success=likely',
+ => 'success=maybe',
+ => 'success=likely',

+ => 'success=maybe',
+ => 'success=maybe',
+ => 'success=maybe',
+ => 'success=likely',
+ => 'success=maybe',
+ => 'success=likely' );

my \$success = new AI::Fuzzy::Axis;

use constant K => 1e-12;
\$success->addlabel("unlikely", - K,   0,   45   );

return sub {
+ne => \$_[2]);
my @predict = @{[\$success->labelvalue(\$proj->value('success'))
+]};
my \$predict;
if (\$predict[0] =~ /unlikely/i) {
\$predict = "\n\n~~~~~ Sorry, you're screwed. (Prediction c
+onfidence: " . int(100*\$predict[1]) . "%). ~~~~~\n\n";
} elsif (\$predict[0] =~ /maybe/i) {
\$predict = "\n\n----- Take heart, you'll probably make it.
+ (Prediction confidence: " . int(100*\$predict[1]) . "%). -----\n\n";
} elsif (\$predict[0] =~ /likely/i) {
\$predict = "\n\n***** Congrat, you're like to succeed. (Pr
+ediction confidence: " . int(100*\$predict[1]) . "%). *****\n\n";
}
return \$predict;
};
}

Replies are listed 'Best First'.
Re: Predict project success by fuzzy logic
by Zaxo (Archbishop) on Aug 04, 2003 at 02:42 UTC

Brooks observes that throwing personnel at a late project makes it later.

I'd have more interest in things like this if they scored the user's guesses instead of the project.

After Compline,
Zaxo

Right, it's mentioned in this class notes (PDF).

Create A New User
Node Status?
node history
Node Type: CUFP [id://280540]
Approved by ybiC
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2018-04-26 14:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
My travels bear the most uncanny semblance to ...

Results (96 votes). Check out past polls.

Notices?