@Test public void testComputeWeightedVote() { Prediction weightedPred=weightedVote.computeWeightedVote(); assertEquals(1,weightedPred.getVote(0, 0), EPS); assertEquals(2,weightedPred.getVote(1, 0), EPS); assertEquals(3,weightedPred.getVote(2, 0), EPS); assertEquals(4,weightedPred.getVote(3, 0), EPS); }
@Override public Prediction computeWeightedVote() { int n=votes.size(); if (n>0){ int numOutputs=outputAttributesCount.length; weights=new double[n][numOutputs]; weightedVote=new MultiLabelPrediction(numOutputs); for (int o=0;o<numOutputs;o++) { for (int i=0; i<n; i++) { if(votes.get(i).hasVotesForAttribute(o)){ weights[i][o]=1; weightedVote.setVotes(o, votes.get(i).getVotes(o)); break; } } } } return weightedVote; }
FirstHitVoteMultiLabel extends AbstractErrorWeightedVoteMultiLabel { @Override public Prediction computeWeightedVote() { int n=votes.size(); if (n>0){ int numOutputs=outputAttributesCount.length; weights=new double[n][numOutputs]; weightedVote=new MultiLabelPrediction(numOutputs); for (int o=0;o<numOutputs;o++) { for (int i=0; i<n; i++) { if(votes.get(i).hasVotesForAttribute(o)){ weights[i][o]=1; weightedVote.setVotes(o, votes.get(i).getVotes(o)); break; } } } } return weightedVote; } }
FirstHitVoteMultiLabel extends AbstractErrorWeightedVoteMultiLabel { @Override public Prediction computeWeightedVote() { int n=votes.size(); if (n>0){ int numOutputs=outputAttributesCount.length; weights=new double[n][numOutputs]; weightedVote=new MultiLabelPrediction(numOutputs); for (int o=0;o<numOutputs;o++) { for (int i=0; i<n; i++) { if(votes.get(i).hasVotesForAttribute(o)){ weights[i][o]=1; weightedVote.setVotes(o, votes.get(i).getVotes(o)); break; } } } } return weightedVote; }  }
FirstHitVoteMultiLabel extends AbstractErrorWeightedVoteMultiLabel { @Override public Prediction computeWeightedVote() { int n=votes.size(); if (n>0){ int numOutputs=outputAttributesCount.length; weights=new double[n][numOutputs]; weightedVote=new MultiLabelPrediction(numOutputs); for (int o=0;o<numOutputs;o++) { for (int i=0; i<n; i++) { if(votes.get(i).hasVotesForAttribute(o)){ weights[i][o]=1; weightedVote.setVotes(o, votes.get(i).getVotes(o)); break; } } } } return weightedVote; }  @Override Prediction computeWeightedVote(); }
FirstHitVoteMultiLabel extends AbstractErrorWeightedVoteMultiLabel { @Override public Prediction computeWeightedVote() { int n=votes.size(); if (n>0){ int numOutputs=outputAttributesCount.length; weights=new double[n][numOutputs]; weightedVote=new MultiLabelPrediction(numOutputs); for (int o=0;o<numOutputs;o++) { for (int i=0; i<n; i++) { if(votes.get(i).hasVotesForAttribute(o)){ weights[i][o]=1; weightedVote.setVotes(o, votes.get(i).getVotes(o)); break; } } } } return weightedVote; }  @Override Prediction computeWeightedVote();  }