Computer Science homework help
An audio description of the following can be found at: Blackboard>Tools>Blackboard Collaborate>Decision Science Room (April 21)
Project: Design a decision fusion tool to perform weighted fusion for “m” algorithms. Submit (i) codes, as well as an (ii) executable file in a zipped folder. The tool will have two menu options:
Training |
Testing |
- A User will train your tool with an input file named “training.txt”, and test it with another input file named “testing.txt”. These files will have 1, or -1 entries separated by space, indicating a “yes” or “no” decision, respectively.
- The “training.txt” will have “r” rows and “m+1” columns (use integer type for “r” and “m”). Each row represents decisions for a different case. First “m” columns represent decision from “m” algorithms, and the “m+1” column represents the correct decision. Your tool will compute “m” weights for “m” cases, and write them in a file “weight.txt,” as a row.
- The “testing.txt” will have “v” rows and “m” columns. Each row represents a different case that needs to be tested. The “m” columns represent decisions from “m” algorithms. Your tool will compute “v” decisions for “v” cases, and write them in a file “output.txt,” as a column.
- Both the files will be stored in “c” drive; so you will have to read from there. Use your own input files while developing your tool. Your program will determine how many rows and columns are needed from the dimension of the files.
Training (i.e., compute decision weights)
- W[m]; FinalWeight[m]; PreviousCount=0;
Randomly initialize weight vector W[m].
Read training.txt in training [r][m+1] array.
- Do the following for minimum 100,000 times:
{Count=0;
For case = 1 to r
{
For decision = 1 to m
Sum= Sum + Training [case] [decision] x W[decision];
If (Sum>0), Final= 1
Else if (Sum<0), Final= -1
Else, Final =0.
If (Final== Training [case] [m+1]), Count++;
}
If (Count>PreviousCount)
{
PreviousCount=Count;
FinalWeight[m]=W[m];
}
Randomly change some entries in W[m];
}
- SAVE FinalWeight[m].
Testing
Use the FinalWeight[m] values to compute decisions for the testing.txt input file using the following steps.
- Read testing.txt in testing [v][m] array.
- For case = 1 to v
{
If å testing[case][m]xV[m] >0 then decision[v]= 1
Else, If å testing[case][m]xV[m] < 0 then decision[v]= -1
If decision[v]= 0;
}
- SAVE decision[v];