#include #include #include /* // 1. Title: 1984 United States Congressional Voting Records Database // // 2. Source Information: // (a) Source: Congressional Quarterly Almanac, 98th Congress, // 2nd session 1984, Volume XL: Congressional Quarterly Inc. // Washington, D.C., 1985. // (b) Donor: Jeff Schlimmer (Jeffrey.Schlimmer@a.gp.cs.cmu.edu) // (c) Date: 27 April 1987 // // 4. Relevant Information: // This data set includes votes for each of the U.S. House of // Representatives Congressmen on the 16 key votes identified by the // CQA. The CQA lists nine different types of votes: voted for, paired // for, and announced for (these three simplified to yea), voted // against, paired against, and announced against (these three // simplified to nay), voted present, voted present to avoid conflict // of interest, and did not vote or otherwise make a position known // (these three simplified to an unknown disposition). // // 5. Number of Instances: 435 (267 democrats, 168 republicans) // // MSB NOTE: Any voting record (instance) that contained >=1 unknowns was removed. // MSB NOTE: This left only 232 of the original 435 instances. // // 6. Number of Attributes: 16 + class name = 17 (all Boolean valued) // // MSB NOTE: All attribute values were changed to 0s and 1s as noted below // // 7. Attribute Information: // 1. Class Name: 2 (0=democrat, 1=republican) // 2. handicapped-infants: 2 (1=y,0=n) // 3. water-project-cost-sharing: 2 (1=y,0=n) // 4. adoption-of-the-budget-resolution: 2 (1=y,0=n) // 5. physician-fee-freeze: 2 (1=y,0=n) // 6. el-salvador-aid: 2 (1=y,0=n) // 7. religious-groups-in-schools: 2 (1=y,0=n) // 8. anti-satellite-test-ban: 2 (1=y,0=n) // 9. aid-to-nicaraguan-contras: 2 (1=y,0=n) // 10. mx-missile: 2 (1=y,0=n) // 11. immigration: 2 (1=y,0=n) // 12. synfuels-corporation-cutback: 2 (1=y,0=n) // 13. education-spending: 2 (1=y,0=n) // 14. superfund-right-to-sue: 2 (1=y,0=n) // 15. crime: 2 (1=y,0=n) // 16. duty-free-exports: 2 (1=y,0=n) // 17. export-administration-act-south-africa: 2 (1=y,0=n) */ #define N 232 int table[N][17]={ 0,0,1,1,0,1,1,0,0,0,0,0,0,1,1,1,1, 1,0,1,0,1,1,1,0,0,0,0,0,1,1,1,0,1,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,0,1,0, 1,1,1,0,1,1,1,0,0,0,0,1,1,1,1,0,1, 0,1,1,1,0,1,1,0,1,0,0,1,0,1,0,1,1, 0,0,1,1,0,1,1,0,1,0,0,0,0,0,0,0,1, 1,0,1,0,1,1,1,0,0,0,1,1,1,1,1,0,0, 1,1,1,0,1,1,1,0,0,0,1,0,1,1,1,0,1, 1,0,0,0,1,1,1,0,0,0,0,0,1,1,1,0,1, 0,1,0,1,0,1,1,0,0,1,1,0,0,1,1,0,1, 0,0,0,0,1,1,1,0,0,0,0,1,1,1,1,0,0, 1,0,0,0,1,1,1,0,0,0,0,0,1,1,1,0,0, 1,0,0,0,1,1,1,0,0,0,0,1,1,1,1,0,1, 0,1,0,1,0,0,1,1,1,1,1,1,0,0,0,0,1, 1,0,0,0,1,1,1,0,0,0,1,0,1,1,1,0,1, 0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,1, 1,1,1,0,1,1,1,0,0,0,1,0,0,1,1,0,1, 0,1,1,1,0,0,0,1,1,1,1,1,0,1,0,0,1, 0,1,1,1,0,0,0,1,1,0,1,0,0,0,0,0,1, 0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,1, 1,1,1,1,1,1,1,1,1,0,1,0,0,1,1,0,1, 0,0,1,1,0,1,1,1,1,0,0,1,0,1,0,1,1, 0,0,0,1,0,0,1,1,1,1,0,1,0,0,0,1,1, 0,0,1,1,0,0,1,1,1,1,0,1,0,0,1,1,1, 0,1,0,1,0,0,0,1,1,1,1,0,0,0,0,1,1, 1,0,0,0,1,1,1,1,1,0,1,0,1,1,1,0,1, 1,0,0,1,1,1,1,0,0,1,1,0,1,1,1,0,1, 0,0,0,1,0,0,0,1,1,1,1,0,0,0,0,0,1}; // Mitchell's Entropy function double Entropy(int p, int n) { double p1, p2, t1, t2; if (p) { p1=((double) p)/((double) p+n); t1=(-p1*log2(p1)); } else { t1=0.; } if (n) { p2=((double) n)/((double) p+n); t2=(-p2*log2(p2)); } else { t2=0.; } return(t1+t2); } // Russell and Norvig's information content function, I, // tailored for the case n=2 (see page 659) double I(double p1, double p2) { double t1, t2; if (p1) { t1=(-p1*log2(p1)); } else { t1=0.; } if (p2) { t2=(-p2*log2(p2)); } else { t2=0.; } return(t1+t2); } void Normalize(double w[], int size) { double sum=0.; for (int i=0; i