CatgirlIntelligenceAgency/code/index/test/nu/marginalia/ranking/domains/RankingAlgorithmWithRealDataTest.java

78 lines
2.4 KiB
Java
Raw Normal View History

2024-02-22 18:01:35 +01:00
package nu.marginalia.ranking.domains;
2024-02-22 18:01:35 +01:00
import nu.marginalia.ranking.domains.accumulator.RankingResultListAccumulator;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.util.List;
// Test the ranking algorithm with prod data. Will not run if the data is not available.
// It's not feasible to include the data in the git repo, as it's ~6 GB of data.
@Disabled
class RankingAlgorithmWithRealDataTest {
@Test
public void testRegularPR() {
if (!TestGraphSourceForLinkData.isAvailable()) {
return;
}
var graphSource = new TestGraphSourceForLinkData();
var results = new PageRankDomainRanker(graphSource, List.of())
.calculate(10, RankingResultListAccumulator::new);
for (int i = 0; i < results.size(); i++) {
System.out.println(i + " " + graphSource.getName(results.get(i)));
}
}
@Test
public void testInvertedLinkGraph() {
if (!TestGraphSourceForInvertedLinkData.isAvailable()) {
return;
}
var graphSource = new TestGraphSourceForInvertedLinkData();
var results = new PageRankDomainRanker(graphSource, List.of())
.calculate(10, RankingResultListAccumulator::new);
for (int i = 0; i < results.size(); i++) {
System.out.println(i + " " + graphSource.getName(results.get(i)));
}
}
@Test
public void testSimilarityPR() {
if (!TestGraphSourceForSimilarityData.isAvailable()) {
return;
}
var graphSource = new TestGraphSourceForSimilarityData();
var results = new PageRankDomainRanker(graphSource, List.of())
.calculate(10, RankingResultListAccumulator::new);
for (int i = 0; i < results.size(); i++) {
System.out.println(i + " " + graphSource.getName(results.get(i)));
}
}
@Test
public void testSimilarityPPR() {
if (!TestGraphSourceForSimilarityData.isAvailable()) {
return;
}
var graphSource = new TestGraphSourceForSimilarityData();
var results = new PageRankDomainRanker(graphSource,
List.of(1476552) // wiby.me
)
.calculate(10, RankingResultListAccumulator::new);
for (int i = 0; i < results.size(); i++) {
System.out.println(i + " " + graphSource.getName(results.get(i)));
}
}
}